aboutsummaryrefslogtreecommitdiffstats
path: root/src/util.zig
diff options
context:
space:
mode:
authors-ol <s+removethis@s-ol.nu>2025-08-05 00:48:42 +0000
committers-ol <s+removethis@s-ol.nu>2025-08-05 01:06:20 +0000
commit57f37fbd6a4816f3a70041e04877beeb0a37b45c (patch)
treebd054c31e2a3b8705197f85705484bda4fe56698 /src/util.zig
parentadd freeze and step controls to Source (diff)
downloadglsl-view-57f37fbd6a4816f3a70041e04877beeb0a37b45c.tar.gz
glsl-view-57f37fbd6a4816f3a70041e04877beeb0a37b45c.zip
dynamic OSC method registration for sources
Diffstat (limited to 'src/util.zig')
-rw-r--r--src/util.zig21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/util.zig b/src/util.zig
new file mode 100644
index 0000000..e168326
--- /dev/null
+++ b/src/util.zig
@@ -0,0 +1,21 @@
+const std = @import("std");
+
+const state = struct {
+ var buf: [256]u8 = undefined;
+};
+var fba = std.heap.FixedBufferAllocator.init(state.buf[0..]);
+
+pub fn tmpZ(str: []const u8) ![:0]const u8 {
+ fba.reset();
+ return try std.fmt.allocPrintZ(fba.allocator(), "{s}", .{str});
+}
+
+pub fn tmpFmtZ(comptime fmt: []const u8, args: anytype) ![:0]const u8 {
+ fba.reset();
+ return try std.fmt.allocPrintZ(fba.allocator(), fmt, args);
+}
+
+pub fn tmpJoinZ(separator: []const u8, slices: []const []const u8) ![:0]const u8 {
+ fba.reset();
+ return try std.mem.joinZ(fba.allocator(), separator, slices);
+}