aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-01-29 18:59:14 -0800
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-01-29 18:59:14 -0800
commit4211f733d19eaa201fac112b86383b533226cef4 (patch)
tree088064c864b1c77fbba67cb971818da997b43ea6
parent44eec0c5bb1afbcc16430359e825204a51f7ce2c (diff)
downloadbun-4211f733d19eaa201fac112b86383b533226cef4.tar.gz
bun-4211f733d19eaa201fac112b86383b533226cef4.tar.zst
bun-4211f733d19eaa201fac112b86383b533226cef4.zip
cleanup
-rw-r--r--src/bun.js/bindings/JSBuffer.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/bun.js/bindings/JSBuffer.cpp b/src/bun.js/bindings/JSBuffer.cpp
index 2e15c419a..df7433657 100644
--- a/src/bun.js/bindings/JSBuffer.cpp
+++ b/src/bun.js/bindings/JSBuffer.cpp
@@ -430,7 +430,7 @@ EncodedJSValue constructSlowBuffer(JSGlobalObject* lexicalGlobalObject, CallFram
return jsBufferConstructorFunction_allocUnsafeSlowBody(lexicalGlobalObject, callFrame);
}
-static inline JSC::EncodedJSValue jsBufferFromStringAndEncoding(JSC::JSGlobalObject* lexicalGlobalObject, JSString* str, WebCore::BufferEncodingType encoding)
+static inline JSC::EncodedJSValue jsBufferByteLengthFromStringAndEncoding(JSC::JSGlobalObject* lexicalGlobalObject, JSString* str, WebCore::BufferEncodingType encoding)
{
auto scope = DECLARE_THROW_SCOPE(lexicalGlobalObject->vm());
if (!str) {
@@ -439,7 +439,7 @@ static inline JSC::EncodedJSValue jsBufferFromStringAndEncoding(JSC::JSGlobalObj
}
if (str->length() == 0)
- return JSC::JSValue::encode(JSC::jsNumber(0));
+ RELEASE_AND_RETURN(scope, JSC::JSValue::encode(JSC::jsNumber(0)));
int64_t written = 0;
@@ -448,13 +448,13 @@ static inline JSC::EncodedJSValue jsBufferFromStringAndEncoding(JSC::JSGlobalObj
case WebCore::BufferEncodingType::ucs2:
case WebCore::BufferEncodingType::utf16le: {
// https://github.com/nodejs/node/blob/e676942f814915b2d24fc899bb42dc71ae6c8226/lib/buffer.js#L600
- return JSC::JSValue::encode(JSC::jsNumber(str->length() * 2));
+ RELEASE_AND_RETURN(scope, JSC::JSValue::encode(JSC::jsNumber(str->length() * 2)));
}
case WebCore::BufferEncodingType::latin1:
case WebCore::BufferEncodingType::ascii: {
- // https: // github.com/nodejs/node/blob/e676942f814915b2d24fc899bb42dc71ae6c8226/lib/buffer.js#L627
- return JSC::JSValue::encode(JSC::jsNumber(str->length()));
+ // https://github.com/nodejs/node/blob/e676942f814915b2d24fc899bb42dc71ae6c8226/lib/buffer.js#L627
+ RELEASE_AND_RETURN(scope, JSC::JSValue::encode(JSC::jsNumber(str->length())));
}
case WebCore::BufferEncodingType::base64:
@@ -497,7 +497,7 @@ static inline JSC::EncodedJSValue jsBufferFromStringAndEncoding(JSC::JSGlobalObj
}
}
- return JSC::JSValue::encode(JSC::jsNumber(written));
+ RELEASE_AND_RETURN(scope, JSC::JSValue::encode(JSC::jsNumber(written)));
}
static inline JSC::EncodedJSValue jsBufferConstructorFunction_byteLengthBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame)
{