Skip to content

Commit c959a00

Browse files
committed
translate-c: support goto: AutoHashMapUnmanaged -> AutoArrayHashMapUnmanaged
1 parent 8df4352 commit c959a00

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/translate_c.zig

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1659,7 +1659,7 @@ fn transCompoundStmtInline(
16591659
var it = stmt.body_begin();
16601660
const end_it = stmt.body_end();
16611661
if (c.goto.?.transformations.get(@ptrCast(stmt))) |transformations| {
1662-
var first_inner_stmt_after_if_to_variables: std.AutoHashMapUnmanaged(*const clang.Stmt, std.ArrayListUnmanaged([]const u8)) = .{};
1662+
var first_inner_stmt_after_if_to_variables: std.AutoArrayHashMapUnmanaged(*const clang.Stmt, std.ArrayListUnmanaged([]const u8)) = .{};
16631663
defer first_inner_stmt_after_if_to_variables.deinit(c.gpa);
16641664

16651665
var upwards_inner_stmt_break_target_transformations: std.AutoHashMapUnmanaged(*const clang.Stmt, std.ArrayListUnmanaged(*const GotoContext.Transformation)) = .{};
@@ -1772,9 +1772,8 @@ fn transCompoundStmtInline(
17721772

17731773
if (end_if or (it + 1 != end_it and first_inner_stmt_after_if_to_variables.contains((it + 1)[0]))) {
17741774
if (if_block.?.statements.items.len != 0) {
1775-
var iter = first_inner_stmt_after_if_to_variables.valueIterator();
17761775
var ncond: ?Node = null;
1777-
while (iter.next()) |variables| {
1776+
for (first_inner_stmt_after_if_to_variables.values()) |*variables| {
17781777
for (variables.items) |variable| {
17791778
const ident = try Tag.identifier.create(c.arena, variable);
17801779
ncond = if (ncond) |nc|
@@ -1822,7 +1821,7 @@ fn transCompoundStmtInline(
18221821
if (it + 1 != end_it) {
18231822
if (first_inner_stmt_after_if_to_variables.getPtr((it + 1)[0])) |variables| {
18241823
variables.deinit(c.gpa);
1825-
assert(first_inner_stmt_after_if_to_variables.remove((it + 1)[0]));
1824+
assert(first_inner_stmt_after_if_to_variables.swapRemove((it + 1)[0]));
18261825
}
18271826
}
18281827
}

0 commit comments

Comments
 (0)