Fri, 12 Oct 2012 12:12:59 +0200
lists now sort on heap to prevent stack overflows
ucx/dlist.c | file | annotate | diff | comparison | revisions | |
ucx/list.c | file | annotate | diff | comparison | revisions |
1.1 --- a/ucx/dlist.c Fri Oct 12 12:09:00 2012 +0200 1.2 +++ b/ucx/dlist.c Fri Oct 12 12:12:59 2012 +0200 1.3 @@ -117,7 +117,8 @@ 1.4 UcxDlist *ucx_dlist_sort_merge(int length, 1.5 UcxDlist* restrict ls, UcxDlist* restrict le, UcxDlist* restrict re, 1.6 cmp_func fnc, void* data) { 1.7 - ucx_dynarray_new(UcxDlist*, sorted, length); 1.8 + 1.9 + UcxDlist** sorted = (UcxDlist**) malloc(sizeof(UcxDlist*)*length); 1.10 UcxDlist *rc, *lc; 1.11 1.12 lc = ls; rc = le; 1.13 @@ -152,7 +153,7 @@ 1.14 sorted[length-1]->next = NULL; 1.15 1.16 UcxDlist *ret = sorted[0]; 1.17 - ucx_dynarray_free(sorted); 1.18 + free(sorted); 1.19 return ret; 1.20 } 1.21
2.1 --- a/ucx/list.c Fri Oct 12 12:09:00 2012 +0200 2.2 +++ b/ucx/list.c Fri Oct 12 12:12:59 2012 +0200 2.3 @@ -114,7 +114,7 @@ 2.4 UcxList* restrict ls, UcxList* restrict le, UcxList* restrict re, 2.5 cmp_func fnc, void* data) { 2.6 2.7 - ucx_dynarray_new(UcxList*, sorted, length); 2.8 + UcxList** sorted = (UcxList**) malloc(sizeof(UcxList*)*length); 2.9 UcxList *rc, *lc; 2.10 2.11 lc = ls; rc = le; 2.12 @@ -147,7 +147,7 @@ 2.13 sorted[length-1]->next = NULL; 2.14 2.15 UcxList *ret = sorted[0]; 2.16 - ucx_dynarray_free(sorted); 2.17 + free(sorted); 2.18 return ret; 2.19 } 2.20