scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit b0af6cf542d1079e0d6cae0ed9d9c1af126598cb
parent 62ddccb77b673e8977a3d9f0dfb670217f4f1733
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Sat,  2 Dec 2017 20:33:57 +0100

[lib/c] Fix test increment

It wasn't done in characters out of expansions.

Diffstat:
lib/c/src/vfprintf.c | 8++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/c/src/vfprintf.c b/lib/c/src/vfprintf.c @@ -189,8 +189,8 @@ vfprintf(FILE * restrict fp, const char *fmt, va_list va) for (cnt = 0; ch = *fmt++; cnt += inc) { if (ch != '%') { putc(ch, fp); - ++cnt; - continue; + inc = 1; + goto test_inc; } fill = ' '; @@ -338,7 +338,7 @@ flags: setcnt(va, flags, cnt); break; case '\0': - goto end_format; + --fmt; } test_inc: if (inc > INT_MAX - cnt) { @@ -346,6 +346,6 @@ test_inc: return EOF; } } -end_format: + return (ferror(fp)) ? EOF : cnt; }