aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Noll <nbnoll@eml.cc>2021-12-03 18:51:52 -0800
committerNicholas Noll <nbnoll@eml.cc>2021-12-03 18:51:52 -0800
commitb80a3d28ce42be4fdec451f74620b10ee75219dc (patch)
tree249571aef4334cb0da7772ac216b05167bcd68ac
parentf7a916f7620c749d440cb6a76010641675217689 (diff)
Fix(fmt): incorrect, uninitialized variable used
-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)))