mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-08 14:02:16 +03:00
Half-way through a major refactoring of the memory allocation.
I have not even attempted to compile so I am certain there are countless errors. (CVS 4231) FossilOrigin-Name: deb7ecd65f7b83eaf0ba610eeef3b0ede61db1c3
This commit is contained in:
@@ -175,7 +175,8 @@ static int sqlite3Step(Vdbe *p){
|
||||
int rc;
|
||||
|
||||
/* Assert that malloc() has not failed */
|
||||
assert( !sqlite3MallocFailed() );
|
||||
db = p->db;
|
||||
assert( !db->mallocFailed );
|
||||
|
||||
if( p==0 || p->magic!=VDBE_MAGIC_RUN ){
|
||||
return SQLITE_MISUSE;
|
||||
@@ -190,7 +191,6 @@ static int sqlite3Step(Vdbe *p){
|
||||
rc = SQLITE_ERROR;
|
||||
goto end_of_step;
|
||||
}
|
||||
db = p->db;
|
||||
if( sqlite3SafetyOn(db) ){
|
||||
p->rc = SQLITE_MISUSE;
|
||||
return SQLITE_MISUSE;
|
||||
@@ -358,7 +358,7 @@ void *sqlite3_aggregate_context(sqlite3_context *p, int nByte){
|
||||
pMem->z = pMem->zShort;
|
||||
memset(pMem->z, 0, nByte);
|
||||
}else{
|
||||
pMem->z = sqliteMalloc( nByte );
|
||||
pMem->z = sqlite3DbMallocZero(p->db, nByte);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -395,8 +395,11 @@ void sqlite3_set_auxdata(
|
||||
pVdbeFunc = pCtx->pVdbeFunc;
|
||||
if( !pVdbeFunc || pVdbeFunc->nAux<=iArg ){
|
||||
int nMalloc = sizeof(VdbeFunc) + sizeof(struct AuxData)*iArg;
|
||||
pVdbeFunc = sqliteRealloc(pVdbeFunc, nMalloc);
|
||||
if( !pVdbeFunc ) goto failed;
|
||||
pVdbeFunc = sqlite3_realloc(pVdbeFunc, nMalloc);
|
||||
if( !pVdbeFunc ){
|
||||
pCtx->db->mallocFailed = 1;
|
||||
goto failed;
|
||||
}
|
||||
pCtx->pVdbeFunc = pVdbeFunc;
|
||||
memset(&pVdbeFunc->apAux[pVdbeFunc->nAux], 0,
|
||||
sizeof(struct AuxData)*(iArg+1-pVdbeFunc->nAux));
|
||||
|
Reference in New Issue
Block a user