Hi Rob,
+/* find a character from a set in reverse without the string having to be null-terminated */ +static inline WCHAR *memrpbrkW(const WCHAR *ptr, size_t n, const WCHAR *accept) +{ + const WCHAR *end, *ret = NULL; + for (end = ptr + n; ptr < end; ptr++) if (strchrW(accept, *ptr)) ret = ptr; + return (WCHAR *)ret; +}
Maybe it's because I'm dense and I don't particularly like three levels of indent on a single line, but this doesn't seem to do what I'd expect. The for loop doesn't quit when ret is assigned, thus, this will always find the last character, from left to right, from accept in ptr, rather than the first.
Don't you mean "ptr < end && !ret"? And in what sense is this "in reverse"? --Juan
____________________________________________________________________________________ Bored stiff? Loosen up... Download and play hundreds of games for free on Yahoo! Games. http://games.yahoo.com/games/front