ntdll: rtlstr.c: Implement checking for control characters in RtlIsTextUnicode [try 2]

Dan Kegel dank at kegel.com
Thu Jun 19 07:29:53 CDT 2008


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:



More information about the wine-devel mailing list