ucx/list.c

changeset 69
fb59270b1de3
parent 67
27e67e725d35
child 73
f15c7d6aebb9
--- a/ucx/list.c	Thu Oct 11 16:29:30 2012 +0200
+++ b/ucx/list.c	Fri Oct 12 10:54:55 2012 +0200
@@ -113,7 +113,8 @@
 UcxList *ucx_list_sort_merge(int length,
         UcxList* restrict ls, UcxList* restrict le, UcxList* restrict re,
         cmp_func fnc, void* data) {
-    UcxList *sorted[length];
+
+    ucx_dynarray_new(UcxList*, sorted, length);
     UcxList *rc, *lc;
 
     lc = ls; rc = le;
@@ -145,7 +146,9 @@
     }
     sorted[length-1]->next = NULL;
 
-    return sorted[0];
+    UcxList *ret = sorted[0];
+    ucx_dynarray_free(sorted);
+    return ret;
 }
 
 UcxList *ucx_list_sort(UcxList *l, cmp_func fnc, void *data) {

mercurial