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 |
--- a/ucx/dlist.c Fri Oct 12 12:09:00 2012 +0200 +++ b/ucx/dlist.c Fri Oct 12 12:12:59 2012 +0200 @@ -117,7 +117,8 @@ UcxDlist *ucx_dlist_sort_merge(int length, UcxDlist* restrict ls, UcxDlist* restrict le, UcxDlist* restrict re, cmp_func fnc, void* data) { - ucx_dynarray_new(UcxDlist*, sorted, length); + + UcxDlist** sorted = (UcxDlist**) malloc(sizeof(UcxDlist*)*length); UcxDlist *rc, *lc; lc = ls; rc = le; @@ -152,7 +153,7 @@ sorted[length-1]->next = NULL; UcxDlist *ret = sorted[0]; - ucx_dynarray_free(sorted); + free(sorted); return ret; }
--- a/ucx/list.c Fri Oct 12 12:09:00 2012 +0200 +++ b/ucx/list.c Fri Oct 12 12:12:59 2012 +0200 @@ -114,7 +114,7 @@ UcxList* restrict ls, UcxList* restrict le, UcxList* restrict re, cmp_func fnc, void* data) { - ucx_dynarray_new(UcxList*, sorted, length); + UcxList** sorted = (UcxList**) malloc(sizeof(UcxList*)*length); UcxList *rc, *lc; lc = ls; rc = le; @@ -147,7 +147,7 @@ sorted[length-1]->next = NULL; UcxList *ret = sorted[0]; - ucx_dynarray_free(sorted); + free(sorted); return ret; }