aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/base/fmt/do.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/base/fmt/do.c b/src/base/fmt/do.c
index 3825fc8..a990ab0 100644
--- a/src/base/fmt/do.c
+++ b/src/base/fmt/do.c
@@ -663,9 +663,10 @@ int
fmt·do(fmt·State *io, char *fmt)
{
rune r;
- int c, n;
+ int c, n, o;
char *b, *e;
+ o = io->n;
for(;;){
b = io->buffer.cur;
e = io->buffer.end;
@@ -692,7 +693,7 @@ fmt·do(fmt·State *io, char *fmt)
io->n += b - io->buffer.cur;
io->buffer.cur = b;
if(!c) /* we hit our nul terminator */
- return io->n - n;
+ return io->n - o;
io->buffer.end = e;
if(!(fmt=dispatch(io, fmt)))