sync = bs;
c = *bs++;
if (c == '#') {
- while (c != '\n' && bs < end)
- c = *bs++;
+ uint8_t *match = memchr(bs, '\n', end-bs);
+ if (match)
+ bs = match + 1;
+ else
+ break;
} else if (c == 'P') {
next = bs - pnmctx.bytestream_start + skip - 1;
pnmpc->ascii_scan = 0;