Skip to content

Commit 5cbcb90

Browse files
committed
browser: fix buffer url usage w/ the arena
1 parent 4302be5 commit 5cbcb90

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/browser/browser.zig

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -368,9 +368,6 @@ pub const Page = struct {
368368

369369
// update uri after eventual redirection
370370
var buf: std.ArrayListUnmanaged(u8) = .{};
371-
defer buf.deinit(arena);
372-
373-
buf.clearRetainingCapacity();
374371
try request.uri.writeToStream(.{
375372
.scheme = true,
376373
.authentication = true,
@@ -379,7 +376,7 @@ pub const Page = struct {
379376
.query = true,
380377
.fragment = true,
381378
}, buf.writer(arena));
382-
self.rawuri = try buf.toOwnedSlice(arena);
379+
self.rawuri = buf.items;
383380

384381
self.uri = try std.Uri.parse(self.rawuri.?);
385382

@@ -389,12 +386,12 @@ pub const Page = struct {
389386
try self.session.window.replaceLocation(&self.location);
390387

391388
// prepare origin value.
392-
buf.clearRetainingCapacity();
389+
buf = .{};
393390
try request.uri.writeToStream(.{
394391
.scheme = true,
395392
.authority = true,
396393
}, buf.writer(arena));
397-
self.origin = try buf.toOwnedSlice(arena);
394+
self.origin = buf.items;
398395

399396
log.info("GET {any} {d}", .{ self.uri, header.status });
400397

0 commit comments

Comments
 (0)