1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +03:00

Add the sqlite3VdbeMemClearAndResize() interface to be used in place of

sqlite3VdbeMemGrow().

FossilOrigin-Name: 5b9b8987797abf7c68d2c3154f6657be9b8b1c8f
This commit is contained in:
drh
2014-09-19 00:43:39 +00:00
parent 17bcb10299
commit 322f2852f2
8 changed files with 53 additions and 25 deletions

View File

@@ -209,7 +209,7 @@ static VdbeCursor *allocateCursor(
sqlite3VdbeFreeCursor(p, p->apCsr[iCur]);
p->apCsr[iCur] = 0;
}
if( SQLITE_OK==sqlite3VdbeMemGrow(pMem, nByte, 0) ){
if( SQLITE_OK==sqlite3VdbeMemClearAndResize(pMem, nByte) ){
p->apCsr[iCur] = pCx = (VdbeCursor*)pMem->z;
memset(pCx, 0, sizeof(VdbeCursor));
pCx->iDb = iDb;
@@ -2633,9 +2633,9 @@ case OP_MakeRecord: {
/* Make sure the output register has a buffer large enough to store
** the new record. The output register (pOp->p3) is not allowed to
** be one of the input registers (because the following call to
** sqlite3VdbeMemGrow() could clobber the value before it is used).
** sqlite3VdbeMemClearAndResize() could clobber the value before it is used).
*/
if( sqlite3VdbeMemGrow(pOut, (int)nByte, 0) ){
if( sqlite3VdbeMemClearAndResize(pOut, (int)nByte) ){
goto no_mem;
}
zNewRecord = (u8 *)pOut->z;
@@ -4339,7 +4339,7 @@ case OP_RowData: {
goto too_big;
}
}
if( sqlite3VdbeMemGrow(pOut, n, 0) ){
if( sqlite3VdbeMemClearAndResize(pOut, n) ){
goto no_mem;
}
pOut->n = n;