Txtzyme
Txtzyme copied to clipboard
loop brace code a bit obscure
This code
case '{':
count = x;
loop = buf;
while ((ch = *buf++) && ch != '}') {}
case '}':
if (count) {
count--;
buf = loop;
}
break;
depends on the '{' case falling through to the '}' case at the end. I just blew a day porting to another process where I didn't notice this. How about
case '{':
count = x;
loop = buf;
while ((ch = *buf) && ch != '}') { buf++; }
break;
Not quite as efficient but much safer?
Sorry about the day.
I'm happy to accept a pull request.