mirror of
https://github.com/Lurkki14/tuxclocker.git
synced 2024-11-28 10:53:49 -06:00
lib: add string array duplication function
This commit is contained in:
parent
de8e42db81
commit
bd61cbe98c
13
src/lib/tc_common.c
Normal file
13
src/lib/tc_common.c
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#include <tc_common.h>
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
char **tc_str_arr_dup(int8_t str_count, char **const strings) {
|
||||||
|
char **ptr_arr = calloc(str_count, sizeof(char*));
|
||||||
|
for (int8_t i = 0; i < str_count; i++) {
|
||||||
|
ptr_arr[i] = strdup(strings[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
@ -11,6 +11,8 @@ module_path_def = module_path_def_template.format(get_option('prefix'), get_opti
|
|||||||
libtuxclocker = shared_library('libtuxclocker',
|
libtuxclocker = shared_library('libtuxclocker',
|
||||||
['lib/tc_assignable.c',
|
['lib/tc_assignable.c',
|
||||||
'lib/tc_module.c',
|
'lib/tc_module.c',
|
||||||
|
'lib/tc_readable.c',
|
||||||
|
'lib/tc_common.c',
|
||||||
libtuxclocker_posix_sources],
|
libtuxclocker_posix_sources],
|
||||||
include_directories : incdir,
|
include_directories : incdir,
|
||||||
dependencies : libtuxclocker_posix_libs,
|
dependencies : libtuxclocker_posix_libs,
|
||||||
|
Loading…
Reference in New Issue
Block a user