summaryrefslogtreecommitdiffstats
path: root/lib/printf/glue.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/printf/glue.c')
-rw-r--r--lib/printf/glue.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/printf/glue.c b/lib/printf/glue.c
index 389f503c3..2c97dd639 100644
--- a/lib/printf/glue.c
+++ b/lib/printf/glue.c
@@ -255,3 +255,21 @@ ssize_t printfrr_exti(struct fbuf *buf, struct printfrr_eargs *ea,
}
return -1;
}
+
+printfrr_ext_autoreg_p("VA", printfrr_va)
+static ssize_t printfrr_va(struct fbuf *buf, struct printfrr_eargs *ea,
+ const void *ptr)
+{
+ const struct va_format *vaf = ptr;
+ va_list ap;
+
+ if (!vaf || !vaf->fmt || !vaf->va)
+ return bputs(buf, "NULL");
+
+ /* make sure we don't alter the data passed in - especially since
+ * bprintfrr (and thus this) might be called on the same format twice,
+ * when allocating a larger buffer in asnprintfrr()
+ */
+ va_copy(ap, *vaf->va);
+ return vbprintfrr(buf, vaf->fmt, ap);
+}