bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: [Gperf-bugs] Patch to gperf 2.7.2 for case-independent keyword match


From: Bruno Haible
Subject: Re: [Gperf-bugs] Patch to gperf 2.7.2 for case-independent keyword matching
Date: Fri, 15 Feb 2002 14:47:30 +0100 (CET)

Bruce Lilly writes:
> In several important situations, keywords must be matched
> independent of case (email header field names, domain names,
> etc.).

The recommended way to do this is to convert the keywords to upper
case (or lower case, as you like) before passing them to gperf.

> The attached patch to gperf 2.7.2 provides the option to
> generate output which does case-independent matching and
> documents that option.

gperf is a tool for maximum speed lookup. Your comparison function
uses strcasecmp or strncasecmp at run time. This will not only
case-convert the string being looked up more than once (namely, once
in each comparison), but also case-convert the fixed keywords (which
you already should have case-converted before running gperf).

In summary, this patch runs counter the general objective of gperf of
producing fast code.

Other than that, the use of strcasecmp and strncasecmp may not work if
the keyword set contains 8-bit characters and the locale at run time
is set differently than at compile time.

Bruno



reply via email to

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