summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2016-06-20 19:21:26 -0300
committerLarry Jr <larry.olj@gmail.com>2017-02-01 14:15:11 -0200
commit2b044b9bc20bcb78f89f459fbda72e298196bf9b (patch)
tree7b94ad56e77a962efa22b0ec39c26b8394b5cb24
parent84e32acab1288ae2176217fdb6ce1ad57ae94a4f (diff)
eina: Add eina_iterator_clone function for copying Eina_Iterator
Add the related function pointer in the iterator struct, and increment the EINA_ITERATOR_VERSION macro. Also add the respective cloning functions for each container.
-rw-r--r--src/lib/eina/eina_array.c12
-rw-r--r--src/lib/eina/eina_file.c20
-rw-r--r--src/lib/eina/eina_file_common.c9
-rw-r--r--src/lib/eina/eina_file_win32.c14
-rw-r--r--src/lib/eina/eina_inarray.c22
-rw-r--r--src/lib/eina/eina_inlist.c9
-rw-r--r--src/lib/eina/eina_iterator.c21
-rw-r--r--src/lib/eina/eina_iterator.h24
-rw-r--r--src/lib/eina/eina_list.c24
-rw-r--r--src/lib/eina/eina_matrixsparse.c33
-rw-r--r--src/lib/eina/eina_xattr.c12
11 files changed, 199 insertions, 1 deletions
diff --git a/src/lib/eina/eina_array.c b/src/lib/eina/eina_array.c
index 99891adcc5..9c37230312 100644
--- a/src/lib/eina/eina_array.c
+++ b/src/lib/eina/eina_array.c
@@ -142,6 +142,17 @@ eina_array_iterator_free(Eina_Iterator_Array *it)
142 MAGIC_FREE(it); 142 MAGIC_FREE(it);
143} 143}
144 144
145static Eina_Iterator*
146eina_array_iterator_clone(Eina_Iterator_Array *it)
147{
148 Eina_Iterator_Array* new;
149 EINA_MAGIC_CHECK_ARRAY_ITERATOR(it, NULL);
150
151 new = (void*)eina_array_iterator_new(it->array);
152 new->index = it->index;
153 return (void*)new;
154}
155
145static Eina_Bool 156static Eina_Bool
146eina_array_accessor_get_at(Eina_Accessor_Array *it, 157eina_array_accessor_get_at(Eina_Accessor_Array *it,
147 unsigned int idx, 158 unsigned int idx,
@@ -410,6 +421,7 @@ eina_array_iterator_new(const Eina_Array *array)
410 it->iterator.get_container = FUNC_ITERATOR_GET_CONTAINER( 421 it->iterator.get_container = FUNC_ITERATOR_GET_CONTAINER(
411 eina_array_iterator_get_container); 422 eina_array_iterator_get_container);
412 it->iterator.free = FUNC_ITERATOR_FREE(eina_array_iterator_free); 423 it->iterator.free = FUNC_ITERATOR_FREE(eina_array_iterator_free);
424 it->iterator.clone = FUNC_ITERATOR_CLONE(eina_array_iterator_clone);
413 425
414 return &it->iterator; 426 return &it->iterator;
415} 427}
diff --git a/src/lib/eina/eina_file.c b/src/lib/eina/eina_file.c
index cb29f287f5..36e5cf8139 100644
--- a/src/lib/eina/eina_file.c
+++ b/src/lib/eina/eina_file.c
@@ -170,6 +170,11 @@ _eina_file_ls_iterator_free(Eina_File_Iterator *it)
170 free(it); 170 free(it);
171} 171}
172 172
173_eina_file_ls_iterator_clone(Eina_File_Iterator *it)
174{
175 return eina_file_ls(it->dir);
176}
177
173typedef struct _Eina_File_Direct_Iterator Eina_File_Direct_Iterator; 178typedef struct _Eina_File_Direct_Iterator Eina_File_Direct_Iterator;
174struct _Eina_File_Direct_Iterator 179struct _Eina_File_Direct_Iterator
175{ 180{
@@ -266,6 +271,12 @@ _eina_file_direct_ls_iterator_free(Eina_File_Direct_Iterator *it)
266 free(it); 271 free(it);
267} 272}
268 273
274static Eina_Iterator*
275_eina_file_direct_ls_iterator_clone(Eina_File_Direct_Iterator *it)
276{
277 return eina_file_direct_ls(it->dir);
278}
279
269static Eina_Bool 280static Eina_Bool
270_eina_file_stat_ls_iterator_next(Eina_File_Direct_Iterator *it, void **data) 281_eina_file_stat_ls_iterator_next(Eina_File_Direct_Iterator *it, void **data)
271{ 282{
@@ -282,6 +293,12 @@ _eina_file_stat_ls_iterator_next(Eina_File_Direct_Iterator *it, void **data)
282 293
283 return EINA_TRUE; 294 return EINA_TRUE;
284} 295}
296
297static Eina_Iterator*
298_eina_file_stat_ls_iterator_clone(Eina_File_Direct_Iterator *it)
299{
300 return eina_file_stat_ls(it->dir);
301}
285#endif 302#endif
286 303
287void 304void
@@ -627,6 +644,7 @@ eina_file_ls(const char *dir)
627 it->iterator.get_container = FUNC_ITERATOR_GET_CONTAINER( 644 it->iterator.get_container = FUNC_ITERATOR_GET_CONTAINER(
628 _eina_file_ls_iterator_container); 645 _eina_file_ls_iterator_container);
629 it->iterator.free = FUNC_ITERATOR_FREE(_eina_file_ls_iterator_free); 646 it->iterator.free = FUNC_ITERATOR_FREE(_eina_file_ls_iterator_free);
647 it->iterator.clone = FUNC_ITERATOR_CLONE(_eina_file_ls_iterator_clone);
630 648
631 return &it->iterator; 649 return &it->iterator;
632#else 650#else
@@ -687,6 +705,7 @@ eina_file_direct_ls(const char *dir)
687 it->iterator.get_container = FUNC_ITERATOR_GET_CONTAINER( 705 it->iterator.get_container = FUNC_ITERATOR_GET_CONTAINER(
688 _eina_file_direct_ls_iterator_container); 706 _eina_file_direct_ls_iterator_container);
689 it->iterator.free = FUNC_ITERATOR_FREE(_eina_file_direct_ls_iterator_free); 707 it->iterator.free = FUNC_ITERATOR_FREE(_eina_file_direct_ls_iterator_free);
708 it->iterator.clone = FUNC_ITERATOR_CLONE(_eina_file_direct_ls_iterator_clone);
690 709
691 return &it->iterator; 710 return &it->iterator;
692#else 711#else
@@ -747,6 +766,7 @@ eina_file_stat_ls(const char *dir)
747 it->iterator.get_container = FUNC_ITERATOR_GET_CONTAINER( 766 it->iterator.get_container = FUNC_ITERATOR_GET_CONTAINER(
748 _eina_file_direct_ls_iterator_container); 767 _eina_file_direct_ls_iterator_container);
749 it->iterator.free = FUNC_ITERATOR_FREE(_eina_file_direct_ls_iterator_free); 768 it->iterator.free = FUNC_ITERATOR_FREE(_eina_file_direct_ls_iterator_free);
769 it->iterator.clone = FUNC_ITERATOR_CLONE(_eina_file_stat_ls_iterator_clone);
750 770
751 return &it->iterator; 771 return &it->iterator;
752#else 772#else
diff --git a/src/lib/eina/eina_file_common.c b/src/lib/eina/eina_file_common.c
index 2c5eeb1bf0..d4de9d5097 100644
--- a/src/lib/eina/eina_file_common.c
+++ b/src/lib/eina/eina_file_common.c
@@ -637,6 +637,14 @@ _eina_file_map_lines_iterator_free(Eina_Lines_Iterator *it)
637 free(it); 637 free(it);
638} 638}
639 639
640static Eina_Iterator*
641_eina_file_map_lines_iterator_clone(Eina_Lines_Iterator *it)
642{
643 Eina_Lines_Iterator* new = (void*)eina_file_map_lines(it->fp);
644 new->current = it->current;
645 return (void*)new;
646}
647
640EAPI Eina_Iterator * 648EAPI Eina_Iterator *
641eina_file_map_lines(Eina_File *file) 649eina_file_map_lines(Eina_File *file)
642{ 650{
@@ -674,6 +682,7 @@ eina_file_map_lines(Eina_File *file)
674 it->iterator.next = FUNC_ITERATOR_NEXT(_eina_file_map_lines_iterator_next); 682 it->iterator.next = FUNC_ITERATOR_NEXT(_eina_file_map_lines_iterator_next);
675 it->iterator.get_container = FUNC_ITERATOR_GET_CONTAINER(_eina_file_map_lines_iterator_container); 683 it->iterator.get_container = FUNC_ITERATOR_GET_CONTAINER(_eina_file_map_lines_iterator_container);
676 it->iterator.free = FUNC_ITERATOR_FREE(_eina_file_map_lines_iterator_free); 684 it->iterator.free = FUNC_ITERATOR_FREE(_eina_file_map_lines_iterator_free);
685 it->iterator.clone = FUNC_ITERATOR_CLONE(_eina_file_map_lines_iterator_clone);
677 686
678 return &it->iterator; 687 return &it->iterator;
679} 688}
diff --git a/src/lib/eina/eina_file_win32.c b/src/lib/eina/eina_file_win32.c
index 54b5d900db..030cb388f0 100644
--- a/src/lib/eina/eina_file_win32.c
+++ b/src/lib/eina/eina_file_win32.c
@@ -255,6 +255,12 @@ _eina_file_win32_ls_iterator_free(Eina_File_Iterator *it)
255 free(it); 255 free(it);
256} 256}
257 257
258static Eina_Iterator*
259_eina_file_win32_ls_iterator_clone(Eina_File_Iterator *it)
260{
261 return eina_file_ls(it->dir);
262}
263
258static Eina_Bool 264static Eina_Bool
259_eina_file_win32_direct_ls_iterator_next(Eina_File_Direct_Iterator *it, void **data) 265_eina_file_win32_direct_ls_iterator_next(Eina_File_Direct_Iterator *it, void **data)
260{ 266{
@@ -372,6 +378,12 @@ _eina_file_win32_direct_ls_iterator_free(Eina_File_Direct_Iterator *it)
372 free(it); 378 free(it);
373} 379}
374 380
381static Eina_Promise*
382_eina_file_win32_direct_ls_iterator_clone(Eina_File_Direct_Iterator *it)
383{
384 return eina_file_direct_ls(it->dir);
385}
386
375void 387void
376eina_file_real_close(Eina_File *file) 388eina_file_real_close(Eina_File *file)
377{ 389{
@@ -601,6 +613,7 @@ eina_file_ls(const char *dir)
601 it->iterator.next = FUNC_ITERATOR_NEXT(_eina_file_win32_ls_iterator_next); 613 it->iterator.next = FUNC_ITERATOR_NEXT(_eina_file_win32_ls_iterator_next);
602 it->iterator.get_container = FUNC_ITERATOR_GET_CONTAINER(_eina_file_win32_ls_iterator_container); 614 it->iterator.get_container = FUNC_ITERATOR_GET_CONTAINER(_eina_file_win32_ls_iterator_container);
603 it->iterator.free = FUNC_ITERATOR_FREE(_eina_file_win32_ls_iterator_free); 615 it->iterator.free = FUNC_ITERATOR_FREE(_eina_file_win32_ls_iterator_free);
616 it->iterator.clone = FUNC_ITERATOR_CLONE(_eina_file_win32_ls_iterator_clone);
604 617
605 return &it->iterator; 618 return &it->iterator;
606 619
@@ -658,6 +671,7 @@ eina_file_direct_ls(const char *dir)
658 it->iterator.next = FUNC_ITERATOR_NEXT(_eina_file_win32_direct_ls_iterator_next); 671 it->iterator.next = FUNC_ITERATOR_NEXT(_eina_file_win32_direct_ls_iterator_next);
659 it->iterator.get_container = FUNC_ITERATOR_GET_CONTAINER(_eina_file_win32_direct_ls_iterator_container); 672 it->iterator.get_container = FUNC_ITERATOR_GET_CONTAINER(_eina_file_win32_direct_ls_iterator_container);
660 it->iterator.free = FUNC_ITERATOR_FREE(_eina_file_win32_direct_ls_iterator_free); 673 it->iterator.free = FUNC_ITERATOR_FREE(_eina_file_win32_direct_ls_iterator_free);
674 it->iterator.clone = FUNC_ITERATOR_FREE(_eina_file_win32_direct_ls_iterator_clone);
661 675
662 return &it->iterator; 676 return &it->iterator;
663 677
diff --git a/src/lib/eina/eina_inarray.c b/src/lib/eina/eina_inarray.c
index a216f0291b..20c79d29db 100644
--- a/src/lib/eina/eina_inarray.c
+++ b/src/lib/eina/eina_inarray.c
@@ -249,6 +249,26 @@ _eina_inarray_iterator_free(Eina_Iterator_Inarray *it)
249 MAGIC_FREE(it); 249 MAGIC_FREE(it);
250} 250}
251 251
252static Eina_Iterator*
253_eina_inarray_iterator_clone(Eina_Iterator_Inarray *it)
254{
255 Eina_Iterator_Inarray* new;
256 EINA_MAGIC_CHECK_INARRAY_ITERATOR(it, NULL);
257 new = (void*)eina_inarray_iterator_new(it->array);
258 new->pos = it->pos;
259 return (void*)new;
260}
261
262static Eina_Iterator*
263_eina_inarray_iterator_reversed_clone(Eina_Iterator_Inarray *it)
264{
265 Eina_Iterator_Inarray* new;
266 EINA_MAGIC_CHECK_INARRAY_ITERATOR(it, NULL);
267 new = (void*)eina_inarray_iterator_reversed_new(it->array);
268 new->pos = it->pos;
269 return (void*)new;
270}
271
252static Eina_Bool 272static Eina_Bool
253_eina_inarray_accessor_get_at(Eina_Accessor_Inarray *it, unsigned int pos, void **data) 273_eina_inarray_accessor_get_at(Eina_Accessor_Inarray *it, unsigned int pos, void **data)
254{ 274{
@@ -754,6 +774,7 @@ eina_inarray_iterator_new(const Eina_Inarray *array)
754 it->iterator.get_container = FUNC_ITERATOR_GET_CONTAINER 774 it->iterator.get_container = FUNC_ITERATOR_GET_CONTAINER
755 (_eina_inarray_iterator_get_container); 775 (_eina_inarray_iterator_get_container);
756 it->iterator.free = FUNC_ITERATOR_FREE(_eina_inarray_iterator_free); 776 it->iterator.free = FUNC_ITERATOR_FREE(_eina_inarray_iterator_free);
777 it->iterator.clone = FUNC_ITERATOR_CLONE(_eina_inarray_iterator_clone);
757 778
758 return &it->iterator; 779 return &it->iterator;
759} 780}
@@ -779,6 +800,7 @@ eina_inarray_iterator_reversed_new(const Eina_Inarray *array)
779 it->iterator.get_container = FUNC_ITERATOR_GET_CONTAINER 800 it->iterator.get_container = FUNC_ITERATOR_GET_CONTAINER
780 (_eina_inarray_iterator_get_container); 801 (_eina_inarray_iterator_get_container);
781 it->iterator.free = FUNC_ITERATOR_FREE(_eina_inarray_iterator_free); 802 it->iterator.free = FUNC_ITERATOR_FREE(_eina_inarray_iterator_free);
803 it->iterator.clone = FUNC_ITERATOR_CLONE(_eina_inarray_iterator_reversed_clone);
782 804
783 return &it->iterator; 805 return &it->iterator;
784} 806}
diff --git a/src/lib/eina/eina_inlist.c b/src/lib/eina/eina_inlist.c
index 7496c515d0..90454b9939 100644
--- a/src/lib/eina/eina_inlist.c
+++ b/src/lib/eina/eina_inlist.c
@@ -101,6 +101,14 @@ eina_inlist_iterator_free(Eina_Iterator_Inlist *it)
101 free(it); 101 free(it);
102} 102}
103 103
104static Eina_Iterator*
105eina_inlist_iterator_clone(Eina_Iterator_Inlist *it)
106{
107 Eina_Iterator_Inlist* new = (void*)eina_inlist_iterator_new(it->head);
108 new->current = it->current;
109 return (void*)new;
110}
111
104static Eina_Bool 112static Eina_Bool
105eina_inlist_accessor_get_at(Eina_Accessor_Inlist *it, 113eina_inlist_accessor_get_at(Eina_Accessor_Inlist *it,
106 unsigned int idx, 114 unsigned int idx,
@@ -864,6 +872,7 @@ eina_inlist_iterator_new(const Eina_Inlist *list)
864 it->iterator.get_container = FUNC_ITERATOR_GET_CONTAINER( 872 it->iterator.get_container = FUNC_ITERATOR_GET_CONTAINER(
865 eina_inlist_iterator_get_container); 873 eina_inlist_iterator_get_container);
866 it->iterator.free = FUNC_ITERATOR_FREE(eina_inlist_iterator_free); 874 it->iterator.free = FUNC_ITERATOR_FREE(eina_inlist_iterator_free);
875 it->iterator.clone = FUNC_ITERATOR_CLONE(eina_inlist_iterator_clone);
867 876
868 EINA_MAGIC_SET(&it->iterator, EINA_MAGIC_ITERATOR); 877 EINA_MAGIC_SET(&it->iterator, EINA_MAGIC_ITERATOR);
869 878
diff --git a/src/lib/eina/eina_iterator.c b/src/lib/eina/eina_iterator.c
index 4a4e281079..94f46b735c 100644
--- a/src/lib/eina/eina_iterator.c
+++ b/src/lib/eina/eina_iterator.c
@@ -164,6 +164,18 @@ eina_iterator_lock(Eina_Iterator *iterator)
164 return EINA_TRUE; 164 return EINA_TRUE;
165} 165}
166 166
167EAPI Eina_Iterator*
168eina_iterator_clone(Eina_Iterator *iterator)
169{
170 EINA_MAGIC_CHECK_ITERATOR(iterator);
171 EINA_SAFETY_ON_NULL_RETURN_VAL(iterator, NULL);
172
173 if (iterator->version >= 2 && iterator->clone)
174 return iterator->clone(iterator);
175 else
176 return NULL;
177}
178
167EAPI Eina_Bool 179EAPI Eina_Bool
168eina_iterator_unlock(Eina_Iterator *iterator) 180eina_iterator_unlock(Eina_Iterator *iterator)
169{ 181{
@@ -208,6 +220,14 @@ eina_carray_iterator_free(Eina_Iterator_CArray *it)
208 free(it); 220 free(it);
209} 221}
210 222
223static Eina_Iterator*
224eina_carray_iterator_clone(Eina_Iterator_CArray *it)
225{
226 Eina_Iterator_CArray* new = eina_carray_iterator_new((void**)it->array);
227 new->current = it->current;
228 return new;
229}
230
211EAPI Eina_Iterator* 231EAPI Eina_Iterator*
212eina_carray_iterator_new(void** array) 232eina_carray_iterator_new(void** array)
213{ 233{
@@ -225,6 +245,7 @@ eina_carray_iterator_new(void** array)
225 it->iterator.get_container = FUNC_ITERATOR_GET_CONTAINER( 245 it->iterator.get_container = FUNC_ITERATOR_GET_CONTAINER(
226 eina_carray_iterator_get_container); 246 eina_carray_iterator_get_container);
227 it->iterator.free = FUNC_ITERATOR_FREE(eina_carray_iterator_free); 247 it->iterator.free = FUNC_ITERATOR_FREE(eina_carray_iterator_free);
248 it->iterator.clone = FUNC_ITERATOR_CLONE(eina_carray_iterator_clone);
228 249
229 return &it->iterator; 250 return &it->iterator;
230} 251}
diff --git a/src/lib/eina/eina_iterator.h b/src/lib/eina/eina_iterator.h
index fadf1df710..7b9592df5b 100644
--- a/src/lib/eina/eina_iterator.h
+++ b/src/lib/eina/eina_iterator.h
@@ -150,6 +150,12 @@ typedef void (*Eina_Iterator_Free_Callback)(Eina_Iterator *it);
150typedef Eina_Bool (*Eina_Iterator_Lock_Callback)(Eina_Iterator *it); 150typedef Eina_Bool (*Eina_Iterator_Lock_Callback)(Eina_Iterator *it);
151 151
152/** 152/**
153 * @typedef Eina_Iterator_Clone_Callback
154 * Type for a callback that will clone the iterator.
155 */
156typedef Eina_Iterator* (*Eina_Iterator_Clone_Callback)(Eina_Iterator *it);
157
158/**
153 * @struct _Eina_Iterator 159 * @struct _Eina_Iterator
154 * structure of an iterator 160 * structure of an iterator
155 * 161 *
@@ -157,7 +163,7 @@ typedef Eina_Bool (*Eina_Iterator_Lock_Callback)(Eina_Iterator *it);
157 */ 163 */
158struct _Eina_Iterator 164struct _Eina_Iterator
159{ 165{
160#define EINA_ITERATOR_VERSION 1 166#define EINA_ITERATOR_VERSION 2
161 int version; /**< Version of the Iterator API. */ 167 int version; /**< Version of the Iterator API. */
162 168
163 Eina_Iterator_Next_Callback next EINA_ARG_NONNULL(1, 2) EINA_WARN_UNUSED_RESULT; /**< Callback called when a next element is requested. */ 169 Eina_Iterator_Next_Callback next EINA_ARG_NONNULL(1, 2) EINA_WARN_UNUSED_RESULT; /**< Callback called when a next element is requested. */
@@ -166,6 +172,7 @@ struct _Eina_Iterator
166 172
167 Eina_Iterator_Lock_Callback lock EINA_WARN_UNUSED_RESULT; /**< Callback called when the container is locked. */ 173 Eina_Iterator_Lock_Callback lock EINA_WARN_UNUSED_RESULT; /**< Callback called when the container is locked. */
168 Eina_Iterator_Lock_Callback unlock EINA_WARN_UNUSED_RESULT; /**< Callback called when the container is unlocked. */ 174 Eina_Iterator_Lock_Callback unlock EINA_WARN_UNUSED_RESULT; /**< Callback called when the container is unlocked. */
175 Eina_Iterator_Clone_Callback clone EINA_WARN_UNUSED_RESULT; /**< Callback called when the container is unlocked. */
169 176
170#define EINA_MAGIC_ITERATOR 0x98761233 177#define EINA_MAGIC_ITERATOR 0x98761233
171 EINA_MAGIC 178 EINA_MAGIC
@@ -195,6 +202,12 @@ struct _Eina_Iterator
195 */ 202 */
196#define FUNC_ITERATOR_LOCK(Function) ((Eina_Iterator_Lock_Callback)Function) 203#define FUNC_ITERATOR_LOCK(Function) ((Eina_Iterator_Lock_Callback)Function)
197 204
205/**
206 * @def FUNC_ITERATOR_CLONE(Function)
207 * Helper macro to cast @p Function to a Eina_Iterator_Clone_Callback.
208 */
209#define FUNC_ITERATOR_CLONE(Function) ((Eina_Iterator_Clone_Callback)Function)
210
198 211
199/** 212/**
200 * @brief Free an iterator. 213 * @brief Free an iterator.
@@ -269,6 +282,15 @@ EAPI void eina_iterator_foreach(Eina_Iterator *iterator,
269EAPI Eina_Bool eina_iterator_lock(Eina_Iterator *iterator) EINA_ARG_NONNULL(1); 282EAPI Eina_Bool eina_iterator_lock(Eina_Iterator *iterator) EINA_ARG_NONNULL(1);
270 283
271/** 284/**
285 * @brief Clones the iterator
286 *
287 * @param iterator The iterator.
288 * @return Another iterator
289 *
290 */
291EAPI Eina_Iterator* eina_iterator_clone(Eina_Iterator *iterator) EINA_ARG_NONNULL(1);
292
293/**
272 * @brief Unlock the container of the iterator. 294 * @brief Unlock the container of the iterator.
273 * 295 *
274 * @param iterator The iterator. 296 * @param iterator The iterator.
diff --git a/src/lib/eina/eina_list.c b/src/lib/eina/eina_list.c
index 26cf3c8d50..19e2cd64ce 100644
--- a/src/lib/eina/eina_list.c
+++ b/src/lib/eina/eina_list.c
@@ -324,6 +324,28 @@ eina_list_iterator_free(Eina_Iterator_List *it)
324 MAGIC_FREE(it); 324 MAGIC_FREE(it);
325} 325}
326 326
327static Eina_Iterator*
328eina_list_iterator_clone(Eina_Iterator_List *it)
329{
330 Eina_Iterator_List* new;
331 EINA_MAGIC_CHECK_LIST_ITERATOR(it, NULL);
332
333 new = (void*)eina_list_iterator_new(it->head);
334 new->current = it->current;
335 return (void*)new;
336}
337
338static Eina_Iterator*
339eina_list_iterator_reversed_clone(Eina_Iterator_List *it)
340{
341 Eina_Iterator_List* new;
342 EINA_MAGIC_CHECK_LIST_ITERATOR(it, NULL);
343
344 new = (void*)eina_list_iterator_reversed_new(it->head);
345 new->current = it->current;
346 return (void*)new;
347}
348
327static Eina_Bool 349static Eina_Bool
328eina_list_accessor_get_at(Eina_Accessor_List *it, unsigned int idx, void **data) 350eina_list_accessor_get_at(Eina_Accessor_List *it, unsigned int idx, void **data)
329{ 351{
@@ -1534,6 +1556,7 @@ eina_list_iterator_new(const Eina_List *list)
1534 it->iterator.get_container = FUNC_ITERATOR_GET_CONTAINER( 1556 it->iterator.get_container = FUNC_ITERATOR_GET_CONTAINER(
1535 eina_list_iterator_get_container); 1557 eina_list_iterator_get_container);
1536 it->iterator.free = FUNC_ITERATOR_FREE(eina_list_iterator_free); 1558 it->iterator.free = FUNC_ITERATOR_FREE(eina_list_iterator_free);
1559 it->iterator.clone = FUNC_ITERATOR_CLONE(eina_list_iterator_clone);
1537 1560
1538 return &it->iterator; 1561 return &it->iterator;
1539} 1562}
@@ -1557,6 +1580,7 @@ eina_list_iterator_reversed_new(const Eina_List *list)
1557 it->iterator.get_container = FUNC_ITERATOR_GET_CONTAINER( 1580 it->iterator.get_container = FUNC_ITERATOR_GET_CONTAINER(
1558 eina_list_iterator_get_container); 1581 eina_list_iterator_get_container);
1559 it->iterator.free = FUNC_ITERATOR_FREE(eina_list_iterator_free); 1582 it->iterator.free = FUNC_ITERATOR_FREE(eina_list_iterator_free);
1583 it->iterator.clone = FUNC_ITERATOR_CLONE(eina_list_iterator_reversed_clone);
1560 1584
1561 return &it->iterator; 1585 return &it->iterator;
1562} 1586}
diff --git a/src/lib/eina/eina_matrixsparse.c b/src/lib/eina/eina_matrixsparse.c
index 47a10ae838..2feb346ef7 100644
--- a/src/lib/eina/eina_matrixsparse.c
+++ b/src/lib/eina/eina_matrixsparse.c
@@ -752,6 +752,17 @@ _eina_matrixsparse_iterator_free(Eina_Matrixsparse_Iterator *it)
752 free(it); 752 free(it);
753} 753}
754 754
755static Eina_Iterator*
756_eina_matrixsparse_iterator_clone(Eina_Matrixsparse_Iterator *it)
757{
758 Eina_Matrixsparse_Iterator* new;
759 EINA_MAGIC_CHECK_MATRIXSPARSE_ITERATOR(it, NULL);
760 new = (void*)eina_matrixsparse_iterator_new(it->m);
761 new->ref.row = it->ref.row;
762 new->ref.col = it->ref.col;
763 return (void*)new;
764}
765
755static Eina_Bool 766static Eina_Bool
756_eina_matrixsparse_iterator_complete_next( 767_eina_matrixsparse_iterator_complete_next(
757 Eina_Matrixsparse_Iterator_Complete *it, 768 Eina_Matrixsparse_Iterator_Complete *it,
@@ -818,6 +829,25 @@ _eina_matrixsparse_iterator_complete_free(
818 free(it); 829 free(it);
819} 830}
820 831
832static Eina_Iterator*
833_eina_matrixsparse_iterator_complete_clone(
834 Eina_Matrixsparse_Iterator_Complete *it)
835{
836 Eina_Matrixsparse_Iterator_Complete* new;
837 EINA_MAGIC_CHECK_MATRIXSPARSE_ITERATOR(it, NULL);
838
839 new = (void*)eina_matrixsparse_iterator_complete_new(it->m);
840 new->ref.row = it->ref.row;
841 new->ref.col = it->ref.col;
842
843 new->idx.row = it->idx.row;
844 new->idx.col = it->idx.col;
845
846 new->dummy.row = it->dummy.row;
847 new->dummy.col = it->dummy.col;
848 return (void*)new;
849}
850
821 851
822/** 852/**
823 * @endcond 853 * @endcond
@@ -1372,6 +1402,7 @@ eina_matrixsparse_iterator_new(const Eina_Matrixsparse *m)
1372 it->iterator.get_container = FUNC_ITERATOR_GET_CONTAINER( 1402 it->iterator.get_container = FUNC_ITERATOR_GET_CONTAINER(
1373 _eina_matrixsparse_iterator_get_container); 1403 _eina_matrixsparse_iterator_get_container);
1374 it->iterator.free = FUNC_ITERATOR_FREE(_eina_matrixsparse_iterator_free); 1404 it->iterator.free = FUNC_ITERATOR_FREE(_eina_matrixsparse_iterator_free);
1405 it->iterator.clone = FUNC_ITERATOR_CLONE(_eina_matrixsparse_iterator_clone);
1375 return &it->iterator; 1406 return &it->iterator;
1376} 1407}
1377 1408
@@ -1409,5 +1440,7 @@ eina_matrixsparse_iterator_complete_new(const Eina_Matrixsparse *m)
1409 _eina_matrixsparse_iterator_complete_get_container); 1440 _eina_matrixsparse_iterator_complete_get_container);
1410 it->iterator.free = FUNC_ITERATOR_FREE( 1441 it->iterator.free = FUNC_ITERATOR_FREE(
1411 _eina_matrixsparse_iterator_complete_free); 1442 _eina_matrixsparse_iterator_complete_free);
1443 it->iterator.clone = FUNC_ITERATOR_CLONE(
1444 _eina_matrixsparse_iterator_complete_clone);
1412 return &it->iterator; 1445 return &it->iterator;
1413} 1446}
diff --git a/src/lib/eina/eina_xattr.c b/src/lib/eina/eina_xattr.c
index d5e6970840..09191ab4f9 100644
--- a/src/lib/eina/eina_xattr.c
+++ b/src/lib/eina/eina_xattr.c
@@ -164,6 +164,15 @@ _eina_xattr_ls_iterator_free(Eina_Xattr_Iterator *it)
164 free(it->attr); 164 free(it->attr);
165 free(it); 165 free(it);
166} 166}
167
168static Eina_Iterator*
169_eina_xattr_ls_iterator_clone(Eina_Xattr_Iterator *it)
170{
171 Eina_Xattr_Iterator* new;
172 new = (void*)eina_xattr_value_fd_ls(it->fd);
173 new->offset = it->offset;
174 return (void*)new;
175}
167#endif 176#endif
168 177
169/** 178/**
@@ -216,6 +225,7 @@ eina_xattr_value_fd_ls(int fd)
216 it->iterator.next = FUNC_ITERATOR_NEXT(_eina_xattr_value_ls_fd_iterator_next); 225 it->iterator.next = FUNC_ITERATOR_NEXT(_eina_xattr_value_ls_fd_iterator_next);
217 it->iterator.get_container = FUNC_ITERATOR_GET_CONTAINER(_eina_xattr_ls_iterator_container); 226 it->iterator.get_container = FUNC_ITERATOR_GET_CONTAINER(_eina_xattr_ls_iterator_container);
218 it->iterator.free = FUNC_ITERATOR_FREE(_eina_xattr_ls_iterator_free); 227 it->iterator.free = FUNC_ITERATOR_FREE(_eina_xattr_ls_iterator_free);
228 it->iterator.clone = FUNC_ITERATOR_CLONE(_eina_xattr_ls_iterator_clone);
219 229
220 return &it->iterator; 230 return &it->iterator;
221#else 231#else
@@ -252,6 +262,7 @@ eina_xattr_fd_ls(int fd)
252 it->iterator.next = FUNC_ITERATOR_NEXT(_eina_xattr_ls_iterator_next); 262 it->iterator.next = FUNC_ITERATOR_NEXT(_eina_xattr_ls_iterator_next);
253 it->iterator.get_container = FUNC_ITERATOR_GET_CONTAINER(_eina_xattr_ls_iterator_container); 263 it->iterator.get_container = FUNC_ITERATOR_GET_CONTAINER(_eina_xattr_ls_iterator_container);
254 it->iterator.free = FUNC_ITERATOR_FREE(_eina_xattr_ls_iterator_free); 264 it->iterator.free = FUNC_ITERATOR_FREE(_eina_xattr_ls_iterator_free);
265 it->iterator.clone = FUNC_ITERATOR_CLONE(_eina_xattr_ls_iterator_clone);
255 266
256 return &it->iterator; 267 return &it->iterator;
257#else 268#else
@@ -288,6 +299,7 @@ eina_xattr_ls(const char *file)
288 it->iterator.next = FUNC_ITERATOR_NEXT(_eina_xattr_ls_iterator_next); 299 it->iterator.next = FUNC_ITERATOR_NEXT(_eina_xattr_ls_iterator_next);
289 it->iterator.get_container = FUNC_ITERATOR_GET_CONTAINER(_eina_xattr_ls_iterator_container); 300 it->iterator.get_container = FUNC_ITERATOR_GET_CONTAINER(_eina_xattr_ls_iterator_container);
290 it->iterator.free = FUNC_ITERATOR_FREE(_eina_xattr_ls_iterator_free); 301 it->iterator.free = FUNC_ITERATOR_FREE(_eina_xattr_ls_iterator_free);
302 it->iterator.clone = FUNC_ITERATOR_CLONE(_eina_xattr_ls_iterator_clone);
291 303
292 return &it->iterator; 304 return &it->iterator;
293#else 305#else