authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-09-12 17:16:05 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-09-12 17:16:05 -07:00
log6b617fc40eb889d5138ab3c00a1f79db7f15385b
tree92129ccbf63449d47376a2ff46c1948d4f2b4d75
parentd95ed8783ba83aa072eb8d6d336b94c7e8167a6d

allow alloc results to be non const and let caller coerce


1 files changed, 2 insertions(+), 2 deletions(-)

src/lib.zig+2-2
...@@ -34,7 +34,7 @@ pub fn addSentinel(alloc: *std.mem.Allocator, comptime T: type, input: []const T...@@ -34,7 +34,7 @@ pub fn addSentinel(alloc: *std.mem.Allocator, comptime T: type, input: []const T
3434
35const alphabet = "0123456789abcdefghijklmnopqrstuvwxyz";35const alphabet = "0123456789abcdefghijklmnopqrstuvwxyz";
3636
37pub fn randomSlice(alloc: *std.mem.Allocator, rand: *std.rand.Random, comptime T: type, len: usize) ![]const T {37pub fn randomSlice(alloc: *std.mem.Allocator, rand: *std.rand.Random, comptime T: type, len: usize) ![]T {
38 var buf = try alloc.alloc(T, len);38 var buf = try alloc.alloc(T, len);
39 var i: usize = 0;39 var i: usize = 0;
40 while (i < len) : (i += 1) {40 while (i < len) : (i += 1) {
...@@ -56,7 +56,7 @@ pub fn base64EncodeAlloc(alloc: *std.mem.Allocator, input: string) !string {...@@ -56,7 +56,7 @@ pub fn base64EncodeAlloc(alloc: *std.mem.Allocator, input: string) !string {
56 return base64.encode(buf, input);56 return base64.encode(buf, input);
57}57}
5858
59pub fn asciiUpper(alloc: *std.mem.Allocator, input: string) !string {59pub fn asciiUpper(alloc: *std.mem.Allocator, input: string) ![]u8 {
60 var buf = try alloc.dupe(u8, input);60 var buf = try alloc.dupe(u8, input);
61 for (range(buf.len)) |_, i| {61 for (range(buf.len)) |_, i| {
62 buf[i] = std.ascii.toUpper(buf[i]);62 buf[i] = std.ascii.toUpper(buf[i]);