bug-gperf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug-gperf] --global-table bug


From: Bruce Korb
Subject: [bug-gperf] --global-table bug
Date: Wed, 11 Aug 2010 11:31:37 -0700

A bug and a nitpick.  The bug is that the enum:

enum
  {
    TOTAL_KEYWORDS = 75,
    MIN_WORD_LENGTH = 19,
    MAX_WORD_LENGTH = 49,
    MIN_HASH_VALUE = 22,
    MAX_HASH_VALUE = 155
  };

is made global instead of remaining within the wordlist function.
This defeats the purpose of specifying distinguished names since
these five names are not distinguished.  I suppose it would be a
lot of bother to just say, "--prefix=foo" and prefix all global names
with "foo_"?  e.g.

enum
  {
    FOO_TOTAL_KEYWORDS = 75,
    FOO_MIN_WORD_LENGTH = 19,
    FOO_MAX_WORD_LENGTH = 49,
    FOO_MIN_HASH_VALUE = 22,
    FOO_MAX_HASH_VALUE = 155
  };

(I know, "if I send a patch"... someday when I've got more time than I do.)

The nitpick is:

in_word_set (register const char *str, register unsigned int len)
{
  if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
    {
      register int key = hash (str, len);

"len" is validated to be at least 19, an yet the hash switch statement
includes case elements for values 2 through 18 as well.  Perhaps most
compilers are smarter than that, but still.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]