* please see the file GPL in the top level source directory.
*/
-#include <stddef.h>
-#include <string.h>
-
-#include <lib-lib/mem.h>
-
+#include <lib-lib/lib-lib.h>
#include "list.h"
-#include "str.h"
-
list2_t* list_new (void) {
return p_new(list2_t, 1);
}
void list_del (list2_t** l, list_del_t* del) {
- size_t i = 0;
+ ssize_t i = 0;
if (!l || !*l)
return;
if (del)
return ret;
}
-list2_t* list_dup (list2_t* l, void* (*dup) (void*)) {
+list2_t* list_dup (list2_t* l, void* (*dup_f) (void*)) {
list2_t* ret = NULL;
int i = 0;
- if (list_empty(l) || !*dup)
+ if (list_empty(l) || !*dup_f)
return (NULL);
ret = list_new ();
ret->length = l->length;
ret->data = p_new(void*, l->length);
for (i = 0; i < l->length; i++)
- ret->data[i] = dup (l->data[i]);
+ ret->data[i] = dup_f (l->data[i]);
return (ret);
}
if (!str || !*str || !delim || !*delim)
return (NULL);
- tmp = str_dup (str);
+ tmp = m_strdup(str);
for (p = strtok (tmp, delim); p; p = strtok (NULL, delim)) {
- list_push_back (&ret, str_dup (p));
+ list_push_back (&ret, m_strdup(p));
}
p_delete(&tmp);
return (ret);