authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2025-03-22 02:48:18 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2025-03-22 02:48:18 -07:00
log973902fd31de48462cb7241c1d2d65ce872bb903
treee299375b3329b73b66f44af0ec79e89d206a640d
parent4489a2ed0b3f90e962527eaf9ac9c0203a99094a

prefer splitScalar


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

yaml.zig+3-3
...@@ -211,7 +211,7 @@ pub fn parse(alloc: std.mem.Allocator, input: string) !Document {...@@ -211,7 +211,7 @@ pub fn parse(alloc: std.mem.Allocator, input: string) !Document {
211 _ = c.yaml_parser_initialize(&parser);211 _ = c.yaml_parser_initialize(&parser);
212 defer c.yaml_parser_delete(&parser);212 defer c.yaml_parser_delete(&parser);
213213
214 const lines = try split(alloc, input, "\n");214 const lines = try split(alloc, input, '\n');
215 defer alloc.free(lines);215 defer alloc.free(lines);
216216
217 _ = c.yaml_parser_set_input_string(&parser, input.ptr, input.len);217 _ = c.yaml_parser_set_input_string(&parser, input.ptr, input.len);
...@@ -381,11 +381,11 @@ fn get_event_string(event: Token, p: *const Parser) !string {...@@ -381,11 +381,11 @@ fn get_event_string(event: Token, p: *const Parser) !string {
381//381//
382//382//
383383
384fn split(alloc: std.mem.Allocator, in: string, delim: string) ![]string {384fn split(alloc: std.mem.Allocator, in: string, delim: u8) ![]string {
385 var list = std.ArrayList(string).init(alloc);385 var list = std.ArrayList(string).init(alloc);
386 errdefer list.deinit();386 errdefer list.deinit();
387387
388 var iter = std.mem.split(u8, in, delim);388 var iter = std.mem.splitScalar(u8, in, delim);
389 while (iter.next()) |str| {389 while (iter.next()) |str| {
390 try list.append(str);390 try list.append(str);
391 }391 }