diff options
Diffstat (limited to 'src/user/knob/format.c')
-rw-r--r-- | src/user/knob/format.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/user/knob/format.c b/src/user/knob/format.c index 54d50ef..c5d2447 100644 --- a/src/user/knob/format.c +++ b/src/user/knob/format.c @@ -81,6 +81,8 @@ static const char *get_format(const char *from, struct format_spec *format_out) return from + 1; } +//char debug[] = "-- format_v: fmt = \" \"..."; + //allocates new memory char *format_v(const char *fmt, va_list args) { buf = get_block(FORMAT_BUF_INIT_SIZE); @@ -90,6 +92,11 @@ char *format_v(const char *fmt, va_list args) { buf_i = buf; while (*fmt) { + //debug[20] = *fmt; + //debug[21] = fmt[1]; + //debug[22] = fmt[2]; + //_system_log(debug); + if (*fmt != '%') { ensure(1); *(buf_i++) = *(fmt++); @@ -133,11 +140,15 @@ char *format_v(const char *fmt, va_list args) { case UNSIGNED_DECIMAL: k = va_arg(args, uint32_t); if (!form.len) { - uint32_t n = 10; - ++form.len; - while (k >= n) { + if (k >= 1000000000) + form.len = 10; + else { + uint32_t n = 10; ++form.len; - n *= 10; + while (k >= n) { + ++form.len; + n *= 10; + } } } ensure(form.len); |