[gjs: 2/15] jsapi-class: Make parameter const-correct
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs: 2/15] jsapi-class: Make parameter const-correct
- Date: Mon, 24 Dec 2018 00:41:50 +0000 (UTC)
commit 11d5d47f0e2615c6ca55dd368c74ae380da36c3e
Author: Philip Chimento <philip chimento gmail com>
Date: Mon Dec 3 16:14:23 2018 -0800
jsapi-class: Make parameter const-correct
gjs_init_class_dynamic() should take a const JSClass* pointer, since it
is not modified, and JS_InitClass() takes a const pointer as well.
gjs/jsapi-class.h | 20 ++++++--------------
gjs/jsapi-dynamic-class.cpp | 25 +++++++++----------------
2 files changed, 15 insertions(+), 30 deletions(-)
---
diff --git a/gjs/jsapi-class.h b/gjs/jsapi-class.h
index f765aeb7..514a10d0 100644
--- a/gjs/jsapi-class.h
+++ b/gjs/jsapi-class.h
@@ -33,20 +33,12 @@
G_BEGIN_DECLS
GJS_JSAPI_RETURN_CONVENTION
-bool gjs_init_class_dynamic(JSContext *cx,
- JS::HandleObject in_object,
- JS::HandleObject parent_proto,
- const char *ns_name,
- const char *class_name,
- JSClass *clasp,
- JSNative constructor_native,
- unsigned nargs,
- JSPropertySpec *ps,
- JSFunctionSpec *fs,
- JSPropertySpec *static_ps,
- JSFunctionSpec *static_fs,
- JS::MutableHandleObject prototype,
- JS::MutableHandleObject constructor);
+bool gjs_init_class_dynamic(
+ JSContext* cx, JS::HandleObject in_object, JS::HandleObject parent_proto,
+ const char* ns_name, const char* class_name, const JSClass* clasp,
+ JSNative constructor_native, unsigned nargs, JSPropertySpec* ps,
+ JSFunctionSpec* fs, JSPropertySpec* static_ps, JSFunctionSpec* static_fs,
+ JS::MutableHandleObject prototype, JS::MutableHandleObject constructor);
GJS_USE
bool gjs_typecheck_instance(JSContext *cx,
diff --git a/gjs/jsapi-dynamic-class.cpp b/gjs/jsapi-dynamic-class.cpp
index f2b29d54..9a0cfb19 100644
--- a/gjs/jsapi-dynamic-class.cpp
+++ b/gjs/jsapi-dynamic-class.cpp
@@ -41,22 +41,15 @@ enum {
DYNAMIC_PROPERTY_PRIVATE_SLOT,
};
-bool
-gjs_init_class_dynamic(JSContext *context,
- JS::HandleObject in_object,
- JS::HandleObject parent_proto,
- const char *ns_name,
- const char *class_name,
- JSClass *clasp,
- JSNative constructor_native,
- unsigned nargs,
- JSPropertySpec *proto_ps,
- JSFunctionSpec *proto_fs,
- JSPropertySpec *static_ps,
- JSFunctionSpec *static_fs,
- JS::MutableHandleObject prototype,
- JS::MutableHandleObject constructor)
-{
+bool gjs_init_class_dynamic(JSContext* context, JS::HandleObject in_object,
+ JS::HandleObject parent_proto, const char* ns_name,
+ const char* class_name, const JSClass* clasp,
+ JSNative constructor_native, unsigned nargs,
+ JSPropertySpec* proto_ps, JSFunctionSpec* proto_fs,
+ JSPropertySpec* static_ps,
+ JSFunctionSpec* static_fs,
+ JS::MutableHandleObject prototype,
+ JS::MutableHandleObject constructor) {
/* Force these variables on the stack, so the conservative GC will
find them */
JSFunction * volatile constructor_fun;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]