| 803 void cxListFree(CxList *list) { |
803 void cxListFree(CxList *list) { |
| 804 if (list == NULL) return; |
804 if (list == NULL) return; |
| 805 list->cl->deallocate(list); |
805 list->cl->deallocate(list); |
| 806 } |
806 } |
| 807 |
807 |
| 808 size_t cxListClone(CxList *dst, const CxList *src, cx_clone_func clone_func, |
808 int cxListClone(CxList *dst, const CxList *src, cx_clone_func clone_func, |
| 809 const CxAllocator *clone_allocator, void *data) { |
809 const CxAllocator *clone_allocator, void *data) { |
| 810 |
810 |
| 811 // remember the original size |
811 // remember the original size |
| 812 size_t orig_size = dst->collection.size; |
812 size_t orig_size = dst->collection.size; |
| 813 |
813 |
| 855 cxListRemoveArray(dst, |
855 cxListRemoveArray(dst, |
| 856 orig_size + cloned, |
856 orig_size + cloned, |
| 857 dst->collection.size - cloned - orig_size); |
857 dst->collection.size - cloned - orig_size); |
| 858 dst->collection.simple_destructor = destr_bak; |
858 dst->collection.simple_destructor = destr_bak; |
| 859 dst->collection.advanced_destructor = destr2_bak; |
859 dst->collection.advanced_destructor = destr2_bak; |
| 860 } |
860 return 1; |
| 861 |
861 } |
| 862 // return how many elements we have cloned |
862 |
| 863 return cloned; |
863 return 0; |
| 864 } |
864 } |