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:
@@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user