From: Justin Seyster Date: Mon, 6 Sep 2010 21:05:14 +0000 (-0400) Subject: Fixed incorrect qsort comparitor. Removed annoying debug printfs. X-Git-Tag: release-v1.0~48^2~6 X-Git-Url: https://git.fsl.cs.stonybrook.edu/?a=commitdiff_plain;h=ed6da810558bbfe01e8df37693196e78a5ee9590;p=interaspect.git Fixed incorrect qsort comparitor. Removed annoying debug printfs. Hopefully, I also learned a valuable lesson about ignoring GCC warnings. --- diff --git a/src/aop-header.c b/src/aop-header.c index f582daf..48196c4 100644 --- a/src/aop-header.c +++ b/src/aop-header.c @@ -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) {