.precision = -1,
};
+static const struct printf_spec default_hex_spec = {
+ .base = 16,
+ .flags = SMALL | ZEROPAD,
+};
+
static noinline_for_stack
char *resource_string(struct printf_state *ps, struct resource *res)
{
}
static noinline_for_stack
-char *bitmap_string(char *buf, char *end, unsigned long *bitmap,
- struct printf_spec spec, const char *fmt)
+char *bitmap_string(struct printf_state *ps, unsigned long *bitmap)
{
const int CHUNKSZ = 32;
- int nr_bits = max_t(int, spec.field_width, 0);
+ int nr_bits = max_t(int, ps->spec.field_width, 0);
int i, chunksz;
bool first = true;
/* reused to print numbers */
- spec = (struct printf_spec){ .flags = SMALL | ZEROPAD, .base = 16 };
+ ps->spec = default_hex_spec;
chunksz = nr_bits & (CHUNKSZ - 1);
if (chunksz == 0)
val = (bitmap[word] >> bit) & chunkmask;
if (!first) {
- if (buf < end)
- *buf = ',';
- buf++;
+ if (ps->buf < ps->end)
+ *ps->buf = ',';
+ ps->buf++;
}
first = false;
- spec.field_width = DIV_ROUND_UP(chunksz, 4);
- buf = number(buf, end, val, spec);
+ ps->spec.field_width = DIV_ROUND_UP(chunksz, 4);
+ printf_number(ps, val);
chunksz = CHUNKSZ;
}
- return buf;
+ return ps->buf;
}
static noinline_for_stack
case 'l':
return bitmap_list_string(ps, ptr);
default:
- return bitmap_string(buf, end, ptr, spec, fmt);
+ return bitmap_string(ps, ptr);
}
case 'M': /* Colon separated: 00:01:02:03:04:05 */
case 'm': /* Contiguous: 000102030405 */