src/linked_list.c

changeset 702
3390b58ad15a
parent 699
35b2b99ee523
child 703
425d4279856f
equal deleted inserted replaced
701:72a440c437e9 702:3390b58ad15a
353 void *lc, *ls, *le, *re; 353 void *lc, *ls, *le, *re;
354 354
355 // set start node 355 // set start node
356 ls = *begin; 356 ls = *begin;
357 357
358 // early exit when this list is empty
359 if (ls == NULL) return;
360
358 // check how many elements are already sorted 361 // check how many elements are already sorted
359 lc = ls; 362 lc = ls;
360 size_t ln = 1; 363 size_t ln = 1;
361 while (ll_next(lc) != NULL && cmp_func(ll_data(ll_next(lc)), ll_data(lc)) > 0) { 364 while (ll_next(lc) != NULL && cmp_func(ll_data(ll_next(lc)), ll_data(lc)) > 0) {
362 lc = ll_next(lc); 365 lc = ll_next(lc);

mercurial