src/list.c

changeset 253
e19825a1430a
parent 251
fae240d633fc
child 259
2f5dea574a75
equal deleted inserted replaced
252:6342cbbd1922 253:e19825a1430a
239 239
240 return s; 240 return s;
241 } 241 }
242 242
243 static UcxList *ucx_list_sort_merge(int length, 243 static UcxList *ucx_list_sort_merge(int length,
244 UcxList* restrict ls, UcxList* restrict le, UcxList* restrict re, 244 UcxList* ls, UcxList* le, UcxList* re,
245 cmp_func fnc, void* data) { 245 cmp_func fnc, void* data) {
246 246
247 UcxList** sorted = (UcxList**) malloc(sizeof(UcxList*)*length); 247 UcxList** sorted = (UcxList**) malloc(sizeof(UcxList*)*length);
248 UcxList *rc, *lc; 248 UcxList *rc, *lc;
249 249
289 } 289 }
290 290
291 UcxList *lc; 291 UcxList *lc;
292 int ln = 1; 292 int ln = 1;
293 293
294 UcxList *restrict ls = l, *restrict le, *restrict re; 294 UcxList *ls = l, *le, *re;
295 295
296 // check how many elements are already sorted 296 // check how many elements are already sorted
297 lc = ls; 297 lc = ls;
298 while (lc->next != NULL && fnc(lc->next->data, lc->data, data) > 0) { 298 while (lc->next != NULL && fnc(lc->next->data, lc->data, data) > 0) {
299 lc = lc->next; 299 lc = lc->next;

mercurial