1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-05 15:55:57 +03:00

Modify a few test scripts to avoid leaving the sqlite3Config structure in a non-default state.

FossilOrigin-Name: 562687d9f56bf4bb0f5f07f97cbbb7649c81faf8
This commit is contained in:
dan
2015-07-24 14:17:17 +00:00
parent f6972c3764
commit 03bc525a51
11 changed files with 88 additions and 39 deletions

View File

@@ -939,7 +939,7 @@ static int test_config_pagecache(
Tcl_Obj *CONST objv[]
){
int sz, N, rc;
Tcl_Obj *pResult;
Tcl_Obj *pRes;
static char *buf = 0;
if( objc!=3 ){
Tcl_WrongNumArgs(interp, 1, objv, "SIZE N");
@@ -948,17 +948,20 @@ static int test_config_pagecache(
if( Tcl_GetIntFromObj(interp, objv[1], &sz) ) return TCL_ERROR;
if( Tcl_GetIntFromObj(interp, objv[2], &N) ) return TCL_ERROR;
free(buf);
buf = 0;
/* Set the return value */
pRes = Tcl_NewObj();
Tcl_ListObjAppendElement(0, pRes, Tcl_NewIntObj(sqlite3GlobalConfig.szPage));
Tcl_ListObjAppendElement(0, pRes, Tcl_NewIntObj(sqlite3GlobalConfig.nPage));
Tcl_SetObjResult(interp, pRes);
if( sz<0 ){
buf = 0;
rc = sqlite3_config(SQLITE_CONFIG_PAGECACHE, 0, 0, 0);
}else{
buf = malloc( sz*N );
rc = sqlite3_config(SQLITE_CONFIG_PAGECACHE, buf, sz, N);
}
pResult = Tcl_NewObj();
Tcl_ListObjAppendElement(0, pResult, Tcl_NewIntObj(rc));
Tcl_ListObjAppendElement(0, pResult, Tcl_NewIntObj(N));
Tcl_SetObjResult(interp, pResult);
return TCL_OK;
}