changeset 109120:9983eb21a9c9

Fix invalid cast * sorted-doc.c (cmpdoc): Fix signature. (qsort_compare): Delete. (main): Remove cast.
author Andreas Schwab <schwab@linux-m68k.org>
date Sat, 03 Jul 2010 14:11:03 +0200
parents 00accbd76dbd
children 07c5d1a43f6a
files lib-src/ChangeLog lib-src/sorted-doc.c
diffstat 2 files changed, 10 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/lib-src/ChangeLog	Sat Jul 03 12:46:27 2010 +0200
+++ b/lib-src/ChangeLog	Sat Jul 03 14:11:03 2010 +0200
@@ -1,3 +1,9 @@
+2010-07-03  Andreas Schwab  <schwab@linux-m68k.org>
+
+	* sorted-doc.c (cmpdoc): Fix signature.
+	(qsort_compare): Delete.
+	(main): Remove cast.
+
 2010-07-03  Juanma Barranquero  <lekktu@gmail.com>
 
 	* ebrowse.c (match_qualified_namespace_alias): Check for null pointer.
--- a/lib-src/sorted-doc.c	Sat Jul 03 12:46:27 2010 +0200
+++ b/lib-src/sorted-doc.c	Sat Jul 03 14:11:03 2010 +0200
@@ -103,15 +103,15 @@
 /* Comparison function for qsort to call.  */
 
 int
-cmpdoc (DOCSTR **a, DOCSTR **b)
+cmpdoc (const void *va, const void *vb)
 {
+  DOCSTR *const *a = va;
+  DOCSTR *const *b = vb;
   register int val = strcmp ((*a)->name, (*b)->name);
   if (val) return val;
   return (*a)->type - (*b)->type;
 }
 
-typedef int (*qsort_compare) (const void *, const void *);
-
 enum state
 {
   WAITING, BEG_NAME, NAME_GET, BEG_DESC, DESC_GET
@@ -228,7 +228,7 @@
 
     /* sort the array by name; within each name, by type */
 
-    qsort ((char*)array, cnt, sizeof (DOCSTR*), (qsort_compare)cmpdoc);
+    qsort ((char*)array, cnt, sizeof (DOCSTR*), cmpdoc);
 
     /* write the output header */