Skip to content

Commit

Permalink
Upgrade to latest Zig master
Browse files Browse the repository at this point in the history
  • Loading branch information
cryptocode committed Jun 29, 2024
1 parent 6911f36 commit c7821d9
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ Resoures can be anything, such as scripts, images, text, templates config files
* An image in your own format that's able to display itself when executed

## Building the project
*Last tested with Zig version 0.12.0-dev.3161+377ecc6af*
To build with Zig 0.13, use the `zig-<version>` tag/release.
To build with Zig master, use the main branch (last tested with Zig 0.14.0-dev.130+cb308ba3a)

`zig build` will put a `bin` and `lib` directory in your output folder (e.g. zig-out)

Expand Down
6 changes: 3 additions & 3 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pub fn build(b: *std.Build) void {

const lib = b.addStaticLibrary(.{
.name = "stitch",
.root_source_file = .{ .path = "src/lib.zig" },
.root_source_file = b.path("src/lib.zig"),
.target = target,
.optimize = optimize,
});
Expand All @@ -18,7 +18,7 @@ pub fn build(b: *std.Build) void {

const exe = b.addExecutable(.{
.name = "stitch",
.root_source_file = .{ .path = "src/main.zig" },
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
});
Expand All @@ -34,7 +34,7 @@ pub fn build(b: *std.Build) void {

// Creates a step for unit testing.
const main_tests = b.addTest(.{
.root_source_file = .{ .path = "src/tests.zig" },
.root_source_file = b.path("src/tests.zig"),
.target = target,
.optimize = optimize,
});
Expand Down
4 changes: 2 additions & 2 deletions src/lib.zig
Original file line number Diff line number Diff line change
Expand Up @@ -686,9 +686,9 @@ pub fn testTeardown() void {
// Create a cryptographically unique filename; mostly useful for test purposes
pub fn generateUniqueFileName(allocator: std.mem.Allocator) ![]const u8 {
var output: [16]u8 = undefined;
var secret_seed: [std.rand.DefaultCsprng.secret_seed_length]u8 = undefined;
var secret_seed: [std.Random.DefaultCsprng.secret_seed_length]u8 = undefined;
std.crypto.random.bytes(&secret_seed);
var csprng = std.rand.DefaultCsprng.init(secret_seed);
var csprng = std.Random.DefaultCsprng.init(secret_seed);
const random = csprng.random();
random.bytes(&output);

Expand Down
2 changes: 1 addition & 1 deletion src/main.zig
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ pub const Cmdline = struct {
}
} else {
// The filename is stored in the index, so it can be found by name. By using name=path, an alternative name can be given
var it = std.mem.split(u8, arg, "=");
var it = std.mem.splitScalar(u8, arg, '=');
var name = it.next();
const second = it.next();
const path = if (second != null) second.? else name.?;
Expand Down

0 comments on commit c7821d9

Please sign in to comment.