Index: src/test_vfs.c ================================================================== --- src/test_vfs.c +++ src/test_vfs.c @@ -79,12 +79,10 @@ char *zName; /* Name of this VFS */ sqlite3_vfs *pParent; /* The VFS to use for file IO */ sqlite3_vfs *pVfs; /* The testvfs registered with SQLite */ Tcl_Interp *interp; /* Interpreter to run script in */ Tcl_Obj *pScript; /* Script to execute */ - int nScript; /* Number of elements in array apScript */ - Tcl_Obj **apScript; /* Array version of pScript */ TestvfsBuffer *pBuffer; /* List of shared buffers */ int isNoshm; int mask; /* Mask controlling [script] and [ioerr] */ @@ -266,52 +264,30 @@ Tcl_Obj *arg1, Tcl_Obj *arg2, Tcl_Obj *arg3 ){ int rc; /* Return code from Tcl_EvalObj() */ - int nArg; /* Elements in eval'd list */ - int nScript; - Tcl_Obj ** ap; - + Tcl_Obj *pEval; assert( p->pScript ); - if( !p->apScript ){ - int nByte; - int i; - if( TCL_OK!=Tcl_ListObjGetElements(p->interp, p->pScript, &nScript, &ap) ){ - Tcl_BackgroundError(p->interp); - Tcl_ResetResult(p->interp); - return; - } - p->nScript = nScript; - nByte = (nScript+TESTVFS_MAX_ARGS)*sizeof(Tcl_Obj *); - p->apScript = (Tcl_Obj **)ckalloc(nByte); - memset(p->apScript, 0, nByte); - for(i=0; iapScript[i] = ap[i]; - } - } - - p->apScript[p->nScript] = Tcl_NewStringObj(zMethod, -1); - p->apScript[p->nScript+1] = arg1; - p->apScript[p->nScript+2] = arg2; - p->apScript[p->nScript+3] = arg3; - - for(nArg=p->nScript; p->apScript[nArg]; nArg++){ - Tcl_IncrRefCount(p->apScript[nArg]); - } - - rc = Tcl_EvalObjv(p->interp, nArg, p->apScript, TCL_EVAL_GLOBAL); + assert( zMethod ); + assert( p ); + assert( arg2==0 || arg1!=0 ); + assert( arg3==0 || arg2!=0 ); + + pEval = Tcl_DuplicateObj(p->pScript); + Tcl_IncrRefCount(p->pScript); + Tcl_ListObjAppendElement(p->interp, pEval, Tcl_NewStringObj(zMethod, -1)); + if( arg1 ) Tcl_ListObjAppendElement(p->interp, pEval, arg1); + if( arg2 ) Tcl_ListObjAppendElement(p->interp, pEval, arg2); + if( arg3 ) Tcl_ListObjAppendElement(p->interp, pEval, arg3); + + rc = Tcl_EvalObjEx(p->interp, pEval, TCL_EVAL_GLOBAL); if( rc!=TCL_OK ){ Tcl_BackgroundError(p->interp); Tcl_ResetResult(p->interp); } - - for(nArg=p->nScript; p->apScript[nArg]; nArg++){ - Tcl_DecrRefCount(p->apScript[nArg]); - p->apScript[nArg] = 0; - } } /* ** Close an tvfs-file. @@ -1072,13 +1048,10 @@ case CMD_SCRIPT: { if( objc==3 ){ int nByte; if( p->pScript ){ Tcl_DecrRefCount(p->pScript); - ckfree((char *)p->apScript); - p->apScript = 0; - p->nScript = 0; p->pScript = 0; } Tcl_GetStringFromObj(objv[2], &nByte); if( nByte>0 ){ p->pScript = Tcl_DuplicateObj(objv[2]); @@ -1228,11 +1201,10 @@ static void testvfs_obj_del(ClientData cd){ Testvfs *p = (Testvfs *)cd; if( p->pScript ) Tcl_DecrRefCount(p->pScript); sqlite3_vfs_unregister(p->pVfs); - ckfree((char *)p->apScript); ckfree((char *)p->pVfs); ckfree((char *)p); } /* Index: test/nan.test ================================================================== --- test/nan.test +++ test/nan.test @@ -44,35 +44,35 @@ if {$tcl_platform(platform) != "symbian"} { do_test nan-1.1.2 { sqlite3_bind_double $::STMT 1 +Inf sqlite3_step $::STMT sqlite3_reset $::STMT - db eval {SELECT x, typeof(x) FROM t1} + string tolower [db eval {SELECT x, typeof(x) FROM t1}] } {{} null inf real} do_test nan-1.1.3 { sqlite3_bind_double $::STMT 1 -Inf sqlite3_step $::STMT sqlite3_reset $::STMT - db eval {SELECT x, typeof(x) FROM t1} + string tolower [db eval {SELECT x, typeof(x) FROM t1}] } {{} null inf real -inf real} do_test nan-1.1.4 { sqlite3_bind_double $::STMT 1 -NaN sqlite3_step $::STMT sqlite3_reset $::STMT - db eval {SELECT x, typeof(x) FROM t1} + string tolower [db eval {SELECT x, typeof(x) FROM t1}] } {{} null inf real -inf real {} null} do_test nan-1.1.5 { sqlite3_bind_double $::STMT 1 NaN0 sqlite3_step $::STMT sqlite3_reset $::STMT - db eval {SELECT x, typeof(x) FROM t1} + string tolower [db eval {SELECT x, typeof(x) FROM t1}] } {{} null inf real -inf real {} null {} null} do_test nan-1.1.6 { sqlite3_bind_double $::STMT 1 -NaN0 sqlite3_step $::STMT sqlite3_reset $::STMT - db eval {SELECT x, typeof(x) FROM t1} + string tolower [db eval {SELECT x, typeof(x) FROM t1}] } {{} null inf real -inf real {} null {} null {} null} do_test nan-1.1.7 { db eval { UPDATE t1 SET x=x-x; SELECT x, typeof(x) FROM t1; @@ -232,16 +232,16 @@ # convert from floating point value "-inf" to a string. # do_test nan-4.7 { db eval {DELETE FROM t1} db eval "INSERT INTO t1 VALUES([string repeat 9 309].0)" - db eval {SELECT x, typeof(x) FROM t1} + string tolower [db eval {SELECT x, typeof(x) FROM t1}] } {inf real} do_test nan-4.8 { db eval {DELETE FROM t1} db eval "INSERT INTO t1 VALUES(-[string repeat 9 309].0)" - db eval {SELECT x, typeof(x) FROM t1} + string tolower [db eval {SELECT x, typeof(x) FROM t1}] } {-inf real} } do_test nan-4.9 { db eval {DELETE FROM t1} db eval "INSERT INTO t1 VALUES([string repeat 9 309].0)" @@ -315,11 +315,11 @@ do_test nan-4.20 { db eval {DELETE FROM t1} set big [string repeat 9 10000].0e-9000 db eval "INSERT INTO t1 VALUES($big)" - db eval {SELECT x, typeof(x) FROM t1} + string tolower [db eval {SELECT x, typeof(x) FROM t1}] } {inf real} finish_test