From bf0b7b43866709d7748f8f89d3f78d6737e0678a Mon Sep 17 00:00:00 2001 From: rlar Date: Sun, 24 Oct 2010 12:53:52 +0000 Subject: [PATCH] qsort() usage, drop cast of the first argument (which is a void *) --- ChangeLog | 10 ++++++++++ src/frontend/com_ahelp.c | 2 +- src/frontend/com_display.c | 2 +- src/frontend/com_help.c | 2 +- src/frontend/help/readhelp.c | 2 +- src/frontend/variable.c | 2 +- src/frontend/vectors.c | 2 +- src/misc/wlist.c | 2 +- 8 files changed, 17 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index e9eb092f0..26efecbe1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2010-10-24 Robert Larice + * src/frontend/com_ahelp.c , + * src/frontend/com_display.c , + * src/frontend/com_help.c , + * src/frontend/help/readhelp.c , + * src/frontend/variable.c , + * src/frontend/vectors.c , + * src/misc/wlist.c : + qsort() usage, drop cast of the first argument (which is a void *) + 2010-10-24 Robert Larice * src/maths/sparse/spalloc.c , * src/maths/sparse/spbuild.c , diff --git a/src/frontend/com_ahelp.c b/src/frontend/com_ahelp.c index 6f8449007..57f558c19 100644 --- a/src/frontend/com_ahelp.c +++ b/src/frontend/com_ahelp.c @@ -66,7 +66,7 @@ com_ahelp(wordlist *wl) for (n = 0; cp_coms[n].co_func != NULL; n++) { cc[n] = &cp_coms[n]; } - qsort((char *) cc, n, sizeof(struct comm *), hcomp); + qsort(cc, n, sizeof(struct comm *), hcomp); /* filter the commands */ for (i=0; i< n; i++) { diff --git a/src/frontend/com_display.c b/src/frontend/com_display.c index 8d1a2009b..1a4f8a040 100644 --- a/src/frontend/com_display.c +++ b/src/frontend/com_display.c @@ -65,7 +65,7 @@ com_display(wordlist *wl) for (d = plot_cur->pl_dvecs, i = 0; d; d = d->v_next, i++) dvs[i] = d; if (!cp_getvar("nosort", CP_BOOL, NULL)) - qsort((char *) dvs, len, sizeof (struct dvec *), dcomp); + qsort(dvs, len, sizeof (struct dvec *), dcomp); out_printf("Title: %s\n", plot_cur->pl_title); out_printf("Name: %s (%s)\nDate: %s\n\n", diff --git a/src/frontend/com_help.c b/src/frontend/com_help.c index b515a15fd..9a1ad385a 100644 --- a/src/frontend/com_help.c +++ b/src/frontend/com_help.c @@ -42,7 +42,7 @@ com_help(wordlist *wl) /* Sort the commands */ for (numcoms = 0; cp_coms[numcoms].co_func != NULL; numcoms++) ccc[numcoms] = &cp_coms[numcoms]; - qsort((char *) ccc, numcoms, sizeof (struct comm *), hcomp); + qsort(ccc, numcoms, sizeof (struct comm *), hcomp); for (i = 0; i < numcoms; i++) { if ((ccc[i]->co_spiceonly && ft_nutmeg) || diff --git a/src/frontend/help/readhelp.c b/src/frontend/help/readhelp.c index 3d8ec89ac..bd902ded8 100644 --- a/src/frontend/help/readhelp.c +++ b/src/frontend/help/readhelp.c @@ -51,7 +51,7 @@ sortlist(toplink **tlp) vec = (toplink **) tmalloc(sizeof (toplink *) * num); for (tl = *tlp, i = 0; tl; tl = tl->next, i++) vec[i] = tl; - (void) qsort((char *) vec, num, sizeof (toplink *), sortcmp); + (void) qsort(vec, num, sizeof (toplink *), sortcmp); *tlp = vec[0]; for (i = 0; i < num - 1; i++) vec[i]->next = vec[i + 1]; diff --git a/src/frontend/variable.c b/src/frontend/variable.c index ac1042d9b..f5ad8f0b5 100644 --- a/src/frontend/variable.c +++ b/src/frontend/variable.c @@ -913,7 +913,7 @@ cp_vprint(void) vars[i].x_char = '+'; } - qsort((char *) vars, i, sizeof (struct xxx), vcmp); + qsort(vars, i, sizeof (struct xxx), vcmp); for (j = 0; j < i; j++) { if (j && eq(vars[j].x_v->va_name, vars[j - 1].x_v->va_name)) diff --git a/src/frontend/vectors.c b/src/frontend/vectors.c index 9bce03afc..5deeb476e 100644 --- a/src/frontend/vectors.c +++ b/src/frontend/vectors.c @@ -198,7 +198,7 @@ sortvecs(struct dvec *d) for (t = d, i = 0; t; t = t->v_link2) array[i++] = t; - qsort((char *) array, i, sizeof (struct dvec *), veccmp); + qsort(array, i, sizeof (struct dvec *), veccmp); /* Now string everything back together... */ for (j = 0; j < i - 1; j++) diff --git a/src/misc/wlist.c b/src/misc/wlist.c index db0bd0eb0..aee1c84b1 100644 --- a/src/misc/wlist.c +++ b/src/misc/wlist.c @@ -248,7 +248,7 @@ wl_sort(wordlist *wl) stuff = (char **) tmalloc(i * sizeof (char *)); for (i = 0, ww = wl; ww; i++, ww = ww->wl_next) stuff[i] = ww->wl_word; - qsort((char *) stuff, i, sizeof (char *), wlcomp); + qsort(stuff, i, sizeof (char *), wlcomp); for (i = 0, ww = wl; ww; i++, ww = ww->wl_next) ww->wl_word = stuff[i]; tfree(stuff);