Squashed 'lib/ini/' changes from 2b11e8fef..19e121006

19e121006 FIX: local variable is never mutated
91775fd5c UPDATE: updated Build.zig to zig master

git-subtree-dir: lib/ini
git-subtree-split: 19e1210063882ab7db73a8aaa60e733d4aaafe9f
master^2
alex 7 months ago
parent 15a2b6d823
commit e0851a5057

@ -2,9 +2,10 @@ const std = @import("std");
pub fn build(b: *std.Build) void { pub fn build(b: *std.Build) void {
const optimize = b.standardOptimizeOption(.{}); const optimize = b.standardOptimizeOption(.{});
const target = b.standardTargetOptions(.{});
_ = b.addModule("ini", .{ _ = b.addModule("ini", .{
.source_file = .{ .root_source_file = .{
.path = "src/ini.zig", .path = "src/ini.zig",
}, },
}); });
@ -12,9 +13,10 @@ pub fn build(b: *std.Build) void {
const lib = b.addStaticLibrary(.{ const lib = b.addStaticLibrary(.{
.name = "ini", .name = "ini",
.root_source_file = .{ .path = "src/lib.zig" }, .root_source_file = .{ .path = "src/lib.zig" },
.target = b.standardTargetOptions(.{}), .target = target,
.optimize = optimize, .optimize = optimize,
}); });
lib.bundle_compiler_rt = true; lib.bundle_compiler_rt = true;
lib.addIncludePath(.{ .path = "src" }); lib.addIncludePath(.{ .path = "src" });
lib.linkLibC(); lib.linkLibC();
@ -24,6 +26,7 @@ pub fn build(b: *std.Build) void {
const example_c = b.addExecutable(.{ const example_c = b.addExecutable(.{
.name = "example-c", .name = "example-c",
.optimize = optimize, .optimize = optimize,
.target = target,
}); });
example_c.addCSourceFile(.{ example_c.addCSourceFile(.{
.file = .{ .file = .{
@ -45,8 +48,9 @@ pub fn build(b: *std.Build) void {
.name = "example-zig", .name = "example-zig",
.root_source_file = .{ .path = "example/example.zig" }, .root_source_file = .{ .path = "example/example.zig" },
.optimize = optimize, .optimize = optimize,
.target = target,
}); });
example_zig.addModule("ini", b.modules.get("ini").?); example_zig.root_module.addImport("ini", b.modules.get("ini").?);
b.installArtifact(example_zig); b.installArtifact(example_zig);

@ -78,7 +78,7 @@ test "buffer parser" {
} }
test "file parser" { test "file parser" {
var file = c.fopen("example/example.ini", "rb") orelse unreachable; const file = c.fopen("example/example.ini", "rb") orelse unreachable;
defer _ = c.fclose(file); defer _ = c.fclose(file);
var parser: c.ini_Parser = undefined; var parser: c.ini_Parser = undefined;