Enlightenment CVS committal
Author : raster
Project : e17
Module : libs/evas
Dir : e17/libs/evas/src/lib/data
Modified Files:
evas_list.c
Log Message:
add 2 list calls that well - i need for efficiency :)
===================================================================
RCS file: /cvs/e/e17/libs/evas/src/lib/data/evas_list.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -3 -r1.22 -r1.23
--- evas_list.c 16 Jun 2006 09:35:30 -0000 1.22
+++ evas_list.c 27 Jul 2006 19:27:34 -0000 1.23
@@ -199,40 +199,45 @@
{
Evas_List *l;
- _evas_list_alloc_error = 0;
for (l = list; l; l = l->next)
{
if (l->data == relative)
- {
- Evas_List *new_l;
-
- new_l = evas_mempool_malloc(&_evas_list_mempool,
sizeof(Evas_List));
- if (!new_l)
- {
- _evas_list_alloc_error = 1;
- return list;
- }
- new_l->data = (void *)data;
- if (l->next)
- {
- new_l->next = l->next;
- l->next->prev = new_l;
- }
- else
- new_l->next = NULL;
-
- l->next = new_l;
- new_l->prev = l;
- new_l->accounting = list->accounting;
- ((Evas_List_Accounting *)(list->accounting))->count++;
- if (!new_l->next)
- ((Evas_List_Accounting *)(new_l->accounting))->last = new_l;
- return list;
- }
+ return evas_list_append_relative_list(list, data, relative);
}
return evas_list_append(list, data);
}
+EAPI Evas_List *
+evas_list_append_relative_list(Evas_List *list, const void *data, Evas_List
*relative)
+{
+ Evas_List *new_l;
+
+ if ((!list) || (!relative)) return evas_list_append(list, data);
+ _evas_list_alloc_error = 0;
+ new_l = evas_mempool_malloc(&_evas_list_mempool, sizeof(Evas_List));
+ if (!new_l)
+ {
+ _evas_list_alloc_error = 1;
+ return list;
+ }
+ new_l->data = (void *)data;
+ 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;
+ new_l->accounting = list->accounting;
+ ((Evas_List_Accounting *)(list->accounting))->count++;
+ if (!new_l->next)
+ ((Evas_List_Accounting *)(new_l->accounting))->last = new_l;
+ return list;
+}
+
/**
* Prepend a data pointer to a linked list before the memeber specified
* @param list The list handle to prepend @p data too
@@ -286,29 +291,34 @@
for (l = list; l; l = l->next)
{
if (l->data == relative)
- {
- Evas_List *new_l;
-
- new_l = evas_mempool_malloc(&_evas_list_mempool,
sizeof(Evas_List));
- if (!new_l)
- {
- _evas_list_alloc_error = 1;
- return list;
- }
- new_l->data = (void *)data;
- new_l->prev = l->prev;
- new_l->next = l;
- if (l->prev) l->prev->next = new_l;
- l->prev = new_l;
- new_l->accounting = list->accounting;
- ((Evas_List_Accounting *)(list->accounting))->count++;
- if (new_l->prev)
- return list;
- else
- return new_l;
- }
+ return evas_list_prepend_relative_list(list, data, relative);
}
return evas_list_prepend(list, data);
+}
+
+EAPI Evas_List *
+evas_list_prepend_relative_list(Evas_List *list, const void *data, Evas_List
*relative)
+{
+ Evas_List *new_l;
+
+ if ((!list) || (!relative)) return evas_list_prepend(list, data);
+ _evas_list_alloc_error = 0;
+ new_l = evas_mempool_malloc(&_evas_list_mempool, sizeof(Evas_List));
+ if (!new_l)
+ {
+ _evas_list_alloc_error = 1;
+ return list;
+ }
+ new_l->data = (void *)data;
+ new_l->prev = relative->prev;
+ new_l->next = relative;
+ if (relative->prev) relative->prev->next = new_l;
+ relative->prev = new_l;
+ new_l->accounting = list->accounting;
+ ((Evas_List_Accounting *)(list->accounting))->count++;
+ if (new_l->prev)
+ return list;
+ return new_l;
}
/**
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs