instead of increasing it and immediately after decreasing it again,
let's just increase it a bit later.
r = safe_fgetc(f, &c);
if (r < 0)
return r;
- if (r == 0)
+ if (r == 0) /* EOF is definitely EOL */
break;
- count++;
-
eol = categorize_eol(c, flags);
if (FLAGS_SET(previous_eol, EOL_ZERO) ||
* EOL marker has been seen right before? In either of these three cases we are
* done. But first, let's put this character back in the queue. */
assert_se(ungetc(c, f) != EOF);
- count--;
break;
}
+ count++;
+
if (eol != EOL_NONE) {
previous_eol |= eol;
continue;