diff options
author | drh <drh@noemail.net> | 2010-08-27 17:16:44 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2010-08-27 17:16:44 +0000 |
commit | badc980afa4ae2fb94cce8182bb31346ed91f7c7 (patch) | |
tree | 7b306bd12743145fef72851565ef1855f8bdfd46 /src/main.c | |
parent | 50d1b5f363ffde5be8ade2b0e774fe75f7c9359c (diff) | |
download | sqlite-badc980afa4ae2fb94cce8182bb31346ed91f7c7.tar.gz sqlite-badc980afa4ae2fb94cce8182bb31346ed91f7c7.zip |
Refactor the implementation of the scratch memory allocator. Add the
SQLITE_TESTCTRL_SCRATCHMALLOC interface to facilitate testing.
FossilOrigin-Name: a3475ddfbe4526e6e0b334fd1376ee7c31508b80
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c index c82a82e46..3b04b75e6 100644 --- a/src/main.c +++ b/src/main.c @@ -2513,6 +2513,22 @@ int sqlite3_test_control(int op, ...){ break; } + /* sqlite3_test_control(SQLITE_TESTCTRL_SCRATCHMALLOC, sz, &pNew, pFree); + ** + ** Pass pFree into sqlite3ScratchFree(). + ** If sz>0 then allocate a scratch buffer into pNew. + */ + case SQLITE_TESTCTRL_SCRATCHMALLOC: { + void *pFree, **ppNew; + int sz; + sz = va_arg(ap, int); + ppNew = va_arg(ap, void**); + pFree = va_arg(ap, void*); + if( sz ) *ppNew = sqlite3ScratchMalloc(sz); + sqlite3ScratchFree(pFree); + break; + } + } va_end(ap); #endif /* SQLITE_OMIT_BUILTIN_TEST */ |