aboutsummaryrefslogtreecommitdiff
path: root/lib/std
diff options
context:
space:
mode:
authorRyan Liptak <squeek502@hotmail.com>2021-11-01 00:56:55 -0700
committerRyan Liptak <squeek502@hotmail.com>2021-11-01 00:57:33 -0700
commita34375814106dbc0e0181bca7cc4ffb1821cb51e (patch)
treed618f9b7216623a8ad9b415f29dc4c9f0d6bd155 /lib/std
parentf49d42729a22846ec54b6610db415ac8cdaa31db (diff)
downloadzig-a34375814106dbc0e0181bca7cc4ffb1821cb51e.tar.gz
zig-a34375814106dbc0e0181bca7cc4ffb1821cb51e.zip
Update ensureTotalCapacity to ensureTotalCapacityPrecise where it makes sense
These calls are all late-initialization of ArrayList's that were initialized outside the current scope. This allows us to still get the potential memory-saving benefits of the 'precision' of initCapacity.
Diffstat (limited to 'lib/std')
-rw-r--r--lib/std/coff.zig4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/std/coff.zig b/lib/std/coff.zig
index c3823f6c53..961cd8ade6 100644
--- a/lib/std/coff.zig
+++ b/lib/std/coff.zig
@@ -276,7 +276,7 @@ pub const Coff = struct {
if (self.sections.items.len == self.coff_header.number_of_sections)
return;
- try self.sections.ensureTotalCapacity(self.coff_header.number_of_sections);
+ try self.sections.ensureTotalCapacityPrecise(self.coff_header.number_of_sections);
const in = self.in_file.reader();
@@ -297,7 +297,7 @@ pub const Coff = struct {
std.mem.set(u8, name[8..], 0);
}
- try self.sections.append(Section{
+ self.sections.appendAssumeCapacity(Section{
.header = SectionHeader{
.name = name,
.misc = SectionHeader.Misc{ .virtual_size = try in.readIntLittle(u32) },