summaryrefslogtreecommitdiff
path: root/src/Normalize.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/Normalize.zig')
-rw-r--r--src/Normalize.zig10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/Normalize.zig b/src/Normalize.zig
index 1e9878b..7b87406 100644
--- a/src/Normalize.zig
+++ b/src/Normalize.zig
@@ -221,11 +221,11 @@ test "decompose" {
221 221
222/// Returned from various functions in this namespace. Remember to call `deinit` to free any allocated memory. 222/// Returned from various functions in this namespace. Remember to call `deinit` to free any allocated memory.
223pub const Result = struct { 223pub const Result = struct {
224 allocator: ?mem.Allocator = null, 224 allocated: bool = false,
225 slice: []const u8, 225 slice: []const u8,
226 226
227 pub fn deinit(self: *const Result) void { 227 pub fn deinit(self: *const Result, allocator: mem.Allocator) void {
228 if (self.allocator) |allocator| allocator.free(self.slice); 228 if (self.allocated) allocator.free(self.slice);
229 } 229 }
230}; 230};
231 231
@@ -291,7 +291,7 @@ fn nfxd(self: Self, allocator: mem.Allocator, str: []const u8, form: Form) mem.A
291 try dstr_list.appendSlice(buf[0..len]); 291 try dstr_list.appendSlice(buf[0..len]);
292 } 292 }
293 293
294 return Result{ .allocator = allocator, .slice = try dstr_list.toOwnedSlice() }; 294 return Result{ .allocated = true, .slice = try dstr_list.toOwnedSlice() };
295} 295}
296 296
297test "nfd ASCII / no-alloc" { 297test "nfd ASCII / no-alloc" {
@@ -528,7 +528,7 @@ fn nfxc(self: Self, allocator: mem.Allocator, str: []const u8, form: Form) mem.A
528 try cstr_list.appendSlice(buf[0..len]); 528 try cstr_list.appendSlice(buf[0..len]);
529 } 529 }
530 530
531 return Result{ .allocator = allocator, .slice = try cstr_list.toOwnedSlice() }; 531 return Result{ .allocated = true, .slice = try cstr_list.toOwnedSlice() };
532 } 532 }
533 } 533 }
534} 534}