Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove some usingnamespaces #18765

Merged
merged 8 commits into from
Apr 10, 2025
Merged

remove some usingnamespaces #18765

merged 8 commits into from
Apr 10, 2025

Conversation

paperclover
Copy link
Member

Revival of previous PR #18353

@robobun
Copy link

robobun commented Apr 3, 2025

Updated 2:08 PM PT - Apr 10th, 2025

@paperclover, your commit 95cb524a34c58cdb7d1ba814fdf356b1d334ed2f passed in Build #14781! 🎉


🧪   try this PR locally:

bunx bun-pr 18765

}

fn free(ctx: *anyopaque, buf: []u8, alignment: std.mem.Alignment, ret_addr: usize) void {
const scope: *AllocationScope = @ptrCast(@alignCast(ctx));
scope.state.mutex.lock();
defer scope.state.mutex.unlock();
var invalid = false;
const invalid = scope.trackFreeAssumeLocked(buf, ret_addr);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would this return true for 0?

const buf = alloc(u8, 0);
defer free(buf);

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

std.mem.Allocator special cases zero length allocations and frees to do nothing

@@ -979,7 +979,10 @@ pub fn CAresLookup(comptime cares_type: type, comptime type_name: []const u8) ty
next: ?*@This() = null,
name: []const u8,

pub usingnamespace bun.New(@This());
pub fn new(data: @This()) *@This() {
bun.assert(data.allocated); // deinit will not free this otherwise
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should remove .allocated in the future. It exists because we have allocations going through globalThis.allocator and bun.default_allocator.destroy in ResolveInfoRequest.init and onCaresComplete

@paperclover paperclover merged commit c1dc5f1 into main Apr 10, 2025
70 checks passed
@paperclover paperclover deleted the chloe/usingnamespace3 branch April 10, 2025 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants