summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2012-10-31 21:15:29 +0000
committerVincent Sanders <vince@kyllikki.org>2012-10-31 21:15:29 +0000
commite35c777cc2d3d551d4f659e95c06b902379992aa (patch)
tree9b87859818827407a59c0743bb56ce236591b428
parent65e49e23019a97d51702077c82613c6c26e84033 (diff)
downloadnsgenbind-e35c777cc2d3d551d4f659e95c06b902379992aa.tar.gz
nsgenbind-e35c777cc2d3d551d4f659e95c06b902379992aa.tar.bz2
make the argv generation conditional on its use
-rw-r--r--src/jsapi-libdom-operator.c10
1 files 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) {