Compare commits

..

No commits in common. "e41f98b389539c8bc6b1a231d25e2980318e5ef4" and "dafc69726ffbe13213cc31891455f046c9a9a430" have entirely different histories.

3 changed files with 5 additions and 24 deletions

View file

@ -20,11 +20,6 @@ const MapShape = smt.MapShape;
// manifest file 21k currently, but unbounded // manifest file 21k currently, but unbounded
var manifest_buf: [1024 * 32]u8 = undefined; var manifest_buf: [1024 * 32]u8 = undefined;
const next_version_str = "0.16.0-dev.164+bc7955306";
const next_version = std.SemanticVersion.parse(next_version_str) catch unreachable;
const zig_version = @import("builtin").zig_version;
const is_next = zig_version.order(next_version) == .eq or zig_version.order(next_version) == .gt;
pub fn main() anyerror!void { pub fn main() anyerror!void {
const root_progress_node = std.Progress.start(.{}); const root_progress_node = std.Progress.start(.{});
defer root_progress_node.end(); defer root_progress_node.end();
@ -119,16 +114,8 @@ fn processDirectories(models_dir: std.fs.Dir, output_dir: std.fs.Dir, parent_pro
try thread_pool.init(.{ .allocator = allocator }); try thread_pool.init(.{ .allocator = allocator });
defer thread_pool.deinit(); defer thread_pool.deinit();
const count, var calculated_manifest = const count, var calculated_manifest = try calculateDigests(models_dir, output_dir, &thread_pool);
try calculateDigests( const output_stored_manifest = output_dir.readFileAlloc(allocator, "output_manifest.json", std.math.maxInt(usize)) catch null;
models_dir,
output_dir,
&thread_pool,
);
const output_stored_manifest = if (is_next)
output_dir.readFileAlloc("output_manifest.json", allocator, .unlimited) catch null
else
output_dir.readFileAlloc(allocator, "output_manifest.json", std.math.maxInt(usize)) catch null;
if (output_stored_manifest) |o| { if (output_stored_manifest) |o| {
// we have a stored manifest. Parse it and compare to our calculations // we have a stored manifest. Parse it and compare to our calculations
// we can leak as we're using an arena allocator // we can leak as we're using an arena allocator
@ -400,10 +387,7 @@ fn generateServices(
file: std.fs.File, file: std.fs.File,
writer: *std.Io.Writer, writer: *std.Io.Writer,
) ![][]const u8 { ) ![][]const u8 {
var fbuf: [1024]u8 = undefined; const json = try file.readToEndAlloc(allocator, 1024 * 1024 * 1024);
var freader = file.reader(&fbuf);
var reader = &freader.interface;
const json = try reader.allocRemaining(allocator, .limited(1024 * 1024 * 1024));
defer allocator.free(json); defer allocator.free(json);
const model = try smithy.parse(allocator, json); const model = try smithy.parse(allocator, json);
defer model.deinit(); defer model.deinit();

View file

@ -463,10 +463,7 @@ const PartialCredentials = struct {
}; };
fn credsForFile(allocator: std.mem.Allocator, file: ?std.fs.File, profile: []const u8) !PartialCredentials { fn credsForFile(allocator: std.mem.Allocator, file: ?std.fs.File, profile: []const u8) !PartialCredentials {
if (file == null) return PartialCredentials{}; if (file == null) return PartialCredentials{};
var fbuf: [1024]u8 = undefined; const text = try file.?.readToEndAlloc(allocator, std.math.maxInt(usize));
var freader = file.?.reader(&fbuf);
var reader = &freader.interface;
const text = try reader.allocRemaining(allocator, .unlimited);
defer allocator.free(text); defer allocator.free(text);
const partial_creds = try credsForText(text, profile); const partial_creds = try credsForText(text, profile);
var ak: ?[]const u8 = null; var ak: ?[]const u8 = null;

View file

@ -382,7 +382,7 @@ const TestSetup = struct {
self.request_actuals = acts; self.request_actuals = acts;
return acts.request.*; return acts.request.*;
} }
fn sendBodyComplete(self_ptr: usize, body: []u8) std.Io.Writer.Error!void { fn sendBodyComplete(self_ptr: usize, body: []u8) std.io.Writer.Error!void {
const self: *Self = @ptrFromInt(self_ptr); const self: *Self = @ptrFromInt(self_ptr);
if (self.request_actuals == null) return error.WriteFailed; // invalid state - must be called after request if (self.request_actuals == null) return error.WriteFailed; // invalid state - must be called after request
self.request_actuals.?.body = self.allocator.dupe(u8, body) catch return error.WriteFailed; self.request_actuals.?.body = self.allocator.dupe(u8, body) catch return error.WriteFailed;