Return-Path: Delivered-To: apmail-couchdb-dev-archive@www.apache.org Received: (qmail 53298 invoked from network); 4 Aug 2009 17:19:34 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 4 Aug 2009 17:19:34 -0000 Received: (qmail 24833 invoked by uid 500); 4 Aug 2009 17:19:38 -0000 Delivered-To: apmail-couchdb-dev-archive@couchdb.apache.org Received: (qmail 24724 invoked by uid 500); 4 Aug 2009 17:19:38 -0000 Mailing-List: contact dev-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list dev@couchdb.apache.org Received: (qmail 24705 invoked by uid 99); 4 Aug 2009 17:19:38 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Aug 2009 17:19:38 +0000 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [83.97.50.139] (HELO jan.prima.de) (83.97.50.139) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Aug 2009 17:19:26 +0000 Received: from [192.168.1.14] (f053010143.adsl.alicedsl.de [::ffff:78.53.10.143]) (AUTH: LOGIN jan, TLS: TLSv1/SSLv3,128bits,AES128-SHA) by jan.prima.de with esmtp; Tue, 04 Aug 2009 17:19:03 +0000 Cc: commits@couchdb.apache.org Message-Id: <14AE9C2E-335F-4867-A7C9-0C5E18D47E61@apache.org> From: Jan Lehnardt To: dev@couchdb.apache.org In-Reply-To: <20090804165142.6E55323888DC@eris.apache.org> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v935.3) Subject: Re: svn commit: r800873 - in /couchdb/trunk: configure.ac src/couchdb/couch_js.c Date: Tue, 4 Aug 2009 19:19:01 +0200 References: <20090804165142.6E55323888DC@eris.apache.org> X-Mailer: Apple Mail (2.935.3) X-Virus-Checked: Checked by ClamAV on apache.org On 4 Aug 2009, at 18:51, davisp@apache.org wrote: > Author: davisp > Date: Tue Aug 4 16:51:41 2009 > New Revision: 800873 > > URL: http://svn.apache.org/viewvc?rev=800873&view=rev > Log: > Proper fix because JS_VERSION cannot distinguish between 1.8.0 and > 1.8.1 Thanks Paul. Confirmed this is fixed and works for Spidermonkey 1.7 and 1.8.1. Cheers Jan -- > > > Modified: > couchdb/trunk/configure.ac > couchdb/trunk/src/couchdb/couch_js.c > > Modified: couchdb/trunk/configure.ac > URL: http://svn.apache.org/viewvc/couchdb/trunk/configure.ac?rev=800873&r1=800872&r2=800873&view=diff > = > = > = > = > = > = > = > = > ====================================================================== > --- couchdb/trunk/configure.ac (original) > +++ couchdb/trunk/configure.ac Tue Aug 4 16:51:41 2009 > @@ -103,6 +103,16 @@ > Are the Mozilla SpiderMonkey headers installed?]) > ])]) > > +AC_LANG_PUSH(C) > +AC_LINK_IFELSE( > + [AC_LANG_PROGRAM( > + [[]], > + [[JS_SetOperationCallback(0, 0);]] > + )], > + AC_DEFINE([USE_JS_SETOPCB], [], [Use new > JS_SetOperationCallback]) > +) > +AC_LANG_POP(C) > + > AC_CHECK_ICU([3]) > > ICU_LOCAL_CFLAGS=`$ICU_CONFIG --cppflags-searchpath` > > Modified: couchdb/trunk/src/couchdb/couch_js.c > URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_js.c?rev=800873&r1=800872&r2=800873&view=diff > = > = > = > = > = > = > = > = > ====================================================================== > --- couchdb/trunk/src/couchdb/couch_js.c (original) > +++ couchdb/trunk/src/couchdb/couch_js.c Tue Aug 4 16:51:41 2009 > @@ -19,6 +19,7 @@ > #include "curlhelper.h" > #include > #include > +#include "config.h" > > #ifndef CURLOPT_COPYPOSTFIELDS > #define CURLOPT_COPYPOSTFIELDS 10165 > @@ -214,7 +215,7 @@ > return JS_FALSE; > } > > -#if JS_VERSION > 170 > +#ifdef USE_JS_SETOPCB > JS_SetContextThread(sub_context); > JS_BeginRequest(sub_context); > #endif > @@ -240,7 +241,7 @@ > } > > out: > -#if JS_VERSION > 170 > +#ifdef USE_JS_SETOPCB > JS_EndRequest(sub_context); > JS_ClearContextThread(sub_context); > #endif > @@ -405,9 +406,10 @@ > > static uint32 gBranchCount = 0; > > -#if JS_VERSION <= 170 > +#ifdef USE_JS_SETOPCB > static JSBool > -BranchCallback(JSContext *context, JSScript *script) { > +OperationCallback(JSContext *context) > +{ > if ((++gBranchCount & 0x3fff) == 1) { > JS_MaybeGC(context); > } > @@ -415,8 +417,7 @@ > } > #else > static JSBool > -OperationCallback(JSContext *context) > -{ > +BranchCallback(JSContext *context, JSScript *script) { > if ((++gBranchCount & 0x3fff) == 1) { > JS_MaybeGC(context); > } > @@ -1234,13 +1235,13 @@ > return 1; > /* FIXME: https://bugzilla.mozilla.org/show_bug.cgi?id=477187 */ > JS_SetErrorReporter(context, PrintError); > -#if JS_VERSION <= 170 > - JS_SetBranchCallback(context, BranchCallback); > - JS_ToggleOptions(context, JSOPTION_NATIVE_BRANCH_CALLBACK); > -#else > +#ifdef USE_JS_SETOPCB > JS_SetContextThread(context); > JS_BeginRequest(context); > JS_SetOperationCallback(context, OperationCallback); > +#else > + JS_SetBranchCallback(context, BranchCallback); > + JS_ToggleOptions(context, JSOPTION_NATIVE_BRANCH_CALLBACK); > #endif > JS_ToggleOptions(context, JSOPTION_XML); > > @@ -1272,7 +1273,7 @@ > > ExecuteScript(context, global, argv[1]); > > -#if JS_VERSION > 170 > +#ifdef USE_JS_SETOPCB > JS_EndRequest(context); > JS_ClearContextThread(context); > #endif > >