summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--list.c11
-rw-r--r--list.h2
-rw-r--r--smenu.c11
-rw-r--r--smenu.h2
-rw-r--r--utils.c6
-rw-r--r--utils.h2
6 files changed, 18 insertions, 16 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. */
/* """"""""""""""""""""""""""""""""""""""""" */
diff --git a/list.h b/list.h
index cf7e637..f2857f8 100644
--- a/list.h
+++ b/list.h
@@ -51,7 +51,7 @@ ll_insert_after(ll_t * const list, ll_node_t * node, void * const data);
void
ll_sort(ll_t * list, int (*comp)(void *, void *),
- void (*swap)(void * a, void *));
+ void (*swap)(void **, void **));
int
ll_delete(ll_t * const list, ll_node_t * node);
diff --git a/smenu.c b/smenu.c
index 7217eb6..232301a 100644
--- a/smenu.c
+++ b/smenu.c
@@ -875,12 +875,13 @@ tag_comp(void * a, void * b)
/* Swap the values of two selected words in the output list. */
/* ========================================================= */
void
-tag_swap(void * a, void * b)
+tag_swap(void ** a, void ** b)
{
- output_t * oa = *(output_t **)a;
- output_t * ob = *(output_t **)b;
- char * tmp_str;
- long tmp_order;
+ output_t * oa = (output_t *)*a;
+ output_t * ob = (output_t *)*b;
+
+ char * tmp_str;
+ long tmp_order;
tmp_str = oa->output_str;
oa->output_str = ob->output_str;
diff --git a/smenu.h b/smenu.h
index 2b258f0..99f8d69 100644
--- a/smenu.h
+++ b/smenu.h
@@ -430,7 +430,7 @@ int
tag_comp(void * a, void * b);
void
-tag_swap(void * a, void * b);
+tag_swap(void * *a, void ** b);
int
isempty(const char * s);
diff --git a/utils.c b/utils.c
index 4744a03..5582a71 100644
--- a/utils.c
+++ b/utils.c
@@ -65,10 +65,10 @@ interval_comp(void * a, void * b)
/* Swaps the values of two intervals. */
/* ================================== */
void
-interval_swap(void * a, void * b)
+interval_swap(void ** a, void ** b)
{
- interval_t * ia = *(interval_t **)a;
- interval_t * ib = *(interval_t **)b;
+ interval_t * ia = (interval_t *)*a;
+ interval_t * ib = (interval_t *)*b;
long tmp;
tmp = ia->low;
diff --git a/utils.h b/utils.h
index 741795f..8901151 100644
--- a/utils.h
+++ b/utils.h
@@ -33,7 +33,7 @@ int
interval_comp(void * a, void * b);
void
-interval_swap(void * a, void * b);
+interval_swap(void ** a, void ** b);
void
merge_intervals(ll_t * list);