ARC SDK
listfunc.h
1 
10 #ifndef ARC_LISTFUNC_H
11 #define ARC_LISTFUNC_H
12 
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16 
17 #include <stdlib.h>
18 
19 typedef void (*freefn)(void *);
20 
21 /* Merges NULL-terminated array of pointers addon into NULL-terminated array base.
22  Returns pointer to new merged array. Old base array is destroyed.
23  In case of error returns NULL and nothing is destroyed.
24  size is the size of array elment and for safety should always
25  be sizeof(char*) */
26 extern char **listjoin(char **base, char **addon, int size);
27 
28 /* Merges element data to NULL-terminated array vect.
29  Returns pointer to new merged array. Old vect array is destroyed.
30  size is the size of array element and for safety should always
31  be sizeof(char*) */
32 extern char **listadd(char **vect, char *data, int size);
33 
34 /* Frees memory associated with array vect all data which its
35  elements are pointing to. For freeing pointed data supplied
36  function f is used. On exit vect array is destroyed. */
37 extern void listfree(char **vect, freefn f);
38 
39 #ifdef __cplusplus
40 }
41 #endif
42 
43 #endif