Fixed incorrect qsort comparitor. Removed annoying debug printfs.
authorJustin Seyster <jseyster@cs.sunysb.edu>
Mon, 6 Sep 2010 21:05:14 +0000 (17:05 -0400)
committerJustin Seyster <jseyster@cs.sunysb.edu>
Mon, 6 Sep 2010 21:05:14 +0000 (17:05 -0400)
Hopefully, I also learned a valuable lesson about ignoring GCC
warnings.

src/aop-header.c

index f582daf9b1aa9a8f23d47ea66c3a6351a0af9b4d..48196c40f4677cf163bbc5374539897ffde29ee1 100644 (file)
@@ -378,10 +378,7 @@ write_prototype (void **table_entry, void *info)
   /* Save this prototype to the hash table. */
   hash_slot = (const char **)htab_find_slot (prototype_strings, line, INSERT);
   if (*hash_slot == NULL)
-    {
-      fprintf (stderr, "Insert\n");
       *hash_slot = xstrdup (line);
-    }
 
   return 1;  /* Continue the traversal. */
 }
@@ -398,20 +395,19 @@ dump_prototype (void **table_entry, void *info)
   /* This is a pointer to an array of strings. */
   const char ***iterator = (const char ***)info;
 
-  fprintf (stderr, "Dumping prototype: %s\n", prototype);
-
   (*iterator)[0] = prototype;
   (*iterator)++;
 
   return 1;  /* Continue the traversal. */
 }
 
-/* Comparator for quicksort.  GCC complains about type if you pass
-   strcmp directly to qsort. */
+/* Comparator for quicksort. */
 static int
 qsort_strcmp (const void *a, const void *b)
 {
-  return strcmp (a, b);
+  char *const *const str_a = a;
+  char *const *const str_b = b;
+  return strcmp (*str_a, *str_b);
 }
 
 /* Write the actual header contents to an already opened file.  The
@@ -466,7 +462,6 @@ write_header_contents (FILE *header, const char *guard, const char *license,
 
   for (i = 0 ; i < htab_elements (prototype_strings); i++)
     {
-      fprintf (stderr, "Writing prototype %d: %s", i, prototype_array[i]);
       size = fprintf (header, "%s", prototype_array[i]);
       if (size < 0)
        {