diff options
Diffstat (limited to 'src/bun.js/bindings/headers-handwritten.h')
-rw-r--r-- | src/bun.js/bindings/headers-handwritten.h | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/src/bun.js/bindings/headers-handwritten.h b/src/bun.js/bindings/headers-handwritten.h index e19be7abe..cef5d0804 100644 --- a/src/bun.js/bindings/headers-handwritten.h +++ b/src/bun.js/bindings/headers-handwritten.h @@ -17,10 +17,6 @@ typedef union BunStringImpl { void* wtf; } BunStringImpl; -typedef struct BunString { - BunStringTag tag; - BunStringImpl impl; -} BunString; #else typedef union BunStringImpl { ZigString zig; @@ -34,13 +30,15 @@ enum class BunStringTag : uint8_t { StaticZigString = 3, Empty = 4, }; +#endif typedef struct BunString { BunStringTag tag; BunStringImpl impl; -} BunString; -#endif + inline void ref(); + inline void deref(); +} BunString; typedef struct ZigErrorType { ZigErrorCode code; @@ -348,3 +346,16 @@ class ScriptArguments; using ScriptArguments = Inspector::ScriptArguments; #endif + +ALWAYS_INLINE void BunString::ref() +{ + if (this->tag == BunStringTag::WTFStringImpl) { + this->impl.wtf->ref(); + } +} +ALWAYS_INLINE void BunString::deref() +{ + if (this->tag == BunStringTag::WTFStringImpl) { + this->impl.wtf->deref(); + } +}
\ No newline at end of file |