| author | |
| committer | |
| log | 7a28c644aa8eb3d27dee113338af8278f8f6334f |
| tree | de1a483b9d9fa9224a50c94522da6bb3308b016c |
| parent | d3ab0eb28de5a5a94fd4ef988dd4c4b0e3ddf927 |
18 files changed, 58 insertions(+), 59 deletions(-)
lib/std/build.zig+2-2| ... | ... | @@ -1779,7 +1779,7 @@ pub const LibExeObjStep = struct { |
| 1779 | 1779 | const self = @fieldParentPtr(LibExeObjStep, "step", step); |
| 1780 | 1780 | const builder = self.builder; |
| 1781 | 1781 | |
| 1782 | if (self.root_src == null and self.link_objects.len == 0) { | |
| 1782 | if (self.root_src == null and self.link_objects.items.len == 0) { | |
| 1783 | 1783 | warn("{}: linker needs 1 or more objects to link\n", .{self.step.name}); |
| 1784 | 1784 | return error.NeedAnObject; |
| 1785 | 1785 | } |
| ... | ... | @@ -1847,7 +1847,7 @@ pub const LibExeObjStep = struct { |
| 1847 | 1847 | } |
| 1848 | 1848 | } |
| 1849 | 1849 | |
| 1850 | if (self.build_options_contents.len > 0) { | |
| 1850 | if (self.build_options_contents.items.len > 0) { | |
| 1851 | 1851 | const build_options_file = try fs.path.join( |
| 1852 | 1852 | builder.allocator, |
| 1853 | 1853 | &[_][]const u8{ builder.cache_root, builder.fmt("{}_build_options.zig", .{self.name}) }, |
lib/std/build/emit_raw.zig+1-1| ... | ... | @@ -94,7 +94,7 @@ const BinaryElfOutput = struct { |
| 94 | 94 | |
| 95 | 95 | sort.sort(*BinaryElfSegment, self.segments.span(), segmentSortCompare); |
| 96 | 96 | |
| 97 | if (self.segments.len > 0) { | |
| 97 | if (self.segments.items.len > 0) { | |
| 98 | 98 | const firstSegment = self.segments.at(0); |
| 99 | 99 | if (firstSegment.firstSection) |firstSection| { |
| 100 | 100 | const diff = firstSection.elfOffset - firstSegment.elfOffset; |
lib/std/coff.zig+1-1| ... | ... | @@ -181,7 +181,7 @@ pub const Coff = struct { |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | pub fn loadSections(self: *Coff) !void { |
| 184 | if (self.sections.len == self.coff_header.number_of_sections) | |
| 184 | if (self.sections.items.len == self.coff_header.number_of_sections) | |
| 185 | 185 | return; |
| 186 | 186 | |
| 187 | 187 | try self.sections.ensureCapacity(self.coff_header.number_of_sections); |
lib/std/debug.zig+1-1| ... | ... | @@ -1478,7 +1478,7 @@ pub const ModuleDebugInfo = switch (builtin.os.tag) { |
| 1478 | 1478 | |
| 1479 | 1479 | var coff_section: *coff.Section = undefined; |
| 1480 | 1480 | const mod_index = for (self.sect_contribs) |sect_contrib| { |
| 1481 | if (sect_contrib.Section > self.coff.sections.len) continue; | |
| 1481 | if (sect_contrib.Section > self.coff.sections.items.len) continue; | |
| 1482 | 1482 | // Remember that SectionContribEntry.Section is 1-based. |
| 1483 | 1483 | coff_section = &self.coff.sections.span()[sect_contrib.Section - 1]; |
| 1484 | 1484 |
lib/std/fs.zig+3-3| ... | ... | @@ -1440,9 +1440,9 @@ pub const Walker = struct { |
| 1440 | 1440 | /// a reference to the path. |
| 1441 | 1441 | pub fn next(self: *Walker) !?Entry { |
| 1442 | 1442 | while (true) { |
| 1443 | if (self.stack.len == 0) return null; | |
| 1443 | if (self.stack.items.len == 0) return null; | |
| 1444 | 1444 | // `top` becomes invalid after appending to `self.stack`. |
| 1445 | const top = &self.stack.span()[self.stack.len - 1]; | |
| 1445 | const top = &self.stack.span()[self.stack.items.len - 1]; | |
| 1446 | 1446 | const dirname_len = top.dirname_len; |
| 1447 | 1447 | if (try top.dir_it.next()) |base| { |
| 1448 | 1448 | self.name_buffer.shrink(dirname_len); |
| ... | ... | @@ -1457,7 +1457,7 @@ pub const Walker = struct { |
| 1457 | 1457 | errdefer new_dir.close(); |
| 1458 | 1458 | try self.stack.append(StackItem{ |
| 1459 | 1459 | .dir_it = new_dir.iterate(), |
| 1460 | .dirname_len = self.name_buffer.len, | |
| 1460 | .dirname_len = self.name_buffer.items.len, | |
| 1461 | 1461 | }); |
| 1462 | 1462 | } |
| 1463 | 1463 | } |
lib/std/http/headers.zig+12-12| ... | ... | @@ -139,7 +139,7 @@ pub const Headers = struct { |
| 139 | 139 | pub fn clone(self: Self, allocator: *Allocator) !Self { |
| 140 | 140 | var other = Headers.init(allocator); |
| 141 | 141 | errdefer other.deinit(); |
| 142 | try other.data.ensureCapacity(self.data.len); | |
| 142 | try other.data.ensureCapacity(self.data.items.len); | |
| 143 | 143 | try other.index.initCapacity(self.index.entries.len); |
| 144 | 144 | for (self.data.span()) |entry| { |
| 145 | 145 | try other.append(entry.name, entry.value, entry.never_index); |
| ... | ... | @@ -152,7 +152,7 @@ pub const Headers = struct { |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | pub fn append(self: *Self, name: []const u8, value: []const u8, never_index: ?bool) !void { |
| 155 | const n = self.data.len + 1; | |
| 155 | const n = self.data.items.len + 1; | |
| 156 | 156 | try self.data.ensureCapacity(n); |
| 157 | 157 | var entry: HeaderEntry = undefined; |
| 158 | 158 | if (self.index.get(name)) |kv| { |
| ... | ... | @@ -197,7 +197,7 @@ pub const Headers = struct { |
| 197 | 197 | if (self.index.remove(name)) |kv| { |
| 198 | 198 | var dex = &kv.value; |
| 199 | 199 | // iterate backwards |
| 200 | var i = dex.len; | |
| 200 | var i = dex.items.len; | |
| 201 | 201 | while (i > 0) { |
| 202 | 202 | i -= 1; |
| 203 | 203 | const data_index = dex.at(i); |
| ... | ... | @@ -220,18 +220,18 @@ pub const Headers = struct { |
| 220 | 220 | const removed = self.data.orderedRemove(i); |
| 221 | 221 | const kv = self.index.get(removed.name).?; |
| 222 | 222 | var dex = &kv.value; |
| 223 | if (dex.len == 1) { | |
| 223 | if (dex.items.len == 1) { | |
| 224 | 224 | // was last item; delete the index |
| 225 | 225 | _ = self.index.remove(kv.key); |
| 226 | 226 | dex.deinit(); |
| 227 | 227 | removed.deinit(); |
| 228 | 228 | self.allocator.free(kv.key); |
| 229 | 229 | } else { |
| 230 | dex.shrink(dex.len - 1); | |
| 230 | dex.shrink(dex.items.len - 1); | |
| 231 | 231 | removed.deinit(); |
| 232 | 232 | } |
| 233 | 233 | // if it was the last item; no need to rebuild index |
| 234 | if (i != self.data.len) { | |
| 234 | if (i != self.data.items.len) { | |
| 235 | 235 | self.rebuild_index(); |
| 236 | 236 | } |
| 237 | 237 | } |
| ... | ... | @@ -242,18 +242,18 @@ pub const Headers = struct { |
| 242 | 242 | const removed = self.data.swapRemove(i); |
| 243 | 243 | const kv = self.index.get(removed.name).?; |
| 244 | 244 | var dex = &kv.value; |
| 245 | if (dex.len == 1) { | |
| 245 | if (dex.items.len == 1) { | |
| 246 | 246 | // was last item; delete the index |
| 247 | 247 | _ = self.index.remove(kv.key); |
| 248 | 248 | dex.deinit(); |
| 249 | 249 | removed.deinit(); |
| 250 | 250 | self.allocator.free(kv.key); |
| 251 | 251 | } else { |
| 252 | dex.shrink(dex.len - 1); | |
| 252 | dex.shrink(dex.items.len - 1); | |
| 253 | 253 | removed.deinit(); |
| 254 | 254 | } |
| 255 | 255 | // if it was the last item; no need to rebuild index |
| 256 | if (i != self.data.len) { | |
| 256 | if (i != self.data.items.len) { | |
| 257 | 257 | self.rebuild_index(); |
| 258 | 258 | } |
| 259 | 259 | } |
| ... | ... | @@ -277,7 +277,7 @@ pub const Headers = struct { |
| 277 | 277 | pub fn get(self: Self, allocator: *Allocator, name: []const u8) !?[]const HeaderEntry { |
| 278 | 278 | const dex = self.getIndices(name) orelse return null; |
| 279 | 279 | |
| 280 | const buf = try allocator.alloc(HeaderEntry, dex.len); | |
| 280 | const buf = try allocator.alloc(HeaderEntry, dex.items.len); | |
| 281 | 281 | var n: usize = 0; |
| 282 | 282 | for (dex.span()) |idx| { |
| 283 | 283 | buf[n] = self.data.at(idx); |
| ... | ... | @@ -301,7 +301,7 @@ pub const Headers = struct { |
| 301 | 301 | |
| 302 | 302 | // adapted from mem.join |
| 303 | 303 | const total_len = blk: { |
| 304 | var sum: usize = dex.len - 1; // space for separator(s) | |
| 304 | var sum: usize = dex.items.len - 1; // space for separator(s) | |
| 305 | 305 | for (dex.span()) |idx| |
| 306 | 306 | sum += self.data.at(idx).value.len; |
| 307 | 307 | break :blk sum; |
| ... | ... | @@ -330,7 +330,7 @@ pub const Headers = struct { |
| 330 | 330 | var it = self.index.iterator(); |
| 331 | 331 | while (it.next()) |kv| { |
| 332 | 332 | var dex = &kv.value; |
| 333 | dex.len = 0; // keeps capacity available | |
| 333 | dex.items.len = 0; // keeps capacity available | |
| 334 | 334 | } |
| 335 | 335 | } |
| 336 | 336 | { // fill up indexes again; we know capacity is fine from before |
lib/std/io/in_stream.zig+1-1| ... | ... | @@ -54,7 +54,7 @@ pub fn InStream( |
| 54 | 54 | /// and the `std.ArrayList` has exactly `max_append_size` bytes appended. |
| 55 | 55 | pub fn readAllArrayList(self: Self, array_list: *std.ArrayList(u8), max_append_size: usize) !void { |
| 56 | 56 | try array_list.ensureCapacity(math.min(max_append_size, 4096)); |
| 57 | const original_len = array_list.len; | |
| 57 | const original_len = array_list.items.len; | |
| 58 | 58 | var start_index: usize = original_len; |
| 59 | 59 | while (true) { |
| 60 | 60 | array_list.expandToCapacity(); |
lib/std/json.zig+10-10| ... | ... | @@ -1556,7 +1556,7 @@ fn parseInternal(comptime T: type, token: Token, tokens: *TokenStream, options: |
| 1556 | 1556 | else => {}, |
| 1557 | 1557 | } |
| 1558 | 1558 | |
| 1559 | try arraylist.ensureCapacity(arraylist.len + 1); | |
| 1559 | try arraylist.ensureCapacity(arraylist.items.len + 1); | |
| 1560 | 1560 | const v = try parseInternal(ptrInfo.child, tok, tokens, options); |
| 1561 | 1561 | arraylist.appendAssumeCapacity(v); |
| 1562 | 1562 | } |
| ... | ... | @@ -1874,7 +1874,7 @@ pub const Parser = struct { |
| 1874 | 1874 | try p.transition(&arena.allocator, input, s.i - 1, token); |
| 1875 | 1875 | } |
| 1876 | 1876 | |
| 1877 | debug.assert(p.stack.len == 1); | |
| 1877 | debug.assert(p.stack.items.len == 1); | |
| 1878 | 1878 | |
| 1879 | 1879 | return ValueTree{ |
| 1880 | 1880 | .arena = arena, |
| ... | ... | @@ -1888,7 +1888,7 @@ pub const Parser = struct { |
| 1888 | 1888 | switch (p.state) { |
| 1889 | 1889 | .ObjectKey => switch (token) { |
| 1890 | 1890 | .ObjectEnd => { |
| 1891 | if (p.stack.len == 1) { | |
| 1891 | if (p.stack.items.len == 1) { | |
| 1892 | 1892 | return; |
| 1893 | 1893 | } |
| 1894 | 1894 | |
| ... | ... | @@ -1907,8 +1907,8 @@ pub const Parser = struct { |
| 1907 | 1907 | }, |
| 1908 | 1908 | }, |
| 1909 | 1909 | .ObjectValue => { |
| 1910 | var object = &p.stack.items[p.stack.len - 2].Object; | |
| 1911 | var key = p.stack.items[p.stack.len - 1].String; | |
| 1910 | var object = &p.stack.items[p.stack.items.len - 2].Object; | |
| 1911 | var key = p.stack.items[p.stack.items.len - 1].String; | |
| 1912 | 1912 | |
| 1913 | 1913 | switch (token) { |
| 1914 | 1914 | .ObjectBegin => { |
| ... | ... | @@ -1950,11 +1950,11 @@ pub const Parser = struct { |
| 1950 | 1950 | } |
| 1951 | 1951 | }, |
| 1952 | 1952 | .ArrayValue => { |
| 1953 | var array = &p.stack.items[p.stack.len - 1].Array; | |
| 1953 | var array = &p.stack.items[p.stack.items.len - 1].Array; | |
| 1954 | 1954 | |
| 1955 | 1955 | switch (token) { |
| 1956 | 1956 | .ArrayEnd => { |
| 1957 | if (p.stack.len == 1) { | |
| 1957 | if (p.stack.items.len == 1) { | |
| 1958 | 1958 | return; |
| 1959 | 1959 | } |
| 1960 | 1960 | |
| ... | ... | @@ -2021,12 +2021,12 @@ pub const Parser = struct { |
| 2021 | 2021 | } |
| 2022 | 2022 | |
| 2023 | 2023 | fn pushToParent(p: *Parser, value: *const Value) !void { |
| 2024 | switch (p.stack.span()[p.stack.len - 1]) { | |
| 2024 | switch (p.stack.span()[p.stack.items.len - 1]) { | |
| 2025 | 2025 | // Object Parent -> [ ..., object, <key>, value ] |
| 2026 | 2026 | Value.String => |key| { |
| 2027 | 2027 | _ = p.stack.pop(); |
| 2028 | 2028 | |
| 2029 | var object = &p.stack.items[p.stack.len - 1].Object; | |
| 2029 | var object = &p.stack.items[p.stack.items.len - 1].Object; | |
| 2030 | 2030 | _ = try object.put(key, value.*); |
| 2031 | 2031 | p.state = .ObjectKey; |
| 2032 | 2032 | }, |
| ... | ... | @@ -2165,7 +2165,7 @@ test "json.parser.dynamic" { |
| 2165 | 2165 | testing.expect(animated.Bool == false); |
| 2166 | 2166 | |
| 2167 | 2167 | const array_of_object = image.Object.get("ArrayOfObject").?.value; |
| 2168 | testing.expect(array_of_object.Array.len == 1); | |
| 2168 | testing.expect(array_of_object.Array.items.len == 1); | |
| 2169 | 2169 | |
| 2170 | 2170 | const obj0 = array_of_object.Array.at(0).Object.get("n").?.value; |
| 2171 | 2171 | testing.expect(mem.eql(u8, obj0.String, "m")); |
lib/std/math/big/rational.zig-1| ... | ... | @@ -4,7 +4,6 @@ const math = std.math; |
| 4 | 4 | const mem = std.mem; |
| 5 | 5 | const testing = std.testing; |
| 6 | 6 | const Allocator = mem.Allocator; |
| 7 | const ArrayList = std.ArrayList; | |
| 8 | 7 | |
| 9 | 8 | const bn = @import("int.zig"); |
| 10 | 9 | const Limb = bn.Limb; |
lib/std/net.zig+8-8| ... | ... | @@ -509,7 +509,7 @@ pub fn getAddressList(allocator: *mem.Allocator, name: []const u8, port: u16) !* |
| 509 | 509 | |
| 510 | 510 | try linuxLookupName(&lookup_addrs, &canon, name, family, flags, port); |
| 511 | 511 | |
| 512 | result.addrs = try arena.alloc(Address, lookup_addrs.len); | |
| 512 | result.addrs = try arena.alloc(Address, lookup_addrs.items.len); | |
| 513 | 513 | if (!canon.isNull()) { |
| 514 | 514 | result.canon_name = canon.toOwnedSlice(); |
| 515 | 515 | } |
| ... | ... | @@ -554,7 +554,7 @@ fn linuxLookupName( |
| 554 | 554 | return name_err; |
| 555 | 555 | } else { |
| 556 | 556 | try linuxLookupNameFromHosts(addrs, canon, name, family, port); |
| 557 | if (addrs.len == 0) { | |
| 557 | if (addrs.items.len == 0) { | |
| 558 | 558 | try linuxLookupNameFromDnsSearch(addrs, canon, name, family, port); |
| 559 | 559 | } |
| 560 | 560 | } |
| ... | ... | @@ -562,11 +562,11 @@ fn linuxLookupName( |
| 562 | 562 | try canon.resize(0); |
| 563 | 563 | try linuxLookupNameFromNull(addrs, family, flags, port); |
| 564 | 564 | } |
| 565 | if (addrs.len == 0) return error.UnknownHostName; | |
| 565 | if (addrs.items.len == 0) return error.UnknownHostName; | |
| 566 | 566 | |
| 567 | 567 | // No further processing is needed if there are fewer than 2 |
| 568 | 568 | // results or if there are only IPv4 results. |
| 569 | if (addrs.len == 1 or family == os.AF_INET) return; | |
| 569 | if (addrs.items.len == 1 or family == os.AF_INET) return; | |
| 570 | 570 | const all_ip4 = for (addrs.span()) |addr| { |
| 571 | 571 | if (addr.addr.any.family != os.AF_INET) break false; |
| 572 | 572 | } else true; |
| ... | ... | @@ -908,7 +908,7 @@ fn linuxLookupNameFromDnsSearch( |
| 908 | 908 | canon.shrink(canon_name.len + 1); |
| 909 | 909 | try canon.appendSlice(tok); |
| 910 | 910 | try linuxLookupNameFromDns(addrs, canon, canon.span(), family, rc, port); |
| 911 | if (addrs.len != 0) return; | |
| 911 | if (addrs.items.len != 0) return; | |
| 912 | 912 | } |
| 913 | 913 | |
| 914 | 914 | canon.shrink(canon_name.len); |
| ... | ... | @@ -967,7 +967,7 @@ fn linuxLookupNameFromDns( |
| 967 | 967 | dnsParse(ap[i], ctx, dnsParseCallback) catch {}; |
| 968 | 968 | } |
| 969 | 969 | |
| 970 | if (addrs.len != 0) return; | |
| 970 | if (addrs.items.len != 0) return; | |
| 971 | 971 | if (ap[0].len < 4 or (ap[0][3] & 15) == 2) return error.TemporaryNameServerFailure; |
| 972 | 972 | if ((ap[0][3] & 15) == 0) return error.UnknownHostName; |
| 973 | 973 | if ((ap[0][3] & 15) == 3) return; |
| ... | ... | @@ -1049,7 +1049,7 @@ fn getResolvConf(allocator: *mem.Allocator, rc: *ResolvConf) !void { |
| 1049 | 1049 | } |
| 1050 | 1050 | } |
| 1051 | 1051 | |
| 1052 | if (rc.ns.len == 0) { | |
| 1052 | if (rc.ns.items.len == 0) { | |
| 1053 | 1053 | return linuxLookupNameFromNumericUnspec(&rc.ns, "127.0.0.1", 53); |
| 1054 | 1054 | } |
| 1055 | 1055 | } |
| ... | ... | @@ -1078,7 +1078,7 @@ fn resMSendRc( |
| 1078 | 1078 | var ns_list = std.ArrayList(Address).init(rc.ns.allocator); |
| 1079 | 1079 | defer ns_list.deinit(); |
| 1080 | 1080 | |
| 1081 | try ns_list.resize(rc.ns.len); | |
| 1081 | try ns_list.resize(rc.ns.items.len); | |
| 1082 | 1082 | const ns = ns_list.span(); |
| 1083 | 1083 | |
| 1084 | 1084 | for (rc.ns.span()) |iplit, i| { |
lib/std/special/build_runner.zig+1-1| ... | ... | @@ -171,7 +171,7 @@ fn usage(builder: *Builder, already_ran_build: bool, out_stream: var) !void { |
| 171 | 171 | \\ |
| 172 | 172 | ); |
| 173 | 173 | |
| 174 | if (builder.available_options_list.len == 0) { | |
| 174 | if (builder.available_options_list.items.len == 0) { | |
| 175 | 175 | try out_stream.print(" (none)\n", .{}); |
| 176 | 176 | } else { |
| 177 | 177 | for (builder.available_options_list.span()) |option| { |
lib/std/unicode.zig+2-2| ... | ... | @@ -475,7 +475,7 @@ pub fn utf16leToUtf8Alloc(allocator: *mem.Allocator, utf16le: []const u16) ![]u8 |
| 475 | 475 | var it = Utf16LeIterator.init(utf16le); |
| 476 | 476 | while (try it.nextCodepoint()) |codepoint| { |
| 477 | 477 | const utf8_len = utf8CodepointSequenceLength(codepoint) catch unreachable; |
| 478 | try result.resize(result.len + utf8_len); | |
| 478 | try result.resize(result.items.len + utf8_len); | |
| 479 | 479 | assert((utf8Encode(codepoint, result.items[out_index..]) catch unreachable) == utf8_len); |
| 480 | 480 | out_index += utf8_len; |
| 481 | 481 | } |
| ... | ... | @@ -571,7 +571,7 @@ pub fn utf8ToUtf16LeWithNull(allocator: *mem.Allocator, utf8: []const u8) ![:0]u |
| 571 | 571 | } |
| 572 | 572 | } |
| 573 | 573 | |
| 574 | const len = result.len; | |
| 574 | const len = result.items.len; | |
| 575 | 575 | try result.append(0); |
| 576 | 576 | return result.toOwnedSlice()[0..len :0]; |
| 577 | 577 | } |
src-self-hosted/libc_installation.zig+3-3| ... | ... | @@ -268,7 +268,7 @@ pub const LibCInstallation = struct { |
| 268 | 268 | try search_paths.append(line); |
| 269 | 269 | } |
| 270 | 270 | } |
| 271 | if (search_paths.len == 0) { | |
| 271 | if (search_paths.items.len == 0) { | |
| 272 | 272 | return error.CCompilerCannotFindHeaders; |
| 273 | 273 | } |
| 274 | 274 | |
| ... | ... | @@ -276,9 +276,9 @@ pub const LibCInstallation = struct { |
| 276 | 276 | const sys_include_dir_example_file = if (is_windows) "sys\\types.h" else "sys/errno.h"; |
| 277 | 277 | |
| 278 | 278 | var path_i: usize = 0; |
| 279 | while (path_i < search_paths.len) : (path_i += 1) { | |
| 279 | while (path_i < search_paths.items.len) : (path_i += 1) { | |
| 280 | 280 | // search in reverse order |
| 281 | const search_path_untrimmed = search_paths.at(search_paths.len - path_i - 1); | |
| 281 | const search_path_untrimmed = search_paths.at(search_paths.items.len - path_i - 1); | |
| 282 | 282 | const search_path = std.mem.trimLeft(u8, search_path_untrimmed, " "); |
| 283 | 283 | var search_dir = fs.cwd().openDir(search_path, .{}) catch |err| switch (err) { |
| 284 | 284 | error.FileNotFound, |
src-self-hosted/stage2.zig+2-2| ... | ... | @@ -239,7 +239,7 @@ fn fmtMain(argc: c_int, argv: [*]const [*:0]const u8) !void { |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | if (stdin_flag) { |
| 242 | if (input_files.len != 0) { | |
| 242 | if (input_files.items.len != 0) { | |
| 243 | 243 | try stderr.writeAll("cannot use --stdin with positional arguments\n"); |
| 244 | 244 | process.exit(1); |
| 245 | 245 | } |
| ... | ... | @@ -273,7 +273,7 @@ fn fmtMain(argc: c_int, argv: [*]const [*:0]const u8) !void { |
| 273 | 273 | return; |
| 274 | 274 | } |
| 275 | 275 | |
| 276 | if (input_files.len == 0) { | |
| 276 | if (input_files.items.len == 0) { | |
| 277 | 277 | try stderr.writeAll("expected at least one source file argument\n"); |
| 278 | 278 | process.exit(1); |
| 279 | 279 | } |
src-self-hosted/translate_c.zig+3-3| ... | ... | @@ -4309,7 +4309,7 @@ fn makeRestorePoint(c: *Context) RestorePoint { |
| 4309 | 4309 | return RestorePoint{ |
| 4310 | 4310 | .c = c, |
| 4311 | 4311 | .token_index = c.tree.tokens.len, |
| 4312 | .src_buf_index = c.source_buffer.len, | |
| 4312 | .src_buf_index = c.source_buffer.items.len, | |
| 4313 | 4313 | }; |
| 4314 | 4314 | } |
| 4315 | 4315 | |
| ... | ... | @@ -4771,11 +4771,11 @@ fn appendToken(c: *Context, token_id: Token.Id, bytes: []const u8) !ast.TokenInd |
| 4771 | 4771 | |
| 4772 | 4772 | fn appendTokenFmt(c: *Context, token_id: Token.Id, comptime format: []const u8, args: var) !ast.TokenIndex { |
| 4773 | 4773 | assert(token_id != .Invalid); |
| 4774 | const start_index = c.source_buffer.len; | |
| 4774 | const start_index = c.source_buffer.items.len; | |
| 4775 | 4775 | errdefer c.source_buffer.shrink(start_index); |
| 4776 | 4776 | |
| 4777 | 4777 | try c.source_buffer.outStream().print(format, args); |
| 4778 | const end_index = c.source_buffer.len; | |
| 4778 | const end_index = c.source_buffer.items.len; | |
| 4779 | 4779 | const token_index = c.tree.tokens.len; |
| 4780 | 4780 | const new_token = try c.tree.tokens.addOne(); |
| 4781 | 4781 | errdefer c.tree.tokens.shrink(token_index); |
test/standalone/brace_expansion/main.zig+2-2| ... | ... | @@ -113,7 +113,7 @@ fn parse(tokens: *const ArrayList(Token), token_index: *usize) ParseError!Node { |
| 113 | 113 | |
| 114 | 114 | fn expandString(input: []const u8, output: *ArrayListSentineled(u8, 0)) !void { |
| 115 | 115 | const tokens = try tokenize(input); |
| 116 | if (tokens.len == 1) { | |
| 116 | if (tokens.items.len == 1) { | |
| 117 | 117 | return output.resize(0); |
| 118 | 118 | } |
| 119 | 119 | |
| ... | ... | @@ -142,7 +142,7 @@ fn expandString(input: []const u8, output: *ArrayListSentineled(u8, 0)) !void { |
| 142 | 142 | const ExpandNodeError = error{OutOfMemory}; |
| 143 | 143 | |
| 144 | 144 | fn expandNode(node: Node, output: *ArrayList(ArrayListSentineled(u8, 0))) ExpandNodeError!void { |
| 145 | assert(output.len == 0); | |
| 145 | assert(output.items.len == 0); | |
| 146 | 146 | switch (node) { |
| 147 | 147 | Node.Scalar => |scalar| { |
| 148 | 148 | try output.append(try ArrayListSentineled(u8, 0).init(global_allocator, scalar)); |
test/tests.zig+2-2| ... | ... | @@ -864,13 +864,13 @@ pub const CompileErrorContext = struct { |
| 864 | 864 | var err_iter = ErrLineIter.init(stderr); |
| 865 | 865 | var i: usize = 0; |
| 866 | 866 | ok = while (err_iter.next()) |line| : (i += 1) { |
| 867 | if (i >= self.case.expected_errors.len) break false; | |
| 867 | if (i >= self.case.expected_errors.items.len) break false; | |
| 868 | 868 | const expected = self.case.expected_errors.at(i); |
| 869 | 869 | if (mem.indexOf(u8, line, expected) == null) break false; |
| 870 | 870 | continue; |
| 871 | 871 | } else true; |
| 872 | 872 | |
| 873 | ok = ok and i == self.case.expected_errors.len; | |
| 873 | ok = ok and i == self.case.expected_errors.items.len; | |
| 874 | 874 | |
| 875 | 875 | if (!ok) { |
| 876 | 876 | warn("\n======== Expected these compile errors: ========\n", .{}); |
tools/merge_anal_dumps.zig+4-4| ... | ... | @@ -194,7 +194,7 @@ const Dump = struct { |
| 194 | 194 | for (other_files) |other_file, i| { |
| 195 | 195 | const gop = try self.file_map.getOrPut(other_file.String); |
| 196 | 196 | if (!gop.found_existing) { |
| 197 | gop.kv.value = self.file_list.len; | |
| 197 | gop.kv.value = self.file_list.items.len; | |
| 198 | 198 | try self.file_list.append(other_file.String); |
| 199 | 199 | } |
| 200 | 200 | try other_file_to_mine.putNoClobber(i, gop.kv.value); |
| ... | ... | @@ -213,7 +213,7 @@ const Dump = struct { |
| 213 | 213 | }; |
| 214 | 214 | const gop = try self.node_map.getOrPut(other_node); |
| 215 | 215 | if (!gop.found_existing) { |
| 216 | gop.kv.value = self.node_list.len; | |
| 216 | gop.kv.value = self.node_list.items.len; | |
| 217 | 217 | try self.node_list.append(other_node); |
| 218 | 218 | } |
| 219 | 219 | try other_ast_node_to_mine.putNoClobber(i, gop.kv.value); |
| ... | ... | @@ -243,7 +243,7 @@ const Dump = struct { |
| 243 | 243 | }; |
| 244 | 244 | const gop = try self.error_map.getOrPut(other_error); |
| 245 | 245 | if (!gop.found_existing) { |
| 246 | gop.kv.value = self.error_list.len; | |
| 246 | gop.kv.value = self.error_list.items.len; | |
| 247 | 247 | try self.error_list.append(other_error); |
| 248 | 248 | } |
| 249 | 249 | try other_error_to_mine.putNoClobber(i, gop.kv.value); |
| ... | ... | @@ -304,7 +304,7 @@ const Dump = struct { |
| 304 | 304 | ) !void { |
| 305 | 305 | const gop = try self.type_map.getOrPut(other_type); |
| 306 | 306 | if (!gop.found_existing) { |
| 307 | gop.kv.value = self.type_list.len; | |
| 307 | gop.kv.value = self.type_list.items.len; | |
| 308 | 308 | try self.type_list.append(other_type); |
| 309 | 309 | } |
| 310 | 310 | try other_types_to_mine.putNoClobber(other_type_index, gop.kv.value); |