summaryrefslogtreecommitdiff
path: root/couchjs
diff options
context:
space:
mode:
authorPaul J. Davis <paul.joseph.davis@gmail.com>2011-12-01 10:00:06 -0600
committerPaul J. Davis <paul.joseph.davis@gmail.com>2011-12-12 13:53:00 -0600
commit83a451f1e8166ec62baa04932281615b92fde946 (patch)
tree28b09205955eef2e325bb095365eb5f0b0d8b5c9 /couchjs
parent3462a5692ea0a7d76a024fbe38a8026e44e72876 (diff)
Set the stack size for sub contexts
I was forgetting to pass the args through to evalcx so that it could use the stack size specified on the command line.
Diffstat (limited to 'couchjs')
-rw-r--r--couchjs/c_src/sm170.c5
-rw-r--r--couchjs/c_src/sm180.c5
-rw-r--r--couchjs/c_src/sm185.c5
3 files changed, 12 insertions, 3 deletions
diff --git a/couchjs/c_src/sm170.c b/couchjs/c_src/sm170.c
index 016c91e0..61f764dd 100644
--- a/couchjs/c_src/sm170.c
+++ b/couchjs/c_src/sm170.c
@@ -122,12 +122,14 @@ evalcx(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
size_t srclen;
JSBool ret = JS_FALSE;
+ couch_args* args = (couch_args*) JS_GetContextPrivate(cx);
+
sandbox = NULL;
if(!JS_ConvertArguments(cx, argc, argv, "S / o", &str, &sandbox)) {
return JS_FALSE;
}
- subcx = JS_NewContext(JS_GetRuntime(cx), 8L * 1024L);
+ subcx = JS_NewContext(JS_GetRuntime(cx), args->stack_size);
if(!subcx) {
JS_ReportOutOfMemory(cx);
return JS_FALSE;
@@ -306,6 +308,7 @@ main(int argc, const char* argv[])
if(cx == NULL)
return 1;
+ JS_SetContextPrivate(cx, args);
JS_SetErrorReporter(cx, couch_error);
JS_ToggleOptions(cx, JSOPTION_XML);
diff --git a/couchjs/c_src/sm180.c b/couchjs/c_src/sm180.c
index 7dc2a974..6c33345f 100644
--- a/couchjs/c_src/sm180.c
+++ b/couchjs/c_src/sm180.c
@@ -127,12 +127,14 @@ evalcx(JSContext *cx, uintN argc, jsval* vp)
jsval rval;
JSBool ret = JS_FALSE;
+ couch_args* args = (couch_args*) JS_GetContextPrivate(cx);
+
sandbox = NULL;
if(!JS_ConvertArguments(cx, argc, argv, "S / o", &str, &sandbox)) {
return JS_FALSE;
}
- subcx = JS_NewContext(JS_GetRuntime(cx), 8L * 1024L);
+ subcx = JS_NewContext(JS_GetRuntime(cx), args->stack_size);
if(!subcx) {
JS_ReportOutOfMemory(cx);
return JS_FALSE;
@@ -315,6 +317,7 @@ main(int argc, const char* argv[])
if(cx == NULL)
return 1;
+ JS_SetContextPrivate(cx, args);
JS_SetErrorReporter(cx, couch_error);
JS_ToggleOptions(cx, JSOPTION_XML);
diff --git a/couchjs/c_src/sm185.c b/couchjs/c_src/sm185.c
index a7258460..ecca4c8b 100644
--- a/couchjs/c_src/sm185.c
+++ b/couchjs/c_src/sm185.c
@@ -147,12 +147,14 @@ evalcx(JSContext *cx, uintN argc, jsval* vp)
jsval rval;
JSBool ret = JS_FALSE;
+ couch_args* args = (couch_args*) JS_GetContextPrivate(cx);
+
sandbox = NULL;
if(!JS_ConvertArguments(cx, argc, argv, "S / o", &str, &sandbox)) {
return JS_FALSE;
}
- subcx = JS_NewContext(JS_GetRuntime(cx), 8L * 1024L);
+ subcx = JS_NewContext(JS_GetRuntime(cx), args->stack_size);
if(!subcx) {
JS_ReportOutOfMemory(cx);
return JS_FALSE;
@@ -327,6 +329,7 @@ main(int argc, const char* argv[])
if(cx == NULL)
return 1;
+ JS_SetContextPrivate(cx, args);
JS_SetErrorReporter(cx, couch_error);
JS_ToggleOptions(cx, JSOPTION_XML);