X-Git-Url: http://git.madism.org/?a=blobdiff_plain;f=lib%2Flist.h;h=a63b528c414c96ab2eb40f6531126c2d0919c73c;hb=2480626d883af3c291e94b90e1edc1ca40fca1c4;hp=9cb4bb3e0d463d211d0f004a3c938a13fc938f9d;hpb=9c02039bb94c2fb846e0226c321c7dd79df455c4;p=apps%2Fmadmutt.git diff --git a/lib/list.h b/lib/list.h index 9cb4bb3..a63b528 100644 --- a/lib/list.h +++ b/lib/list.h @@ -20,7 +20,7 @@ typedef struct list2_t { void** data; - size_t length; + ssize_t length; } list2_t; /* @@ -28,9 +28,12 @@ typedef struct list2_t { */ list2_t* list_new (void); -/* frees all memory used by list and optionally used edel func - * ptr to free items */ -void list_del (list2_t**, void (*edel) (void**)); + +typedef void list_del_t (void**); + +/* free() all memory used by list and optionally + * use del function to free() items as well */ +void list_del (list2_t**, list_del_t* del); #define list_empty(l) (!l || l->length == 0 || !l->data) @@ -64,6 +67,12 @@ list2_t* list_dup (list2_t*, void* (*dup) (void*)); * index in data array otherwise * the callback must return 0 on equality */ -int list_lookup (list2_t*, int (*cmp) (const void*, const void*), const void*); +typedef int list_lookup_t (const void*, const void*); +int list_lookup (list2_t*, list_lookup_t* cmp, const void*); + +/* + * dumb-splits string at boundary characters into list + */ +list2_t* list_from_str (const char* str, const char* delim); #endif /* !_LIB_LIST_H */