diff options
author | pgen <p.gen.progs@gmail.com> | 2022-04-29 23:32:19 +0200 |
---|---|---|
committer | pgen <p.gen.progs@gmail.com> | 2022-04-29 23:32:19 +0200 |
commit | e9b77db07d47a8b1f5140f16516d1e27380f2c1a (patch) | |
tree | ffa10be01ac6e516098abf990045f447e90e47cb /list.c | |
parent | d90563a769e8faa00c5a93ab01849ac29aa94bd3 (diff) |
Make pointers explicit in swap functions
Diffstat (limited to 'list.c')
-rw-r--r-- | list.c | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -24,11 +24,11 @@ static ll_node_t * ll_partition(ll_node_t * l, ll_node_t * h, int (*comp)(void *, void *), - void (*swap)(void *, void *)); + void (*swap)(void **, void **)); static void ll_quicksort(ll_node_t * l, ll_node_t * h, int (*comp)(void *, void *), - void (*swap)(void *, void *)); + void (*swap)(void **, void **)); /* ========================== */ /* Creates a new linked list. */ @@ -185,7 +185,7 @@ ll_insert_after(ll_t * const list, ll_node_t * node, void * const data) /* ====================================================== */ static ll_node_t * ll_partition(ll_node_t * l, ll_node_t * h, int (*comp)(void *, void *), - void (*swap)(void *, void *)) + void (*swap)(void **, void **)) { /* Considers last element as pivot, places the pivot element at its */ /* correct position in sorted array, and places all smaller (smaller than */ @@ -222,7 +222,7 @@ ll_partition(ll_node_t * l, ll_node_t * h, int (*comp)(void *, void *), /* ======================================================== */ static void ll_quicksort(ll_node_t * l, ll_node_t * h, int (*comp)(void *, void *), - void (*swap)(void *, void *)) + void (*swap)(void **, void **)) { if (h != NULL && l != h && l != h->next) { @@ -236,7 +236,8 @@ ll_quicksort(ll_node_t * l, ll_node_t * h, int (*comp)(void *, void *), /* A linked list sort function. */ /* ============================ */ void -ll_sort(ll_t * list, int (*comp)(void *, void *), void (*swap)(void *, void *)) +ll_sort(ll_t * list, int (*comp)(void *, void *), + void (*swap)(void **, void **)) { /* Call the recursive ll_quicksort function. */ /* """"""""""""""""""""""""""""""""""""""""" */ |