[gjs] system: Replace repeated JS_DefineFunction with JS_DefineFunctions
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs] system: Replace repeated JS_DefineFunction with JS_DefineFunctions
- Date: Tue, 1 Oct 2013 22:37:41 +0000 (UTC)
commit d59cdb1eb2da3c9b8e981fb7560e86515120b741
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Fri Sep 27 19:39:46 2013 -0400
system: Replace repeated JS_DefineFunction with JS_DefineFunctions
modules/system.c | 38 ++++++++++----------------------------
1 files changed, 10 insertions(+), 28 deletions(-)
---
diff --git a/modules/system.c b/modules/system.c
index 8ae4e62..6fc1e21 100644
--- a/modules/system.c
+++ b/modules/system.c
@@ -119,6 +119,15 @@ gjs_exit(JSContext *context,
return JS_TRUE;
}
+static JSFunctionSpec module_funcs[] = {
+ { "addressOf", JSOP_WRAPPER (gjs_address_of), 1, GJS_MODULE_PROP_FLAGS },
+ { "refcount", JSOP_WRAPPER (gjs_refcount), 1, GJS_MODULE_PROP_FLAGS },
+ { "breakpoint", JSOP_WRAPPER (gjs_breakpoint), 0, GJS_MODULE_PROP_FLAGS },
+ { "gc", JSOP_WRAPPER (gjs_gc), 0, GJS_MODULE_PROP_FLAGS },
+ { "exit", JSOP_WRAPPER (gjs_exit), 0, GJS_MODULE_PROP_FLAGS },
+ { NULL },
+};
+
JSBool
gjs_js_define_system_stuff(JSContext *context,
JSObject *module)
@@ -128,34 +137,7 @@ gjs_js_define_system_stuff(JSContext *context,
jsval value;
JSBool retval;
- if (!JS_DefineFunction(context, module,
- "addressOf",
- (JSNative) gjs_address_of,
- 1, GJS_MODULE_PROP_FLAGS))
- return JS_FALSE;
-
- if (!JS_DefineFunction(context, module,
- "refcount",
- (JSNative) gjs_refcount,
- 1, GJS_MODULE_PROP_FLAGS))
- return JS_FALSE;
-
- if (!JS_DefineFunction(context, module,
- "breakpoint",
- (JSNative) gjs_breakpoint,
- 0, GJS_MODULE_PROP_FLAGS))
- return JS_FALSE;
-
- if (!JS_DefineFunction(context, module,
- "gc",
- (JSNative) gjs_gc,
- 0, GJS_MODULE_PROP_FLAGS))
- return JS_FALSE;
-
- if (!JS_DefineFunction(context, module,
- "exit",
- (JSNative) gjs_exit,
- 1, GJS_MODULE_PROP_FLAGS))
+ if (!JS_DefineFunctions(context, module, &module_funcs[0]))
return JS_FALSE;
retval = JS_FALSE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]