Skip to content

Commit d133ffc

Browse files
committed
fix(examples): use correct Zig function for JS string formatting
- replace deprecated allocPrintZ with allocPrintSentinel in multi-client web app example - ensure proper formatting and memory management for generated JavaScript
1 parent 4bf857d commit d133ffc

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

examples/web_app_multi_client/main.zig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,11 @@ fn saveAll(e: *webui.Event) void {
4040
public_input = allocator.dupe(u8, publicInput) catch unreachable;
4141

4242
// general new js
43-
const js = std.fmt.allocPrintZ(
43+
const js = std.fmt.allocPrintSentinel(
4444
allocator,
4545
"document.getElementById(\"publicInput\").value = \"{s}\";",
4646
.{publicInput},
47+
0,
4748
) catch unreachable;
4849
// free js
4950
defer allocator.free(js);

0 commit comments

Comments
 (0)