[gjs/april-maintenance: 4/11] byteArray: Remove root in ByteArray methods
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/april-maintenance: 4/11] byteArray: Remove root in ByteArray methods
- Date: Fri, 1 May 2020 04:47:42 +0000 (UTC)
commit ba83cd9b005d07b75c4a640fbb9c5a85a8333627
Author: Philip Chimento <philip chimento gmail com>
Date: Tue Apr 28 17:31:17 2020 -0700
byteArray: Remove root in ByteArray methods
These objects don't need to be rooted, since these methods cannot cause
a garbage collection.
gi/arg.cpp | 2 +-
gjs/byteArray.cpp | 4 ++--
gjs/byteArray.h | 4 ++--
3 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/gi/arg.cpp b/gi/arg.cpp
index 18f8267b..abbb2ab6 100644
--- a/gi/arg.cpp
+++ b/gi/arg.cpp
@@ -2079,7 +2079,7 @@ _Pragma("GCC diagnostic pop")
* of Uint8Array and it needs to be marshalled to GByteArray.
*/
if (value.isObject()) {
- JS::RootedObject bytearray_obj(context, value.toObjectOrNull());
+ JSObject* bytearray_obj = &value.toObject();
if (JS_IsUint8Array(bytearray_obj) &&
array_type == GI_ARRAY_TYPE_BYTE_ARRAY) {
arg->v_pointer = gjs_byte_array_get_byte_array(bytearray_obj);
diff --git a/gjs/byteArray.cpp b/gjs/byteArray.cpp
index 0d0240b7..10d463d7 100644
--- a/gjs/byteArray.cpp
+++ b/gjs/byteArray.cpp
@@ -371,7 +371,7 @@ JSObject* gjs_byte_array_from_byte_array(JSContext* cx, GByteArray* array) {
return gjs_byte_array_from_data(cx, array->len, array->data);
}
-GBytes* gjs_byte_array_get_bytes(JS::HandleObject obj) {
+GBytes* gjs_byte_array_get_bytes(JSObject* obj) {
bool is_shared_memory;
uint32_t len;
uint8_t* data;
@@ -380,7 +380,7 @@ GBytes* gjs_byte_array_get_bytes(JS::HandleObject obj) {
return g_bytes_new(data, len);
}
-GByteArray* gjs_byte_array_get_byte_array(JS::HandleObject obj) {
+GByteArray* gjs_byte_array_get_byte_array(JSObject* obj) {
return g_bytes_unref_to_array(gjs_byte_array_get_bytes(obj));
}
diff --git a/gjs/byteArray.h b/gjs/byteArray.h
index 407cd4fd..e0c01aae 100644
--- a/gjs/byteArray.h
+++ b/gjs/byteArray.h
@@ -46,9 +46,9 @@ JSObject * gjs_byte_array_from_byte_array (JSContext *context,
GByteArray *array);
GJS_USE
-GByteArray* gjs_byte_array_get_byte_array(JS::HandleObject obj);
+GByteArray* gjs_byte_array_get_byte_array(JSObject* obj);
GJS_USE
-GBytes* gjs_byte_array_get_bytes(JS::HandleObject obj);
+GBytes* gjs_byte_array_get_bytes(JSObject* obj);
#endif // GJS_BYTEARRAY_H_
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]