Squashed 'third_party/rawrtc/rawrtc-common/' content from commit aff7a3a3b
Change-Id: I2cb019410e8d0e1e0bf814577b0ef83aeb32c7fd
git-subtree-dir: third_party/rawrtc/rawrtc-common
git-subtree-split: aff7a3a3b9bbf49f7d2fc8b123edd301825b3e1c
diff --git a/include/rawrtcc/utils.h b/include/rawrtcc/utils.h
new file mode 100644
index 0000000..8c798eb
--- /dev/null
+++ b/include/rawrtcc/utils.h
@@ -0,0 +1,19 @@
+#pragma once
+#include "code.h"
+
+/// Translate a rawrtc return code to a string.
+char const* rawrtc_code_to_str(enum rawrtc_code const code);
+
+/// Translate an re error to a rawrtc code.
+enum rawrtc_code rawrtc_error_to_code(const int code);
+
+/// Duplicate a string.
+/// `*destinationp` will be set to a copy of `source` and must be
+/// unreferenced.
+enum rawrtc_code rawrtc_strdup(
+ char** const destinationp, // de-referenced
+ char const* const source);
+
+/// Print a formatted string to a dynamically allocated buffer.
+/// `*destinationp` must be unreferenced.
+enum rawrtc_code rawrtc_sdprintf(char** const destinationp, char* const formatter, ...);