diff options
Diffstat (limited to 'editor/ppmdist.c')
-rw-r--r-- | editor/ppmdist.c | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/editor/ppmdist.c b/editor/ppmdist.c index bca96adc..e8f17bff 100644 --- a/editor/ppmdist.c +++ b/editor/ppmdist.c @@ -22,6 +22,7 @@ struct colorToGrayEntry { #define MAXCOLORS 255 + static gray newGrayValue(pixel *pix, struct colorToGrayEntry *colorToGrayMap, int colors) { @@ -40,20 +41,34 @@ newGrayValue(pixel *pix, struct colorToGrayEntry *colorToGrayMap, int colors) { +#ifndef LITERAL_FN_DEF_MATCH +static qsort_comparison_fn cmpColorToGrayEntryByIntensity; +#endif + static int -cmpColorToGrayEntryByIntensity(const void *entry1, const void *entry2) { +cmpColorToGrayEntryByIntensity(const void * const a, + const void * const b) { + + const struct colorToGrayEntry * const entry1P = a; + const struct colorToGrayEntry * const entry2P = b; - return ((struct colorToGrayEntry *) entry1)->gray - - ((struct colorToGrayEntry *) entry2)->gray; + return entry1P->gray - entry2P->gray; } +#ifndef LITERAL_FN_DEF_MATCH +static qsort_comparison_fn cmpColorToGrayEntryByFrequency; +#endif + static int -cmpColorToGrayEntryByFrequency(const void * entry1, const void * entry2) { +cmpColorToGrayEntryByFrequency(const void * const a, + const void * const b) { + + const struct colorToGrayEntry * const entry1P = a; + const struct colorToGrayEntry * const entry2P = b; - return ((struct colorToGrayEntry *) entry1)->frequency - - ((struct colorToGrayEntry *) entry2)->frequency; + return entry1P->frequency - entry2P->frequency; } |