summaryrefslogtreecommitdiff
path: root/test/testHelpers.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2023-01-08 16:34:43 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2023-01-08 16:34:43 +0000
commit8cd0977a3688fa705c83867c57505a47b9269369 (patch)
treeb7b48711051299607077ed31fdf3b3f6dd6cc41f /test/testHelpers.cpp
parentTidy shadow map creation (diff)
downloadilt-8cd0977a3688fa705c83867c57505a47b9269369.tar.bz2
ilt-8cd0977a3688fa705c83867c57505a47b9269369.tar.xz
ilt-8cd0977a3688fa705c83867c57505a47b9269369.zip
Fix up all the static analyzer warnings
Diffstat (limited to 'test/testHelpers.cpp')
-rw-r--r--test/testHelpers.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/testHelpers.cpp b/test/testHelpers.cpp
new file mode 100644
index 0000000..c69e5f3
--- /dev/null
+++ b/test/testHelpers.cpp
@@ -0,0 +1,16 @@
+#include "testHelpers.h"
+#include <cstdarg>
+
+std::unique_ptr<char, decltype(&free)>
+uasprintf(const char * fmt, ...)
+{
+ char * buf {};
+ va_list args;
+ va_start(args, fmt);
+ if (vasprintf(&buf, fmt, args) < 0) {
+ va_end(args);
+ return {nullptr, &free};
+ }
+ va_end(args);
+ return std::unique_ptr<char, decltype(&free)> {buf, &free};
+}