Planning 3.0alpha21 for Friday (10/25)
urban at teststation.com
Sun Oct 27 18:02:01 GMT 2002
On Sat, 26 Oct 2002, Andrew Bartlett wrote:
> > pstring s2;
> > smb_ucs2_t *p;
> > + if (!(c & 0x80))
> > + return strchr(s, c); /* ascii */
> > +
> > push_ucs2(NULL, ws, s, sizeof(ws), STR_TERMINATE);
> > p = strrchr_w(ws, UCS2_CHAR(c));
> > if (!p)
> This looks wrong...
> You need to check that every char in the string doesn't have 0x80, not
> just the first char. My understanding is that once the 0x80 escape is
> set, we might have 'legitimate' characters following that have their
> meaning altered.
I'm not checking the first char, I'm checking the char we are looking for.
I did think about this. And the way I read the strlower_m comment it said
it was ok because all multi-bytes stayed away from the ascii values.
But it turns out that codepage 932 (for example) uses values < 0x80
in the escaped bytes (assuming that uses this code, utf8 is ok with this).
Anyway, it seems like most of the gain in my measurement was from
inlining/macros of strchr done by gcc/glibc. For a certain testcase:
So it's probably not worth adding a big, ugly loop there.
More information about the samba-technical