Skip to content

Commit

Permalink
fix invalid use of var
Browse files Browse the repository at this point in the history
  • Loading branch information
Snektron committed Nov 21, 2023
1 parent 6d46195 commit 27d9b02
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion examples/triangle.zig
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ pub fn main() !void {
const render_pass = try createRenderPass(&gc, swapchain);
defer gc.vkd.destroyRenderPass(gc.dev, render_pass, null);

var pipeline = try createPipeline(&gc, pipeline_layout, render_pass);
const pipeline = try createPipeline(&gc, pipeline_layout, render_pass);
defer gc.vkd.destroyPipeline(gc.dev, pipeline, null);

var framebuffers = try createFramebuffers(&gc, allocator, render_pass, swapchain);
Expand Down
6 changes: 3 additions & 3 deletions generator/vulkan/parse.zig
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub fn parseXml(backing_allocator: Allocator, root: *xml.Element, api: registry.

const allocator = arena.allocator();

var reg = registry.Registry{
const reg = registry.Registry{
.decls = try parseDeclarations(allocator, root, api),
.api_constants = try parseApiConstants(allocator, root, api),
.tags = try parseTags(allocator, root),
Expand All @@ -38,8 +38,8 @@ pub fn parseXml(backing_allocator: Allocator, root: *xml.Element, api: registry.
}

fn parseDeclarations(allocator: Allocator, root: *xml.Element, api: registry.Api) ![]registry.Declaration {
var types_elem = root.findChildByTag("types") orelse return error.InvalidRegistry;
var commands_elem = root.findChildByTag("commands") orelse return error.InvalidRegistry;
const types_elem = root.findChildByTag("types") orelse return error.InvalidRegistry;
const commands_elem = root.findChildByTag("commands") orelse return error.InvalidRegistry;

const decl_upper_bound = types_elem.children.len + commands_elem.children.len;
const decls = try allocator.alloc(registry.Declaration, decl_upper_bound);
Expand Down
2 changes: 1 addition & 1 deletion generator/xml.zig
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ const Parser = struct {
begin = prev_nl + 1;
}

var end = mem.indexOfScalarPos(u8, self.source, self.offset, '\n') orelse self.source.len;
const end = mem.indexOfScalarPos(u8, self.source, self.offset, '\n') orelse self.source.len;
return self.source[begin..end];
}
};
Expand Down

0 comments on commit 27d9b02

Please sign in to comment.