diff options
author | rsc <devnull@localhost> | 2005-05-19 14:39:00 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2005-05-19 14:39:00 +0000 |
commit | f92a2ceba411689890e6f8aab81a03f30b802b10 (patch) | |
tree | 3ba3381113378617fe8f3233bfc156db2ccf7761 /src/lib9 | |
parent | 5cb6d5d9c236f7a11b7c9e0d2c991e1bf9ddd363 (diff) | |
download | plan9port-f92a2ceba411689890e6f8aab81a03f30b802b10.tar.gz plan9port-f92a2ceba411689890e6f8aab81a03f30b802b10.tar.bz2 plan9port-f92a2ceba411689890e6f8aab81a03f30b802b10.zip |
handle 0 precision better
Diffstat (limited to 'src/lib9')
-rw-r--r-- | src/lib9/encodefmt.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/lib9/encodefmt.c b/src/lib9/encodefmt.c index 6e127986..7c4a5898 100644 --- a/src/lib9/encodefmt.c +++ b/src/lib9/encodefmt.c @@ -11,16 +11,18 @@ encodefmt(Fmt *f) uchar *b; char obuf[64]; // rsc optimization - if(!(f->flags&FmtPrec) || f->prec < 1) - goto error; - b = va_arg(f->args, uchar*); if(b == 0) return fmtstrcpy(f, "<nil>"); ilen = f->prec; f->prec = 0; + + if(!(f->flags&FmtPrec) || ilen < 0) + goto error; + f->flags &= ~FmtPrec; + switch(f->r){ case '<': len = (8*ilen+4)/5 + 3; |