Upgrade to gperf 3.1

This commit is contained in:
Shahram Najm 2022-08-12 13:11:42 +01:00
parent 71f5bd5d69
commit f2a9309e93
3 changed files with 10 additions and 9 deletions

View File

@ -1076,7 +1076,7 @@ void grib_math_delete(grib_context* c, grib_math* m);
grib_math* grib_math_new(grib_context* c, const char* formula, int* err); grib_math* grib_math_new(grib_context* c, const char* formula, int* err);
/* grib_hash_keys.c */ /* grib_hash_keys.c */
const struct grib_keys_hash* grib_keys_hash_get(const char* str, unsigned int len); const struct grib_keys_hash* grib_keys_hash_get(register const char *str, register size_t len);
grib_itrie* grib_hash_keys_new(grib_context* c, int* count); grib_itrie* grib_hash_keys_new(grib_context* c, int* count);
void grib_hash_keys_delete(grib_itrie* t); void grib_hash_keys_delete(grib_itrie* t);
int grib_hash_keys_get_id(grib_itrie* t, const char* key); int grib_hash_keys_get_id(grib_itrie* t, const char* key);

View File

@ -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 -l -C -I -t -G -H hash_keys -N grib_keys_hash_get -m 3 ../tests/keys */ /* Command-line: gperf -l -C -I -t -G -H hash_keys -N grib_keys_hash_get -m 3 ../tests/keys */
/* Computed positions: -k'1-16,19-20,23-26,28,$' */ /* Computed positions: -k'1-16,19-20,23-26,28,$' */
@ -26,7 +26,7 @@
&& ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
&& ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)) && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))
/* The character set is not based on ISO-646. */ /* 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 <bug-gnu-gperf@gnu.org>." #error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gperf@gnu.org>."
#endif #endif
@ -49,7 +49,7 @@ inline
#endif #endif
#endif #endif
static unsigned int static unsigned int
hash_keys (const char *str, unsigned int len) hash_keys (register const char *str, register size_t len)
{ {
static const unsigned short asso_values[] = static const unsigned short asso_values[] =
{ {
@ -80,7 +80,7 @@ hash_keys (const char *str, unsigned int len)
32423, 32423, 32423, 32423, 32423, 32423, 32423, 32423, 32423, 32423, 32423, 32423, 32423, 32423, 32423, 32423, 32423, 32423, 32423, 32423,
32423, 32423, 32423, 32423, 32423, 32423, 32423, 32423, 32423 32423, 32423, 32423, 32423, 32423, 32423, 32423, 32423, 32423
}; };
register int hval = len; register unsigned int hval = len;
switch (hval) switch (hval)
{ {
@ -9396,13 +9396,13 @@ static const struct grib_keys_hash wordlist[] =
}; };
const struct grib_keys_hash * const struct grib_keys_hash *
grib_keys_hash_get (const char *str, unsigned int len) grib_keys_hash_get (register const char *str, register size_t len)
{ {
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
{ {
register int key = hash_keys (str, len); register unsigned int key = hash_keys (str, len);
if (key <= MAX_HASH_VALUE && key >= 0) if (key <= MAX_HASH_VALUE)
if (len == lengthtable[key]) if (len == lengthtable[key])
{ {
register const char *s = wordlist[key].name; register const char *s = wordlist[key].name;

View File

@ -1,4 +1,4 @@
#!/usr/bin/ksh #!/bin/sh
set -xe set -xe
cd ../tests cd ../tests
@ -22,3 +22,4 @@ gperf -l -C -I -t -G -H hash_keys -N grib_keys_hash_get -m 3 ../tests/keys |\
cat grib_itrie_keys.c >> grib_hash_keys.c cat grib_itrie_keys.c >> grib_hash_keys.c
echo ALL DONE