bug-gnulib
[Top][All Lists]
Advanced

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

Re: [PATCH]: strcasestr GnuLib module


From: Bruno Haible
Subject: Re: [PATCH]: strcasestr GnuLib module
Date: Mon, 15 Aug 2005 19:19:13 +0200
User-agent: KMail/1.5

Yoann Vandoorselaere wrote:
> As you can see from the code, this strcasestr implementation rely on
> strcasecmp (I did not  bothered to use the GLIBC implementation).
>
> Thus, wouldn't it be wise to fix strcasecmp itself, and include it
> unconditionally in GnuLib ?

Yes. Here's a patch to that effect. (Completely untested so far. Also
quite inefficient. One can do better with mbrtowc().)

But note that this doesn't help you much in producing a correct
strcasestr() function, because
  - when you iterate over a strings in BIG5 or GBK encoding, you must
    iterate one character per step, not one byte per step,
  - you don't know a priori how many bytes to pass to strcasecmp() in order
    to get a match,

Bruno


Attachment: uu
Description: Text Data


reply via email to

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