1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-06 15:49:35 +03:00

Malloc for space to hold the Parse object in sqlite3_prepare() and friends.

Or, if compiled with SQLITE_USE_ALLOCA, obtain space for the object from
alloca(). (CVS 6702)

FossilOrigin-Name: c7c0c58e472cd8277b2ad58bb60834190bace4fa
This commit is contained in:
drh
2009-06-01 18:18:20 +00:00
parent ddfefca736
commit e7b3470705
4 changed files with 88 additions and 53 deletions

View File

@@ -11,7 +11,7 @@
*************************************************************************
** Internal interface definitions for SQLite.
**
** @(#) $Id: sqliteInt.h,v 1.879 2009/05/30 14:16:32 drh Exp $
** @(#) $Id: sqliteInt.h,v 1.880 2009/06/01 18:18:21 drh Exp $
*/
#ifndef _SQLITEINT_H_
#define _SQLITEINT_H_
@@ -475,6 +475,7 @@ extern const int sqlite3one;
*/
#define EIGHT_BYTE_ALIGNMENT(X) ((((char*)(X) - (char*)0)&7)==0)
/*
** An instance of the following structure is used to store the busy-handler
** callback for a given sqlite handle.
@@ -2360,6 +2361,24 @@ void sqlite3MemSetDefault(void);
void sqlite3BenignMallocHooks(void (*)(void), void (*)(void));
int sqlite3MemoryAlarm(void (*)(void*, sqlite3_int64, int), void*, sqlite3_int64);
/*
** On systems with ample stack space and that support alloca(), make
** use of alloca() to obtain space for large automatic objects. By default,
** obtain space from malloc().
**
** The alloca() routine never returns NULL. This will cause code paths
** that deal with sqlite3StackAlloc() failures to be unreachable.
*/
#ifdef SQLITE_USE_ALLOCA
# define sqlite3StackAllocRaw(D,N) alloca(N)
# define sqlite3StackAllocZero(D,N) memset(alloca(N), 0, N)
# define sqlite3StackFree(D,P)
#else
# define sqlite3StackAllocRaw(D,N) sqlite3DbMallocRaw(D,N)
# define sqlite3StackAllocZero(D,N) sqlite3DbMallocZero(D,N)
# define sqlite3StackFree(D,P) sqlite3DbFree(D,P)
#endif
#ifdef SQLITE_ENABLE_MEMSYS3
const sqlite3_mem_methods *sqlite3MemGetMemsys3(void);
#endif