summaryrefslogtreecommitdiffstats
path: root/list.c
diff options
context:
space:
mode:
authorpgen <p.gen.progs@gmail.com>2022-04-29 23:32:19 +0200
committerpgen <p.gen.progs@gmail.com>2022-04-29 23:32:19 +0200
commite9b77db07d47a8b1f5140f16516d1e27380f2c1a (patch)
treeffa10be01ac6e516098abf990045f447e90e47cb /list.c
parentd90563a769e8faa00c5a93ab01849ac29aa94bd3 (diff)
Make pointers explicit in swap functions
Diffstat (limited to 'list.c')
-rw-r--r--list.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/list.c b/list.c
index baa51ca..7365131 100644
--- a/list.c
+++ b/list.c
@@ -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. */
/* """"""""""""""""""""""""""""""""""""""""" */