strlcasestr uses c_toupper; rename to c_strlcasestr?
Kalle Olavi Niemitalo <[email protected]> Mon, 09 May 2011 09:35:24 +0300
| Newsgroups | gmane.comp.web.links |
|---|---|
| Message-ID | <[email protected]> |
--===============2055133494==
Content-Type: multipart/signed; boundary="=-=-=";
micalg=pgp-sha1; protocol="application/pgp-signature"
--=-=-=
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.
--=-=-=
Content-Type: application/pgp-signature
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
iEYEARECAAYFAk3HizcACgkQHm9IGt60eMh14QCfZcodhmLrKlFnoOgD/zkXrD4O
H2AAoJd6qM0RTu4kssWWHlI64Dqw24xT
=8Ab4
-----END PGP SIGNATURE-----
--=-=-=--
--===============2055133494==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
elinks-dev mailing list
[email protected]
http://linuxfromscratch.org/mailman/listinfo/elinks-dev
--===============2055133494==--