summaryrefslogtreecommitdiffstats
path: root/test/vfd_swmr_common.c
diff options
context:
space:
mode:
authorDavid Young <dyoung@hdfgroup.org>2020-07-21 15:18:43 (GMT)
committerDavid Young <dyoung@hdfgroup.org>2020-07-21 15:18:43 (GMT)
commita9fefff6203de210093ad23da89cd77c7f61db0f (patch)
treecafa174efd4fee34df695e4383610aad64d86883 /test/vfd_swmr_common.c
parent6e3ad3213deee00607adfe1c88dd4f33b936f746 (diff)
downloadhdf5-a9fefff6203de210093ad23da89cd77c7f61db0f.zip
hdf5-a9fefff6203de210093ad23da89cd77c7f61db0f.tar.gz
hdf5-a9fefff6203de210093ad23da89cd77c7f61db0f.tar.bz2
Add evsnprintf for printing a `va_list` to a buffer or aborting the program on
an overflow or other error.
Diffstat (limited to 'test/vfd_swmr_common.c')
-rw-r--r--test/vfd_swmr_common.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/test/vfd_swmr_common.c b/test/vfd_swmr_common.c
index 036308a..7b1b550 100644
--- a/test/vfd_swmr_common.c
+++ b/test/vfd_swmr_common.c
@@ -34,14 +34,11 @@ static const hid_t badhid = H5I_INVALID_HID;
int verbosity = 2;
void
-esnprintf(char *buf, size_t bufsz, const char *fmt, ...)
+evsnprintf(char *buf, size_t bufsz, const char *fmt, va_list ap)
{
int rc;
- va_list ap;
- va_start(ap, fmt);
rc = vsnprintf(buf, bufsz, fmt, ap);
- va_end(ap);
if (rc < 0)
err(EXIT_FAILURE, "%s: vsnprintf", __func__);
@@ -50,6 +47,16 @@ esnprintf(char *buf, size_t bufsz, const char *fmt, ...)
}
void
+esnprintf(char *buf, size_t bufsz, const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ evsnprintf(buf, bufsz, fmt, ap);
+ va_end(ap);
+}
+
+void
dbgf(int level, const char *fmt, ...)
{
va_list ap;