abouttreesummaryrefslogcommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.zig6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/main.zig b/src/main.zig
index 2f7fd4c..7fe3b63 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -97,8 +97,8 @@ fn parse_enum(comptime E: type, buf: []const u8, base: u8) !E {
}
// https://developer.mozilla.org/en-US/docs/Glossary/Percent-encoding
-fn reencode(text: []const u8) !PostText {
- var result = try PostText.init(0);
+fn reencode(comptime T: type, text: []const u8) !T {
+ var result = try T.init(0);
const len = @min(text.len, 1024); // TODO: PostText length
@@ -286,7 +286,7 @@ const Chirp = struct {
const posts = try Db.posts(txn);
post_id = try db.Prng.gen(posts.dbi, PostId);
- const decoded_text = try reencode(text);
+ const decoded_text = try reencode(PostText, text);
try posts.put(post_id, Post{
.id = post_id,
.parent_id = parent_id,