mirror of
https://github.com/oven-sh/bun
synced 2026-02-11 19:38:58 +00:00
feat(node/net): add SocketAddress (#17154)
Co-authored-by: DonIsaac <22823424+DonIsaac@users.noreply.github.com>
This commit is contained in:
@@ -96,7 +96,7 @@ pub const WTFStringImplStruct = extern struct {
|
||||
pub inline fn deref(self: WTFStringImpl) void {
|
||||
JSC.markBinding(@src());
|
||||
const current_count = self.refCount();
|
||||
bun.assert(current_count > 0);
|
||||
bun.assert(self.hasAtLeastOneRef()); // do not use current_count, it breaks for static strings
|
||||
Bun__WTFStringImpl__deref(self);
|
||||
if (comptime bun.Environment.allow_assert) {
|
||||
if (current_count > 1) {
|
||||
@@ -108,11 +108,16 @@ pub const WTFStringImplStruct = extern struct {
|
||||
pub inline fn ref(self: WTFStringImpl) void {
|
||||
JSC.markBinding(@src());
|
||||
const current_count = self.refCount();
|
||||
bun.assert(current_count > 0);
|
||||
bun.assert(self.hasAtLeastOneRef()); // do not use current_count, it breaks for static strings
|
||||
Bun__WTFStringImpl__ref(self);
|
||||
bun.assert(self.refCount() > current_count or self.isStatic());
|
||||
}
|
||||
|
||||
pub inline fn hasAtLeastOneRef(self: WTFStringImpl) bool {
|
||||
// WTF::StringImpl::hasAtLeastOneRef
|
||||
return self.m_refCount > 0;
|
||||
}
|
||||
|
||||
pub fn toLatin1Slice(this: WTFStringImpl) ZigString.Slice {
|
||||
this.ref();
|
||||
return ZigString.Slice.init(this.refCountAllocator(), this.latin1Slice());
|
||||
|
||||
Reference in New Issue
Block a user