00001 00010 #ifndef ARC_LISTFUNC_H 00011 #define ARC_LISTFUNC_H 00012 00013 #ifdef __cplusplus 00014 extern "C" { 00015 #endif 00016 00017 #include <stdlib.h> 00018 00019 typedef void (*freefn)(void *); 00020 00021 /* Merges NULL-terminated array of pointers addon into NULL-terminated array base. 00022 Returns pointer to new merged array. Old base array is destroyed. 00023 In case of error returns NULL and nothing is destroyed. 00024 size is the size of array elment and for safety should always 00025 be sizeof(char*) */ 00026 extern char **listjoin(char **base, char **addon, int size); 00027 00028 /* Merges element data to NULL-terminated array vect. 00029 Returns pointer to new merged array. Old vect array is destroyed. 00030 size is the size of array element and for safety should always 00031 be sizeof(char*) */ 00032 extern char **listadd(char **vect, char *data, int size); 00033 00034 /* Frees memory associated with array vect all data which its 00035 elements are pointing to. For freeing pointed data supplied 00036 function f is used. On exit vect array is destroyed. */ 00037 extern void listfree(char **vect, freefn f); 00038 00039 #ifdef __cplusplus 00040 } 00041 #endif 00042 00043 #endif