[gjs] coverage: Use JS_DefineFunctions



commit 425ddb64535d7a6b43f540fcc7f822f42a529113
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Mon Feb 3 13:18:51 2014 -0500

    coverage: Use JS_DefineFunctions

 gjs/coverage.cpp |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/gjs/coverage.cpp b/gjs/coverage.cpp
index 9bacc70..59d21ff 100644
--- a/gjs/coverage.cpp
+++ b/gjs/coverage.cpp
@@ -1112,6 +1112,10 @@ coverage_warning(JSContext *context,
     return JS_TRUE;
 }
 
+static JSFunctionSpec coverage_funcs[] = {
+    { "warning", JSOP_WRAPPER (coverage_warning), 1, GJS_MODULE_PROP_FLAGS },
+    { NULL },
+};
 
 static gboolean
 bootstrap_coverage(GjsCoverage *coverage)
@@ -1157,11 +1161,8 @@ bootstrap_coverage(GjsCoverage *coverage)
             return FALSE;
         }
 
-        if (!JS_DefineFunction(context, debugger_compartment,
-                               "warning",
-                               (JSNative) coverage_warning,
-                               1, GJS_MODULE_PROP_FLAGS))
-            g_error("Failed to define warning function");
+        if (!JS_DefineFunctions(context, debugger_compartment, &coverage_funcs[0]))
+            g_error("Failed to init coverage");
 
         if (!gjs_context_eval_file_in_compartment(priv->context,
                                                   coverage_script,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]