void tapdisk_stats_field(td_stats_t *st, const char *key, const char *conv, ...) { va_list ap; int n_elem; char t; n_elem = st->n_elem[st->depth]++; if (n_elem > 0) __stats_sprintf(st, ", "); __stats_sprintf(st, "\"%s\": ", key); if (!conv) { __stats_sprintf(st, "null"); return; } t = conv[0]; switch (t) { case '[': case '{': __tapdisk_stats_enter(st, t); break; default: va_start(ap, conv); __stats_enter(st); tapdisk_stats_vval(st, conv, ap); __stats_leave(st); va_end(ap); } }
static void __stats_next(td_stats_t * st) { int n_elem; n_elem = st->n_elem[st->depth]; if (n_elem > 0) __stats_sprintf(st, ", "); st->n_elem[st->depth]++; }
void tapdisk_stats_leave(td_stats_t *st, char t) { __stats_leave(st); __stats_sprintf(st, " %c", t); }
static void __tapdisk_stats_enter(td_stats_t *st, char t) { __stats_sprintf(st, "%c ", t); __stats_enter(st); }