Merge pull request #3354 from lightpanda-io/remove-duplicate-dupe

minor: remove potentially wasteful id dupe on removeId
This commit is contained in:
Karl Seguin authored and GitHub committed 2026-08-31 19:28:41 +08:00
commit f4c8cd5fb2
1 file changed
+6 -2
+6 -2
View File
@@ -2180,10 +2180,14 @@ pub fn removeElementId(self: *Frame, element: *Element, id: []const u8) void {
pub fn removeElementIdWithMaps(self: *Frame, id_maps: ElementIdMaps, id: []const u8) void {
if (id_maps.lookup.remove(id)) {
const owned_id = self.dupeString(id) catch return;
id_maps.removed_ids.put(self.arena, owned_id, {}) catch |err| {
const gop = id_maps.removed_ids.getOrPut(self.arena, id) catch |err| {
log.warn(.frame, "removeElementIdWithMaps", .{ .err = err });
return;
};
if (gop.found_existing == false) {
gop.key_ptr.* = self.dupeString(id) catch return;
gop.value_ptr.* = {};
}
}
}