summaryrefslogtreecommitdiff
path: root/vtab.zig
diff options
context:
space:
mode:
authorGravatar Vincent Rischmann2023-02-22 23:20:14 +0100
committerGravatar Vincent Rischmann2023-02-22 23:20:14 +0100
commit1333830fcf6b8e99bb0d9497ceaea79251e5195c (patch)
treecacca60e428ad150e021ec5cee0e27cd128e79f3 /vtab.zig
parentfix tests (diff)
downloadzig-sqlite-1333830fcf6b8e99bb0d9497ceaea79251e5195c.tar.gz
zig-sqlite-1333830fcf6b8e99bb0d9497ceaea79251e5195c.tar.xz
zig-sqlite-1333830fcf6b8e99bb0d9497ceaea79251e5195c.zip
fix for latest zig by running 'zig fmt'
Diffstat (limited to 'vtab.zig')
-rw-r--r--vtab.zig12
1 files changed, 6 insertions, 6 deletions
diff --git a/vtab.zig b/vtab.zig
index aef1b40..a7645c3 100644
--- a/vtab.zig
+++ b/vtab.zig
@@ -207,7 +207,7 @@ pub const BestIndexBuilder = struct {
207 .id = .{}, 207 .id = .{},
208 }; 208 };
209 209
210 for (res.constraints) |*constraint, i| { 210 for (res.constraints, 0..) |*constraint, i| {
211 const raw_constraint = index_info.aConstraint[i]; 211 const raw_constraint = index_info.aConstraint[i];
212 212
213 constraint.column = @intCast(isize, raw_constraint.iColumn); 213 constraint.column = @intCast(isize, raw_constraint.iColumn);
@@ -233,7 +233,7 @@ pub const BestIndexBuilder = struct {
233 233
234 // Populate the constraint usage 234 // Populate the constraint usage
235 var constraint_usage: []c.sqlite3_index_constraint_usage = index_info.aConstraintUsage[0..self.constraints.len]; 235 var constraint_usage: []c.sqlite3_index_constraint_usage = index_info.aConstraintUsage[0..self.constraints.len];
236 for (self.constraints) |constraint, i| { 236 for (self.constraints, 0..) |constraint, i| {
237 constraint_usage[i].argvIndex = constraint.usage.argv_index; 237 constraint_usage[i].argvIndex = constraint.usage.argv_index;
238 constraint_usage[i].omit = if (constraint.usage.omit) 1 else 0; 238 constraint_usage[i].omit = if (constraint.usage.omit) 1 else 0;
239 } 239 }
@@ -541,7 +541,7 @@ fn parseModuleArguments(allocator: mem.Allocator, argc: c_int, argv: [*c]const [
541 var res = try allocator.alloc(ModuleArgument, @intCast(usize, argc)); 541 var res = try allocator.alloc(ModuleArgument, @intCast(usize, argc));
542 errdefer allocator.free(res); 542 errdefer allocator.free(res);
543 543
544 for (res) |*marg, i| { 544 for (res, 0..) |*marg, i| {
545 // The documentation of sqlite says each string in argv is null-terminated 545 // The documentation of sqlite says each string in argv is null-terminated
546 const arg = mem.sliceTo(argv[i], 0); 546 const arg = mem.sliceTo(argv[i], 0);
547 547
@@ -840,7 +840,7 @@ pub fn VirtualTable(
840 const size = @intCast(usize, argc); 840 const size = @intCast(usize, argc);
841 841
842 var res = try allocator.alloc(FilterArg, size); 842 var res = try allocator.alloc(FilterArg, size);
843 for (res) |*item, i| { 843 for (res, 0..) |*item, i| {
844 item.* = .{ 844 item.* = .{
845 .value = argv[i], 845 .value = argv[i],
846 }; 846 };
@@ -1276,7 +1276,7 @@ test "parse module arguments" {
1276 const allocator = arena.allocator(); 1276 const allocator = arena.allocator();
1277 1277
1278 var args = try allocator.alloc([*c]const u8, 20); 1278 var args = try allocator.alloc([*c]const u8, 20);
1279 for (args) |*arg, i| { 1279 for (args, 0..) |*arg, i| {
1280 const tmp = try fmt.allocPrintZ(allocator, "arg={d}", .{i}); 1280 const tmp = try fmt.allocPrintZ(allocator, "arg={d}", .{i});
1281 arg.* = @ptrCast([*c]const u8, tmp); 1281 arg.* = @ptrCast([*c]const u8, tmp);
1282 } 1282 }
@@ -1288,7 +1288,7 @@ test "parse module arguments" {
1288 ); 1288 );
1289 try testing.expectEqual(@as(usize, 20), res.len); 1289 try testing.expectEqual(@as(usize, 20), res.len);
1290 1290
1291 for (res) |arg, i| { 1291 for (res, 0..) |arg, i| {
1292 try testing.expectEqualStrings("arg", arg.kv.key); 1292 try testing.expectEqualStrings("arg", arg.kv.key);
1293 try testing.expectEqual(i, try fmt.parseInt(usize, arg.kv.value, 10)); 1293 try testing.expectEqual(i, try fmt.parseInt(usize, arg.kv.value, 10));
1294 } 1294 }