list2_t --
[apps/madmutt.git] / lib / list.c
index 23dcf26..0b852e0 100644 (file)
@@ -7,21 +7,15 @@
  * 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)
@@ -88,16 +82,16 @@ list2_t *list_cpy(list2_t *l) {
     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);
 }
 
@@ -118,9 +112,9 @@ list2_t* list_from_str (const char* str, const char* delim) {
   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);