ntdll: rtlstr.c: Implement checking for control characters in RtlIsTextUnicode [try 2]
Zac Brown
zac at zacbrown.org
Thu Jun 19 08:39:24 CDT 2008
Dan Kegel wrote:
> The array doesn't make much sense if you're not going to iterate over it.
> It might be more readable if you replaced the array and long if
> with a switch statement.
> It would be nice to break out of the loop early.
> The last two suggestions together kind of mean a goto, which is ugly,
> but not too uncommon in wine.
> (You might want to verify that the generated code isn't too slow,
> but since len is limited to 256, that probably doesn't matter.)
>
> e.g.
>
> if (flags & IS_TEXT_UNICODE_CONTROLS)
> for (i = 0; i < len; i++)
> switch (s[i]) {
> case '\t':
> case '\n':
> case 'r':
> case 0x20:
> out_flags |= IS_TEXT_UNICODE_CONTROLS;
> goto done;
> default:
> }
> }
> done:
I had thought about that before and initially wasn't sure of AJ's feelings on
not declaring something that (I thought) might be considered magic values.
Now that I realized it needs to be optimized, I'll definitely look into it.
-Zac
More information about the wine-devel
mailing list