Skip to content

Commit c45561c

Browse files
committed
Improved example
1 parent c9263c6 commit c45561c

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

build.zig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ pub fn build(b: *std.Build) void {
88
});
99
const pg = b.dependency("pg", .{});
1010
pgExe.root_module.addImport("pg", pg.module("pg"));
11-
pgExe.linkLibC();
1211
b.installArtifact(pgExe);
1312

1413
const libpqExe = b.addExecutable(.{

examples/pg.zig

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ const std = @import("std");
33
const print = std.debug.print;
44

55
pub fn main() !void {
6-
const allocator = std.heap.c_allocator;
6+
var gpa = std.heap.GeneralPurposeAllocator(.{}).init;
7+
const allocator = gpa.allocator();
78
var pool = try pg.Pool.init(allocator, .{ .auth = .{
8-
.username = std.mem.sliceTo(std.c.getenv("USER").?, 0),
9+
.username = std.mem.sliceTo(std.posix.getenv("USER").?, 0),
910
.database = "pgvector_zig_test",
1011
} });
1112
defer pool.deinit();

0 commit comments

Comments
 (0)