Skip to content

Commit 8bb5aad

Browse files
authored
Merge pull request #12 from lun-4/zig-014
zig 0.14
2 parents 6c6ab63 + f6a69d6 commit 8bb5aad

File tree

5 files changed

+13
-12
lines changed

5 files changed

+13
-12
lines changed

.github/workflows/zig.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
submodules: recursive
1717
- uses: goto-bus-stop/setup-zig@v1
1818
with:
19-
version: 0.13.0
19+
version: 0.14.0
2020
- run: zig build
2121
- run: zig build test
2222
lint:
@@ -27,5 +27,5 @@ jobs:
2727
submodules: recursive
2828
- uses: goto-bus-stop/setup-zig@v1
2929
with:
30-
version: 0.13.0
30+
version: 0.14.0
3131
- run: zig fmt --check build.zig src/*.zig

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
/.zig-cache
2+
/zig-cache
23
/zig-out

build.zig

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@ const std = @import("std");
22
const assert = std.debug.assert;
33

44
pub fn build(b: *std.Build) !void {
5+
const target = b.standardTargetOptions(.{});
6+
const optimize = b.standardOptimizeOption(.{});
7+
58
const genent = b.addExecutable(.{
69
.name = "generate_entities",
710
.root_source_file = b.path("src/generate_entities.zig"),
8-
.target = b.host,
11+
.target = target,
912
});
1013
const genent_step = b.addRunArtifact(genent);
1114
const genent_out = genent_step.addOutputFileArg("entities.zig");
1215

13-
const target = b.standardTargetOptions(.{});
14-
const optimize = b.standardOptimizeOption(.{});
15-
1616
const mod = b.addModule("htmlentities", .{
1717
.root_source_file = b.path("src/main.zig"),
1818
.optimize = optimize,

build.zig.zon

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
.{
2-
.name = "htmlentities.zig",
2+
.name = .htmlentities_zig,
33
.version = "0.1.0",
4-
.minimum_zig_version = "0.12.0",
4+
.minimum_zig_version = "0.14.0",
55
.dependencies = .{},
6-
6+
.fingerprint = 0x45088a7324835fcd,
77
.paths = .{
88
"entities.json",
99
"build.zig",

src/main.zig

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@ const entities = @import("entities");
44
const Entity = entities.Entity;
55
const Codepoints = entities.Codepoints;
66

7-
fn order(_: void, lhs: entities.Entity, rhs: Entity) std.math.Order {
7+
fn order(lhs: entities.Entity, rhs: Entity) std.math.Order {
88
return std.mem.order(u8, lhs.entity, rhs.entity);
99
}
1010

1111
pub fn lookup(entity: []const u8) ?Entity {
12-
const maybe_index = std.sort.binarySearch(Entity, Entity{
12+
const maybe_index = std.sort.binarySearch(Entity, entities.ENTITIES[0..], Entity{
1313
.entity = entity,
1414
.codepoints = .{ .Single = 0 },
1515
.characters = "",
16-
}, entities.ENTITIES[0..], {}, order);
16+
}, order);
1717

1818
if (maybe_index) |index| {
1919
return entities.ENTITIES[index];

0 commit comments

Comments
 (0)