aboutsummaryrefslogtreecommitdiff
path: root/src/cordhelpers.h
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-03-21 21:43:51 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-03-21 21:43:51 -0400
commitdcf266228512e100e779fe72f2d4e9ebb605ffe6 (patch)
tree6fb3cac1ee3647f08bca219949ed8dc61b5861f2 /src/cordhelpers.h
parent9acea1807f5945c55445a16259386e4979203a1e (diff)
Move files into src/ and build into build/
Diffstat (limited to 'src/cordhelpers.h')
-rw-r--r--src/cordhelpers.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/cordhelpers.h b/src/cordhelpers.h
new file mode 100644
index 00000000..9a72e93c
--- /dev/null
+++ b/src/cordhelpers.h
@@ -0,0 +1,14 @@
+#pragma once
+// Some helper functions for the GC Cord library
+
+#include <gc/cord.h>
+
+#define CORD_appendf(cord, fmt, ...) CORD_sprintf(cord, "%r" fmt, *(cord) __VA_OPT__(,) __VA_ARGS__)
+#define CORD_all(...) CORD_catn(sizeof((CORD[]){__VA_ARGS__})/sizeof(CORD), __VA_ARGS__)
+
+__attribute__((format(printf, 1, 2)))
+CORD CORD_asprintf(CORD fmt, ...);
+CORD CORD_quoted(CORD str);
+CORD CORD_replace(CORD c, CORD to_replace, CORD replacement);
+
+// vim: ts=4 sw=0 et cino=L2,l1,(0,W4,m1,\:0