aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/bindings/headers-handwritten.h
diff options
context:
space:
mode:
authorGravatar dave caruso <me@paperdave.net> 2023-09-29 14:58:39 -0700
committerGravatar GitHub <noreply@github.com> 2023-09-29 14:58:39 -0700
commit10bee33909b154aba8ce3c21aba90e47d5a975e2 (patch)
tree87bd5f9bb02f33af4b227e77ccbf98ffcbdc6f54 /src/bun.js/bindings/headers-handwritten.h
parent6afa78120ac0512bc55d00a8a1562d8f0eafa2c2 (diff)
downloadbun-10bee33909b154aba8ce3c21aba90e47d5a975e2.tar.gz
bun-10bee33909b154aba8ce3c21aba90e47d5a975e2.tar.zst
bun-10bee33909b154aba8ce3c21aba90e47d5a975e2.zip
fix(resolver): support encoded file urls (#5766)
* start working on this * it works now * better implementation imo * yippee * more tests and better unrefing * fix leak?
Diffstat (limited to 'src/bun.js/bindings/headers-handwritten.h')
-rw-r--r--src/bun.js/bindings/headers-handwritten.h23
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