Commit 84a0cabb authored by Pavel Emelyanov's avatar Pavel Emelyanov

log-simple: Fix off-by-one when printing numbers

And simplify the code at the same time.
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent babc9c61
...@@ -101,11 +101,10 @@ done: ...@@ -101,11 +101,10 @@ done:
static void print_num(int num, struct simple_buf *b) static void print_num(int num, struct simple_buf *b)
{ {
char buf[12], *s; char buf[12], *s;
int len;
buf[11] = '\0'; buf[11] = '\0';
len = vprint_num(buf, sizeof(buf) - 1, num, &s); vprint_num(buf, sizeof(buf) - 1, num, &s);
print_string(buf + sizeof(buf) - len, b); print_string(s, b);
} }
static void print_num_l(long num, struct simple_buf *b) static void print_num_l(long num, struct simple_buf *b)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment