Enlightenment CVS committal

Author  : cedric
Project : e17
Module  : libs/evas

Dir     : e17/libs/evas/src/lib/data


Modified Files:
        evas_array.c 


Log Message:
Add evas_array_remove.


===================================================================
RCS file: /cvs/e/e17/libs/evas/src/lib/data/evas_array.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- evas_array.c        26 May 2008 13:17:12 -0000      1.1
+++ evas_array.c        4 Jun 2008 16:39:43 -0000       1.2
@@ -73,3 +73,41 @@
    evas_array_flush(array);
    free(array);
 }
+
+EAPI void
+evas_array_remove(Evas_Array *array, Evas_Bool (*keep)(void *data, void 
*gdata), void *gdata)
+{
+   void **tmp;
+   unsigned int total = 0;
+   unsigned int i;
+
+   if (array->total == 0) return ;
+
+   tmp = malloc(sizeof (void*) * array->total);
+   if (!tmp) return ;
+
+   for (i = 0; i < array->count; ++i)
+     {
+       void *data;
+
+       data = _evas_array_get(array, i);
+
+       if (keep(data, gdata))
+         {
+            tmp[total] = data;
+            total++;
+         }
+     }
+
+   free(array->data);
+
+   if (total == 0)
+     {
+       array->data = NULL;
+       free(tmp);
+     }
+   else
+     array->data = tmp;
+
+   array->count = total;
+}



-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to