In master:src/util/string.{c,h}, there are various "*case*"
functions and macros for case-insensitive string operations:

* c_strcasecmp() uses c_tolower().
* c_strcasestr() uses c_strncasecmp(), thus c_tolower().
* c_strlcasecmp() uses elinks_strlcasecmp(...,, 1), thus c_toupper().
* c_strncasecmp() uses c_tolower().
* elinks_strlcasecmp() uses c_toupper() or toupper(),
  depending on the locale_indep parameter.
* elinks_strlcasestr() uses c_strncasecmp(), thus c_tolower().
* strlcasecmp() uses elinks_strlcasecmp(..., 0), thus toupper().
* strlcasestr() uses elinks_strlcasestr(), thus c_toupper().

I think the name of strlcasestr() is misleading because it is
locale-independent even though strlcasecmp() is locale-dependent.
Should strlcasestr() be renamed to c_strlcasestr(), or should it
be changed to use toupper()?

The only function using strlcasestr() is match_cache_entry_contents(),
which searches for a user-provided string (in the terminal charset)
in a cache fragment (in the document charset).  Because the charsets
do not always match, and usually at least one of them is multibyte,
just calling toupper() would not do the right thing.

Attachment: pgpaCqpl35Gu3.pgp
Description: PGP signature

elinks-dev mailing list

Reply via email to