Add some type checking to Inlined List.
authorcedric <cedric>
Thu, 18 Sep 2008 14:22:48 +0000 (14:22 +0000)
committercedric <cedric@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Thu, 18 Sep 2008 14:22:48 +0000 (14:22 +0000)
git-svn-id: http://svn.enlightenment.org/svn/e/trunk/PROTO/eina@36084 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/include/eina_inlist.h
src/lib/eina_benchmark.c
src/lib/eina_counter.c
src/lib/eina_inlist.c
src/lib/eina_module.c
src/modules/mp/chained_pool/eina_chained_mempool.c
src/tests/eina_test_inlist.c

index a8baf5a..5000404 100644 (file)
@@ -28,9 +28,7 @@
  * @{
  */
 
-/* TODO change the prototype to use an Eina_Inlist */
 typedef struct _Eina_Inlist Eina_Inlist;
-
 struct _Eina_Inlist
 {
    Eina_Inlist *next;
@@ -38,18 +36,21 @@ struct _Eina_Inlist
    Eina_Inlist *last;
 };
 
-EAPI void * eina_inlist_append(void *in_list, void *in_item);
-EAPI void * eina_inlist_prepend(void *in_list, void *in_item);
-EAPI void * eina_inlist_append_relative(void *in_list, void *in_item, void *in_relative);
-EAPI void * eina_inlist_prepend_relative(void *in_list, void *in_item, void *in_relative);
-EAPI void * eina_inlist_remove(void *in_list, void *in_item);
-EAPI void * eina_inlist_find(void *in_list, void *in_item);
+#define EINA_INLIST Eina_Inlist __in_list
+#define EINA_INLIST_GET(Inlist) &(Inlist->__in_list)
+
+EAPI Eina_Inlist * eina_inlist_append(Eina_Inlist *in_list, Eina_Inlist *in_item);
+EAPI Eina_Inlist * eina_inlist_prepend(Eina_Inlist *in_list, Eina_Inlist *in_item);
+EAPI Eina_Inlist * eina_inlist_append_relative(Eina_Inlist *in_list, Eina_Inlist *in_item, Eina_Inlist *in_relative);
+EAPI Eina_Inlist * eina_inlist_prepend_relative(Eina_Inlist *in_list, Eina_Inlist *in_item, Eina_Inlist *in_relative);
+EAPI Eina_Inlist * eina_inlist_remove(Eina_Inlist *in_list, Eina_Inlist *in_item);
+EAPI Eina_Inlist * eina_inlist_find(Eina_Inlist *in_list, Eina_Inlist *in_item);
 
-EAPI Eina_Iterator *eina_inlist_iterator_new(const void *in_list);
-EAPI Eina_Accessor *eina_inlist_accessor_new(const void *in_list);
+EAPI Eina_Iterator *eina_inlist_iterator_new(const Eina_Inlist *in_list);
+EAPI Eina_Accessor *eina_inlist_accessor_new(const Eina_Inlist *in_list);
 
-#define EINA_INLIST_ITER_NEXT(list, l) for (l = (void*)(Eina_Inlist *)list; l; l = (void*)((Eina_Inlist *)l)->next)
-#define EINA_INLIST_ITER_LAST(list, l) for (l = (void*)((Eina_Inlist *)list)->last; l; l = (void*)((Eina_Inlist *)l)->prev)
+#define EINA_INLIST_ITER_NEXT(list, l) for (l = (void*)list; l; l = (void*)(l->__in_list.next))
+#define EINA_INLIST_ITER_LAST(list, l) for (l = (void*)(list->last); l; l = (void*)(l->__in_list.prev))
 
 /** @} */
 
index 79ec468..06bb7dd 100644 (file)
@@ -44,7 +44,7 @@
 typedef struct _Eina_Run Eina_Run;
 struct _Eina_Run
 {
-   Eina_Inlist __list;
+   EINA_INLIST;
 
    Eina_Benchmark_Specimens cb;
    const char *name;
@@ -176,7 +176,7 @@ eina_benchmark_register(Eina_Benchmark *bench, const char *name, Eina_Benchmark_
    run->end = count_end;
    run->step = count_step;
 
-   bench->runs = eina_inlist_append(bench->runs, run);
+   bench->runs = eina_inlist_append(bench->runs, EINA_INLIST_GET(run));
 }
 
 EAPI Eina_Array *
index 085f0e7..2a5d323 100644 (file)
@@ -61,7 +61,7 @@ typedef struct _Eina_Clock Eina_Clock;
 
 struct _Eina_Counter
 {
-   Eina_Inlist __list;
+   EINA_INLIST;
 
    Eina_Inlist *clocks;
    const char *name;
@@ -69,7 +69,7 @@ struct _Eina_Counter
 
 struct _Eina_Clock
 {
-   Eina_Inlist __list;
+   EINA_INLIST;
 
    Eina_Nano_Time start;
    Eina_Nano_Time end;
@@ -272,7 +272,7 @@ eina_counter_start(Eina_Counter *counter)
        return;
      }
 
-   counter->clocks = eina_inlist_prepend(counter->clocks, clk);
+   counter->clocks = eina_inlist_prepend(counter->clocks, EINA_INLIST_GET(clk));
 
    clk->valid = EINA_FALSE;
    clk->start = tp;
index ac895bd..eb0ec8e 100644 (file)
@@ -137,196 +137,189 @@ eina_inlist_accessor_free(Eina_Accessor_Inlist *it) {
  * To be documented
  * FIXME: To be fixed
  */
-EAPI void * eina_inlist_append(void *in_list, void *in_item) {
-       Eina_Inlist *l, *new_l;
-       Eina_Inlist *list;
-
-       list = in_list;
-       new_l = in_item;
-       new_l->next = NULL;
-       if (!list) {
-               new_l->prev = NULL;
-               new_l->last = new_l;
-               return new_l;
-       }
-       if (list->last)
-               l = list->last;
-       else
-               for (l = list; (l) && (l->next); l = l->next)
-                       ;
-       l->next = new_l;
-       new_l->prev = l;
-       list->last = new_l;
-       return list;
+EAPI Eina_Inlist *
+eina_inlist_append(Eina_Inlist *list, Eina_Inlist *new_l)
+{
+   Eina_Inlist *l;
+
+   new_l->next = NULL;
+   if (!list) {
+      new_l->prev = NULL;
+      new_l->last = new_l;
+      return new_l;
+   }
+   if (list->last)
+     l = list->last;
+   else
+     for (l = list; (l) && (l->next); l = l->next)
+       ;
+   l->next = new_l;
+   new_l->prev = l;
+   list->last = new_l;
+   return list;
 }
 /**
  * To be documented
  * FIXME: To be fixed
  */
-EAPI void * eina_inlist_prepend(void *in_list, void *in_item) {
-       Eina_Inlist *new_l;
-       Eina_Inlist *list;
-
-       list = in_list;
-       new_l = in_item;
-       new_l->prev = NULL;
-       if (!list) {
-               new_l->next = NULL;
-               new_l->last = new_l;
-               return new_l;
-       }
-       new_l->next = list;
-       list->prev = new_l;
-       new_l->last = list->last;
-       list->last = NULL;
-       return new_l;
+EAPI Eina_Inlist *
+eina_inlist_prepend(Eina_Inlist *list, Eina_Inlist *new_l)
+{
+   new_l->prev = NULL;
+   if (!list) {
+      new_l->next = NULL;
+      new_l->last = new_l;
+      return new_l;
+   }
+   new_l->next = list;
+   list->prev = new_l;
+   new_l->last = list->last;
+   list->last = NULL;
+   return new_l;
 }
 /**
  * To be documented
  * FIXME: To be fixed
  */
-EAPI void * eina_inlist_append_relative(void *in_list, void *in_item,
-               void *in_relative) {
-       Eina_Inlist *list, *relative, *new_l;
-
-       list = in_list;
-       new_l = in_item;
-       relative = in_relative;
-       if (relative) {
-               if (relative->next) {
-                       new_l->next = relative->next;
-                       relative->next->prev = new_l;
-               } else
-                       new_l->next = NULL;
-               relative->next = new_l;
-               new_l->prev = relative;
-               if (!new_l->next)
-                       list->last = new_l;
-               return list;
-       }
-       return eina_inlist_append(list, new_l);
+EAPI Eina_Inlist *
+eina_inlist_append_relative(Eina_Inlist *list,
+                           Eina_Inlist *new_l,
+                           Eina_Inlist *relative)
+{
+   if (relative) {
+      if (relative->next) {
+        new_l->next = relative->next;
+        relative->next->prev = new_l;
+      } else
+       new_l->next = NULL;
+      relative->next = new_l;
+      new_l->prev = relative;
+      if (!new_l->next)
+       list->last = new_l;
+      return list;
+   }
+   return eina_inlist_append(list, new_l);
 }
 /**
  * To be documented
  * FIXME: To be fixed
  */
-EAPI void * eina_inlist_prepend_relative(void *in_list, void *in_item,
-               void *in_relative) {
-       Eina_Inlist *list, *relative, *new_l;
-
-       list = in_list;
-       new_l = in_item;
-       relative = in_relative;
-       if (relative) {
-               new_l->prev = relative->prev;
-               new_l->next = relative;
-               relative->prev = new_l;
-               if (new_l->prev) {
-                       new_l->prev->next = new_l;
-                       /* new_l->next could not be NULL, as it was set to 'relative' */
-                       assert(new_l->next);
-                       return list;
-               } else {
-                       /* new_l->next could not be NULL, as it was set to 'relative' */
-                       assert(new_l->next);
-
-                       new_l->last = list->last;
-                       list->last = NULL;
-                       return new_l;
-               }
-       }
-       return eina_inlist_prepend(list, new_l);
+EAPI Eina_Inlist *
+eina_inlist_prepend_relative(Eina_Inlist *list,
+                            Eina_Inlist *new_l,
+                            Eina_Inlist *relative)
+{
+   if (relative) {
+      new_l->prev = relative->prev;
+      new_l->next = relative;
+      relative->prev = new_l;
+      if (new_l->prev) {
+        new_l->prev->next = new_l;
+        /* new_l->next could not be NULL, as it was set to 'relative' */
+        assert(new_l->next);
+        return list;
+      } else {
+        /* new_l->next could not be NULL, as it was set to 'relative' */
+        assert(new_l->next);
+
+        new_l->last = list->last;
+        list->last = NULL;
+        return new_l;
+      }
+   }
+   return eina_inlist_prepend(list, new_l);
 }
 /**
  * To be documented
  * FIXME: To be fixed
  */
-EAPI void * eina_inlist_remove(void *in_list, void *in_item) {
-       Eina_Inlist *return_l;
-       Eina_Inlist *list, *item;
-
-       /* checkme */
-       if (!in_list)
-               return in_list;
-
-       list = in_list;
-       item = in_item;
-       if (!item)
-               return list;
-       if (item->next)
-               item->next->prev = item->prev;
-       if (item->prev) {
-               item->prev->next = item->next;
-               return_l = list;
-       } else {
-               return_l = item->next;
-               if (return_l)
-                       return_l->last = list->last;
-       }
-       if (item == list->last)
-               list->last = item->prev;
-       item->next = NULL;
-       item->prev = NULL;
-       return return_l;
+EAPI Eina_Inlist *
+eina_inlist_remove(Eina_Inlist *list, Eina_Inlist *item)
+{
+   Eina_Inlist *return_l;
+
+   /* checkme */
+   if (!list) return list;
+   if (!item) return list;
+
+   if (item->next)
+     item->next->prev = item->prev;
+
+   if (item->prev) {
+      item->prev->next = item->next;
+      return_l = list;
+   } else {
+      return_l = item->next;
+      if (return_l)
+       return_l->last = list->last;
+   }
+   if (item == list->last)
+     list->last = item->prev;
+   item->next = NULL;
+   item->prev = NULL;
+   return return_l;
 }
 /**
  * To be documented
  * FIXME: To be fixed
  */
-EAPI void * eina_inlist_find(void *in_list, void *in_item) {
-       Eina_Inlist *l;
-       Eina_Inlist *list, *item;
-
-       list = in_list;
-       item = in_item;
-       for (l = list; l; l = l->next) {
-               if (l == item)
-                       return item;
-       }
-       return NULL;
+EAPI Eina_Inlist *
+eina_inlist_find(Eina_Inlist *list, Eina_Inlist *item)
+{
+   Eina_Inlist *l;
+
+   for (l = list; l; l = l->next) {
+      if (l == item)
+       return item;
+   }
+   return NULL;
 }
 
-EAPI Eina_Iterator *eina_inlist_iterator_new(const void *in_list) {
-       Eina_Iterator_Inlist *it;
+EAPI Eina_Iterator *
+eina_inlist_iterator_new(const Eina_Inlist *list)
+{
+   Eina_Iterator_Inlist *it;
 
-       if (!in_list) return NULL;
+   if (!list) return NULL;
 
-       eina_error_set(0);
-       it = calloc(1, sizeof (Eina_Iterator_Inlist));
-       if (!it) {
-               eina_error_set(EINA_ERROR_OUT_OF_MEMORY);
-               return NULL;
-       }
+   eina_error_set(0);
+   it = calloc(1, sizeof (Eina_Iterator_Inlist));
+   if (!it) {
+      eina_error_set(EINA_ERROR_OUT_OF_MEMORY);
+      return NULL;
+   }
 
-       it->head = in_list;
-       it->current = in_list;
+   it->head = list;
+   it->current = list;
 
-       it->iterator.next = FUNC_ITERATOR_NEXT(eina_inlist_iterator_next);
-       it->iterator.get_container = FUNC_ITERATOR_GET_CONTAINER(eina_inlist_iterator_get_container);
-       it->iterator.free = FUNC_ITERATOR_FREE(eina_inlist_iterator_free);
+   it->iterator.next = FUNC_ITERATOR_NEXT(eina_inlist_iterator_next);
+   it->iterator.get_container = FUNC_ITERATOR_GET_CONTAINER(eina_inlist_iterator_get_container);
+   it->iterator.free = FUNC_ITERATOR_FREE(eina_inlist_iterator_free);
 
-       return &it->iterator;
+   return &it->iterator;
 }
 
-EAPI Eina_Accessor *eina_inlist_accessor_new(const void *in_list) {
-       Eina_Accessor_Inlist *it;
+EAPI Eina_Accessor *
+eina_inlist_accessor_new(const Eina_Inlist *list)
+{
+   Eina_Accessor_Inlist *it;
 
-       if (!in_list) return NULL;
+   if (!list) return NULL;
 
-       eina_error_set(0);
-       it = calloc(1, sizeof (Eina_Accessor_Inlist));
-       if (!it) {
-               eina_error_set(EINA_ERROR_OUT_OF_MEMORY);
-               return NULL;
-       }
+   eina_error_set(0);
+   it = calloc(1, sizeof (Eina_Accessor_Inlist));
+   if (!it) {
+      eina_error_set(EINA_ERROR_OUT_OF_MEMORY);
+      return NULL;
+   }
 
-       it->head = in_list;
-       it->current = in_list;
-       it->index = 0;
+   it->head = list;
+   it->current = list;
+   it->index = 0;
 
-       it->accessor.get_at = FUNC_ACCESSOR_GET_AT(eina_inlist_accessor_get_at);
-       it->accessor.get_container = FUNC_ACCESSOR_GET_CONTAINER(eina_inlist_accessor_get_container);
-       it->accessor.free = FUNC_ACCESSOR_FREE(eina_inlist_accessor_free);
+   it->accessor.get_at = FUNC_ACCESSOR_GET_AT(eina_inlist_accessor_get_at);
+   it->accessor.get_container = FUNC_ACCESSOR_GET_CONTAINER(eina_inlist_accessor_get_container);
+   it->accessor.free = FUNC_ACCESSOR_FREE(eina_inlist_accessor_free);
 
-       return &it->accessor;
+   return &it->accessor;
 }
index 18a0772..33da3ed 100644 (file)
@@ -55,7 +55,7 @@ typedef struct _Eina_App Eina_App;
 
 struct _Eina_Module
 {
-   Eina_Inlist          __list;
+   EINA_INLIST;
 
    const char         * path;
    const char         * name;
@@ -73,7 +73,7 @@ struct _Eina_Module
 
 struct _Eina_Directory
 {
-   Eina_Inlist  __list;
+   EINA_INLIST;
 
    const char * path;
    const char * extention;
@@ -90,7 +90,7 @@ struct _Eina_App
 
 struct _Eina_Static
 {
-   Eina_Inlist        __list;
+   EINA_INLIST;
    Eina_Module_Export static_desc;
 };
 
@@ -106,7 +106,7 @@ struct _Eina_Module_Group
 
 struct _Eina_Root_Directory
 {
-   Eina_Inlist  __list;
+   EINA_INLIST;
 
    const char * path;
 };
@@ -134,7 +134,6 @@ _eina_module_build(Eina_Module_Group *modules, Eina_App *app,
    void *handle;
 
    handle = dlopen(path, RTLD_LAZY | RTLD_GLOBAL);
-   fprintf(stderr, "b [%s] %p\n", path, handle);
    if (!handle) return NULL;
 
    module = calloc(1, sizeof (Eina_Module) + length_path + strlen(name) + 1);
@@ -212,7 +211,7 @@ _eina_dir_module_cb(const char *name, const char *path, Eina_Dir_List *data)
      {
        if (data->cb(module, data->data) == EINA_TRUE)
          {
-            data->modules->loaded_module = eina_inlist_prepend(data->modules->loaded_module, module);
+            data->modules->loaded_module = eina_inlist_prepend(data->modules->loaded_module, EINA_INLIST_GET(module));
             data->list = eina_list_append(data->list, module);
 
             return ;
@@ -378,7 +377,7 @@ eina_module_root_add(const char *root_path)
    root->path = (char*)(root + 1);
    memcpy((char*) root->path, root_path, length);
 
-   root_directory = eina_inlist_prepend(root_directory, root);
+   root_directory = eina_inlist_prepend(root_directory, EINA_INLIST_GET(root));
 }
 
 EAPI Eina_Module_Group *
@@ -437,9 +436,9 @@ eina_module_path_register(Eina_Module_Group *modules, const char *path, Eina_Boo
    memcpy((char*) dir->path, path, length);
 
    if (recursive)
-     modules->recursive_directory = eina_inlist_prepend(modules->recursive_directory, dir);
+     modules->recursive_directory = eina_inlist_prepend(modules->recursive_directory, EINA_INLIST_GET(dir));
    else
-     modules->root_directory = eina_inlist_prepend(modules->root_directory, dir);
+     modules->root_directory = eina_inlist_prepend(modules->root_directory, EINA_INLIST_GET(dir));
 }
 
 EAPI void
@@ -505,7 +504,7 @@ eina_module_app_register(Eina_Module_Group *modules, const char *app, const char
      }
    strcat((char*) dir->extention, MODULE_EXTENSION);
 
-   modules->lookup_directory = eina_inlist_prepend(modules->lookup_directory, dir);
+   modules->lookup_directory = eina_inlist_prepend(modules->lookup_directory, EINA_INLIST_GET(dir));
 }
 
 EAPI void
@@ -520,7 +519,7 @@ eina_module_register(Eina_Module_Group *modules, const Eina_Module_Export *stati
 
    library->static_desc = *static_module;
 
-   modules->static_libraries = eina_inlist_prepend(modules->static_libraries, library);
+   modules->static_libraries = eina_inlist_prepend(modules->static_libraries, EINA_INLIST_GET(library));
 }
 
 EAPI Eina_Module *
@@ -560,7 +559,7 @@ eina_module_new(Eina_Module_Group *modules, const char *name)
          module->references = 1;
          module->is_static_library = EINA_TRUE;
 
-         modules->loaded_module = eina_inlist_prepend(modules->loaded_module, module);
+         modules->loaded_module = eina_inlist_prepend(modules->loaded_module, EINA_INLIST_GET(module));
 
          return module;
        }
@@ -578,7 +577,7 @@ eina_module_new(Eina_Module_Group *modules, const char *name)
                                      name);
          if (!module) continue ;
 
-         modules->loaded_module = eina_inlist_prepend(modules->loaded_module, module);
+         modules->loaded_module = eina_inlist_prepend(modules->loaded_module, EINA_INLIST_GET(module));
          return module;
        }
 
@@ -600,7 +599,7 @@ eina_module_new(Eina_Module_Group *modules, const char *name)
             continue ;
          }
 
-       modules->loaded_module = eina_inlist_prepend(modules->loaded_module, module);
+       modules->loaded_module = eina_inlist_prepend(modules->loaded_module, EINA_INLIST_GET(module));
        return module;
      }
 
@@ -626,7 +625,7 @@ eina_module_delete(Eina_Module *module)
 
    if (module->references != 0) return ;
 
-   module->group->loaded_module = eina_inlist_remove(module->group->loaded_module, module);
+   module->group->loaded_module = eina_inlist_remove(module->group->loaded_module, EINA_INLIST_GET(module));
 
    if (module->handle) dlclose(module->handle);
    free(module);
@@ -671,7 +670,7 @@ eina_module_list_new(Eina_Module_Group *modules, Eina_Module_Cb cb, void *data)
 
        if (cb(module, data) == EINA_TRUE)
          {
-            modules->loaded_module = eina_inlist_prepend(modules->loaded_module, module);
+            modules->loaded_module = eina_inlist_prepend(modules->loaded_module, EINA_INLIST_GET(module));
             list = eina_list_append(list, module);
          }
        else
@@ -706,7 +705,7 @@ eina_module_list_new(Eina_Module_Group *modules, Eina_Module_Cb cb, void *data)
 
               if (cb(module, data) == EINA_TRUE)
                 {
-                   modules->loaded_module = eina_inlist_prepend(modules->loaded_module, module);
+                   modules->loaded_module = eina_inlist_prepend(modules->loaded_module, EINA_INLIST_GET(module));
                    list = eina_list_append(list, module);
                 }
               else
index 67ebfa7..b610509 100644 (file)
@@ -29,6 +29,7 @@
 #include "eina_inlist.h"
 #include "eina_error.h"
 #include "eina_module.h"
+#include "eina_mempool.h"
 
 #include "eina_private.h"
 
@@ -45,7 +46,7 @@ struct _Chained_Mempool
 typedef struct _Chained_Pool Chained_Pool;
 struct _Chained_Pool
 {
-   Eina_Inlist _list_data;
+   EINA_INLIST;
    void *base;
    int usage;
 };
@@ -82,18 +83,15 @@ eina_chained_mempool_malloc(void *data, __UNUSED__ unsigned int size)
 {
    Chained_Mempool *pool = data;
    Chained_Pool *p = NULL;
-   Eina_Inlist *item;
    void *mem;
 
    // look 4 pool from 2nd bucket on
-   EINA_INLIST_ITER_NEXT(pool->first, item)
+   EINA_INLIST_ITER_NEXT(pool->first, p)
      {
-       p = (Chained_Pool*) item;
-
        // base is not NULL - has a free slot
        if (p->base)
          {
-            pool->first = eina_inlist_remove(pool->first, item);
+            pool->first = eina_inlist_remove(pool->first, EINA_INLIST_GET(p));
             break;
          }
      }
@@ -102,7 +100,7 @@ eina_chained_mempool_malloc(void *data, __UNUSED__ unsigned int size)
      {
        p = _eina_chained_mp_pool_new(pool);
        if (!p) return NULL;
-       pool->first = eina_inlist_prepend(pool->first, p);
+       pool->first = eina_inlist_prepend(pool->first, EINA_INLIST_GET(p));
      }
    // this points to the next free block - so take it
    mem = p->base;
@@ -111,8 +109,8 @@ eina_chained_mempool_malloc(void *data, __UNUSED__ unsigned int size)
    // move to end - it just filled up
    if (!p->base)
      {
-       pool->first = eina_inlist_remove(pool->first, p);
-       pool->first = eina_inlist_append(pool->first, p);
+       pool->first = eina_inlist_remove(pool->first, EINA_INLIST_GET(p));
+       pool->first = eina_inlist_append(pool->first, EINA_INLIST_GET(p));
      }
    p->usage++;
    pool->usage++;
@@ -124,17 +122,14 @@ eina_chained_mempool_free(void *data, void *ptr)
 {
    Chained_Mempool *pool = data;
    Chained_Pool *p;
-   Eina_Inlist *item;
    void *pmem;
    int item_alloc, psize;
 
    item_alloc = ((pool->item_size + sizeof(void *) - 1) / sizeof(void *)) * sizeof(void *);
    psize = item_alloc * pool->pool_size;
    // look 4 pool
-   EINA_INLIST_ITER_NEXT(pool->first, item)
+   EINA_INLIST_ITER_NEXT(pool->first, p)
      {
-       p = (Chained_Pool*) item;
-
        // pool mem base
        pmem = (void *)(((unsigned char *)p) + sizeof(Chained_Pool));
        // is it in pool mem?
@@ -146,13 +141,13 @@ eina_chained_mempool_free(void *data, void *ptr)
             p->base = ptr;
             p->usage--;
             pool->usage--;
-            pool->first = eina_inlist_remove(pool->first, p);
+            pool->first = eina_inlist_remove(pool->first, EINA_INLIST_GET(p));
             if (p->usage == 0)
               // free bucket
               _eina_chained_mp_pool_free(p);
             else
               // move to front
-              pool->first = eina_inlist_prepend(pool->first, p);
+              pool->first = eina_inlist_prepend(pool->first, EINA_INLIST_GET(p));
             break;
          }
      }
index cc0ccfe..672b328 100644 (file)
@@ -24,7 +24,7 @@
 typedef struct _Eina_Test_Inlist Eina_Test_Inlist;
 struct _Eina_Test_Inlist
 {
-   Eina_Inlist list;
+   EINA_INLIST;
    int i;
 };
 
@@ -42,41 +42,41 @@ _eina_test_inlist_build(int i)
 
 START_TEST(eina_inlist_simple)
 {
-   Eina_Test_Inlist *lst = NULL;
+   Eina_Inlist *lst = NULL;
    Eina_Test_Inlist *tmp;
    Eina_Test_Inlist *prev;
    int i = 0;
 
    tmp = _eina_test_inlist_build(42);
-   lst = eina_inlist_append(lst, tmp);
+   lst = eina_inlist_append(lst, EINA_INLIST_GET(tmp));
    fail_if(!lst);
 
-   lst = eina_inlist_remove(lst, tmp);
-   lst = eina_inlist_prepend(lst, tmp);
+   lst = eina_inlist_remove(lst, EINA_INLIST_GET(tmp));
+   lst = eina_inlist_prepend(lst, EINA_INLIST_GET(tmp));
 
    tmp = _eina_test_inlist_build(1664);
-   lst = eina_inlist_append_relative(lst, tmp, lst);
+   lst = eina_inlist_append_relative(lst, EINA_INLIST_GET(tmp), lst);
    fail_if(!lst);
-   fail_if(lst->i != 42);
+   fail_if(((Eina_Test_Inlist*)lst)->i != 42);
 
    prev = tmp;
    tmp = _eina_test_inlist_build(3227);
-   lst = eina_inlist_prepend_relative(lst, tmp, prev);
+   lst = eina_inlist_prepend_relative(lst, EINA_INLIST_GET(tmp), EINA_INLIST_GET(prev));
    fail_if(!lst);
-   fail_if(lst->i != 42);
+   fail_if(((Eina_Test_Inlist*)lst)->i != 42);
 
-   lst = eina_inlist_remove(lst, tmp);
+   lst = eina_inlist_remove(lst, EINA_INLIST_GET(tmp));
 
-   lst = eina_inlist_append_relative(lst, tmp, lst);
-   lst = eina_inlist_remove(lst, tmp);
+   lst = eina_inlist_append_relative(lst, EINA_INLIST_GET(tmp), lst);
+   lst = eina_inlist_remove(lst, EINA_INLIST_GET(tmp));
 
-   lst = eina_inlist_prepend_relative(lst, tmp, lst);
+   lst = eina_inlist_prepend_relative(lst, EINA_INLIST_GET(tmp), lst);
 
    tmp = _eina_test_inlist_build(27);
-   lst = eina_inlist_prepend_relative(lst, tmp, NULL);
+   lst = eina_inlist_prepend_relative(lst, EINA_INLIST_GET(tmp), NULL);
 
    tmp = _eina_test_inlist_build(81);
-   lst = eina_inlist_append_relative(lst, tmp, NULL);
+   lst = eina_inlist_append_relative(lst, EINA_INLIST_GET(tmp), NULL);
 
    EINA_INLIST_ITER_NEXT(lst, tmp)
      {
@@ -92,12 +92,12 @@ START_TEST(eina_inlist_simple)
        ++i;
      }
 
-   eina_inlist_remove(NULL, tmp);
+   eina_inlist_remove(NULL, EINA_INLIST_GET(tmp));
    lst = eina_inlist_remove(lst, NULL);
 
-   tmp = eina_inlist_find(lst, prev);
-   eina_inlist_remove(lst, tmp);
-   tmp = eina_inlist_find(lst, tmp);
+   tmp = (Eina_Test_Inlist*) eina_inlist_find(lst, EINA_INLIST_GET(prev));
+   eina_inlist_remove(lst, EINA_INLIST_GET(tmp));
+   tmp = (Eina_Test_Inlist*) eina_inlist_find(lst, EINA_INLIST_GET(tmp));
    fail_if(tmp != NULL);
 
    while (lst)