summaryrefslogtreecommitdiff
path: root/misc.c
diff options
context:
space:
mode:
authormrb0nk500 <b0nk@b0nk.xyz>2022-08-03 15:27:11 -0300
committermrb0nk500 <b0nk@b0nk.xyz>2022-08-03 15:27:11 -0300
commit44cfcd337ad418e613c6434c181dafe5bf67057e (patch)
tree979199c4c6ed90bf49fbde195731e5a53ef2b2d3 /misc.c
parentca4284c2160617bb57292f56ba6b9bd7fc0814db (diff)
misc: Add `vformat_len()`
This works exactly like `format_len()`, except that it uses `va_list` rather than variadic arguments.
Diffstat (limited to 'misc.c')
-rw-r--r--misc.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/misc.c b/misc.c
index 4c0cab0..6e10a57 100644
--- a/misc.c
+++ b/misc.c
@@ -201,6 +201,10 @@ char *skip_whitespace(const char *str) {
}
}
+int vformat_len(const char *fmt, va_list args) {
+ return vsnprintf(NULL, 0, fmt, args);
+}
+
int format_len(const char *fmt, ...) {
int len = 0;
va_list args;