From 81f729ea98162e597ddb64ddcdfea013cda475ee Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Fri, 12 Aug 2022 15:25:11 +0100 Subject: [PATCH] Upgrade to gperf 3.1 --- src/grib_accessor_classes_hash.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/grib_accessor_classes_hash.c b/src/grib_accessor_classes_hash.c index e61eb753f..df4988ef4 100644 --- a/src/grib_accessor_classes_hash.c +++ b/src/grib_accessor_classes_hash.c @@ -1,4 +1,4 @@ -/* C code produced by gperf version 3.0.4 */ +/* ANSI-C code produced by gperf version 3.1 */ /* Command-line: gperf -C -W classes -t -G -H grib_accessor_classes_get_id -N grib_accessor_classes_hash -m 1 -j 1 accessor_class_list.gperf */ /* Computed positions: -k'1-2,5,7,11' */ @@ -26,7 +26,7 @@ && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)) /* The character set is not based on ISO-646. */ -error "gperf generated tables don't work with this execution character set. Please report a bug to ." +#error "gperf generated tables don't work with this execution character set. Please report a bug to ." #endif #line 1 "accessor_class_list.gperf" @@ -52,7 +52,7 @@ struct accessor_class_hash { char *name; grib_accessor_class **cclass;}; #endif #endif static unsigned int -grib_accessor_classes_get_id (const char *str, unsigned int len) +grib_accessor_classes_get_id (register const char *str, register size_t len) { static const unsigned short asso_values[] = { @@ -83,7 +83,7 @@ grib_accessor_classes_get_id (const char *str, unsigned int len) 832, 832, 832, 832, 832, 832, 832, 832, 832, 832, 832, 832, 832, 832, 832, 832 }; - register int hval = len; + register unsigned int hval = len; switch (hval) { @@ -705,19 +705,18 @@ static const struct accessor_class_hash classes[] = }; static const struct accessor_class_hash * -grib_accessor_classes_hash (const char *str, unsigned int len) +grib_accessor_classes_hash (register const char *str, register size_t len) { - register const int key = grib_accessor_classes_get_id (str, len); - + register unsigned int key = grib_accessor_classes_get_id (str, len); + #ifdef DEBUG { - const char *s; + register const char *s; Assert( len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH ); - Assert( key <= MAX_HASH_VALUE && key >= 0 ); + Assert( key <= MAX_HASH_VALUE ); s = classes[key].name; - Assert( *str == *s && strcmp(str + 1, s + 1)==0 ); + Assert( *str == *s && strcmp (str + 1, s + 1)==0 ); } #endif - return &classes[key]; }