From e35c777cc2d3d551d4f659e95c06b902379992aa Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Wed, 31 Oct 2012 21:15:29 +0000 Subject: make the argv generation conditional on its use --- src/jsapi-libdom-operator.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/jsapi-libdom-operator.c b/src/jsapi-libdom-operator.c index 4edf235..748ea4c 100644 --- a/src/jsapi-libdom-operator.c +++ b/src/jsapi-libdom-operator.c @@ -162,6 +162,13 @@ output_variable_definitions(struct binding *binding, arg_node = webidl_node_find_type(arglist, arg_node, WEBIDL_NODE_TYPE_ARGUMENT); + + /* at least one argument or private need to generate argv variable */ + if ((arg_node != NULL) || binding->has_private) { + fprintf(binding->outfile, + "\tjsval *argv = JSAPI_ARGV(cx, vp);\n"); + } + while (arg_node != NULL) { /* generate variable to hold the argument */ arg_ident = webidl_node_find_type(webidl_node_getnode(arg_node), @@ -441,9 +448,6 @@ static int webidl_operator_body_cb(struct webidl_node *node, void *ctx) fprintf(binding->outfile, "{\n"); - fprintf(binding->outfile, - "\tjsval *argv = JSAPI_ARGV(cx, vp);\n"); - output_variable_definitions(binding, webidl_node_getnode(node)); if (binding->has_private) { -- cgit v1.2.3