Enlightenment CVS committal
Author : turran
Project : e17
Module : proto/edata
Dir : e17/proto/edata/src/lib
Modified Files:
array.c lalloc.h
Log Message:
+ New array interface, now you can *add* more than one element at a time
===================================================================
RCS file: /cvs/e/e17/proto/edata/src/lib/array.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- array.c 10 Dec 2007 23:05:36 -0000 1.2
+++ array.c 16 Dec 2007 23:45:32 -0000 1.3
@@ -35,7 +35,7 @@
* To be documented
* FIXME: To be fixed
*/
-EAPI void edata_array_element_new(Edata_Array *a)
+EAPI void edata_array_element_add(Edata_Array *a)
{
if (a->num_elements == a->num_allocated)
{
@@ -44,6 +44,27 @@
a->alloc_cb(a->data, a->num_allocated);
}
a->num_elements++;
+}
+
+/**
+ * To be documented
+ * FIXME: To be fixed
+ */
+EAPI void edata_array_elements_add(Edata_Array *a, int num)
+{
+ int tmp;
+
+ tmp = a->num_elements + num;
+ if (tmp > a->num_allocated)
+ {
+ while (tmp > a->num_allocated)
+ {
+ a->num_allocated = (1 << a->acc);
+ a->acc++;
+ }
+ a->alloc_cb(a->data, a->num_allocated);
+ }
+ a->num_elements += num;
}
/**
===================================================================
RCS file: /cvs/e/e17/proto/edata/src/lib/lalloc.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- lalloc.h 10 Dec 2007 23:05:36 -0000 1.2
+++ lalloc.h 16 Dec 2007 23:45:32 -0000 1.3
@@ -13,7 +13,8 @@
typedef struct _Edata_Array Edata_Array;
EAPI void edata_array_free(Edata_Array *a);
EAPI Edata_Array *edata_array_new(void *data, Edata_Array_Alloc alloc_cb,
Edata_Array_Free free_cb, int num_init);
-EAPI void edata_array_element_new(Edata_Array *a);
+EAPI void edata_array_elements_add(Edata_Array *a, int num);
+EAPI void edata_array_element_add(Edata_Array *a);
/** @} */
-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs