authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-06-07 03:30:37 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-06-07 03:30:37 -07:00
log8c0bd9996d16c7a625eab9ce3ca93714802d472d
treeb380fef679232b2b045b82fb19984528377a6801
parentfcd70831ae5913e52ccc87149bcc99859eb0e81d

use const arrays everywhere for more immutability


5 files changed, 20 insertions(+), 20 deletions(-)

src/util/dep.zig+5-5
......@@ -18,11 +18,11 @@ pub const Dep = struct {
1818 name: []const u8,
1919 main: []const u8,
2020 version: []const u8,
21 c_include_dirs: [][]const u8,
22 c_source_flags: [][]const u8,
23 c_source_files: [][]const u8,
24 only_os: [][]const u8,
25 except_os: [][]const u8,
21 c_include_dirs: []const []const u8,
22 c_source_flags: []const []const u8,
23 c_source_files: []const []const u8,
24 only_os: []const []const u8,
25 except_os: []const []const u8,
2626 yaml: ?yaml.Mapping,
2727
2828 pub fn clean_path(self: Dep) ![]const u8 {
src/util/funcs.zig+1-1
......@@ -123,7 +123,7 @@ pub fn print_all(w: std.fs.File.Writer, items: anytype, ln: bool) !void {
123123 }
124124}
125125
126pub fn list_contains(haystack: [][]const u8, needle: []const u8) bool {
126pub fn list_contains(haystack: []const []const u8, needle: []const u8) bool {
127127 for (haystack) |item| {
128128 if (std.mem.eql(u8, item, needle)) {
129129 return true;
src/util/modfile.zig+5-5
......@@ -17,14 +17,14 @@ pub const ModFile = struct {
1717 id: []const u8,
1818 name: []const u8,
1919 main: []const u8,
20 c_include_dirs: [][]const u8,
21 c_source_flags: [][]const u8,
22 c_source_files: [][]const u8,
20 c_include_dirs: []const []const u8,
21 c_source_flags: []const []const u8,
22 c_source_files: []const []const u8,
2323 deps: []const u.Dep,
2424 yaml: yaml.Mapping,
2525 devdeps: []const u.Dep,
26 root_files: [][]const u8,
27 files: [][]const u8,
26 root_files: []const []const u8,
27 files: []const []const u8,
2828
2929 pub fn init(alloc: *std.mem.Allocator, fpath: []const u8) !Self {
3030 //
src/util/module.zig+5-5
......@@ -13,11 +13,11 @@ pub const Module = struct {
1313 id: []const u8,
1414 name: []const u8,
1515 main: []const u8,
16 c_include_dirs: [][]const u8,
17 c_source_flags: [][]const u8,
18 c_source_files: [][]const u8,
19 only_os: [][]const u8,
20 except_os: [][]const u8,
16 c_include_dirs: []const []const u8,
17 c_source_flags: []const []const u8,
18 c_source_files: []const []const u8,
19 only_os: []const []const u8,
20 except_os: []const []const u8,
2121 yaml: ?yaml.Mapping,
2222
2323 deps: []Module,
src/util/yaml.zig+4-4
......@@ -8,7 +8,7 @@ const u = @import("./index.zig");
88//
99//
1010
11const Array = [][]const u8;
11const Array = []const []const u8;
1212
1313pub const Document = struct {
1414 mapping: Mapping,
......@@ -18,7 +18,7 @@ pub const Item = union(enum) {
1818 event: c.yaml_event_t,
1919 kv: Key,
2020 mapping: Mapping,
21 sequence: []Item,
21 sequence: []const Item,
2222 document: Document,
2323 string: []const u8,
2424
......@@ -54,7 +54,7 @@ pub const Key = struct {
5454pub const Value = union(enum) {
5555 string: []const u8,
5656 mapping: Mapping,
57 sequence: []Item,
57 sequence: []const Item,
5858
5959 pub fn format(self: Value, comptime fmt: []const u8, options: std.fmt.FormatOptions, writer: anytype) @TypeOf(writer).Error!void {
6060 try writer.writeAll("Value{");
......@@ -78,7 +78,7 @@ pub const Value = union(enum) {
7878};
7979
8080pub const Mapping = struct {
81 items: []Key,
81 items: []const Key,
8282
8383 pub fn get(self: Mapping, k: []const u8) ?Value {
8484 for (self.items) |item| {