//lint -e{818} void vtc_log(struct vtclog *vl, unsigned lvl, const char *fmt, ...) { CHECK_OBJ_NOTNULL(vl, VTCLOG_MAGIC); AZ(pthread_mutex_lock(&vl->mtx)); assert(lvl < NLEAD); vsb_clear(vl->vsb); vsb_printf(vl->vsb, "%s %-4s ", lead[lvl], vl->id); va_list ap; va_start(ap, fmt); (void)vsb_vprintf(vl->vsb, fmt, ap); va_end(ap); vsb_putc(vl->vsb, '\n'); vsb_finish(vl->vsb); AZ(vsb_overflowed(vl->vsb)); vtc_log_emit(vl, lvl); vsb_clear(vl->vsb); AZ(pthread_mutex_unlock(&vl->mtx)); if (lvl == 0) { vtc_error = 1; if (pthread_self() != vtc_thread) pthread_exit(NULL); } }
/* * Format the given arguments and append the resulting string to an vsb. */ int vsb_printf(struct vsb *s, const char *fmt, ...) { va_list ap; int result; va_start(ap, fmt); result = vsb_vprintf(s, fmt, ap); va_end(ap); return (result); }
/*lint -e{818} cli could be const */ void cli_out(struct cli *cli, const char *fmt, ...) { va_list ap; va_start(ap, fmt); if (cli != NULL) (void)vsb_vprintf(cli->sb, fmt, ap); else (void)vfprintf(stdout, fmt, ap); va_end(ap); }
static struct expr * vcc_mk_expr(enum var_type fmt, const char *str, ...) { va_list ap; struct expr *e; e = vcc_new_expr(); e->fmt = fmt; va_start(ap, str); vsb_vprintf(e->vsb, str, ap); va_end(ap); AZ(vsb_finish(e->vsb)); return (e); }