diff options
author | drh <drh@noemail.net> | 2014-11-18 21:20:57 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2014-11-18 21:20:57 +0000 |
commit | 04e8a5866948996e4dd1540a9a736d00609c27e8 (patch) | |
tree | fcf53188c46e77ce3d90818bc17e118298813b18 /src/printf.c | |
parent | ca3e10ea37c4808fa84063f06b02229801b28cc0 (diff) | |
parent | 64b600ff13d4bac1d459cf54b649b45e520aba4c (diff) | |
download | sqlite-04e8a5866948996e4dd1540a9a736d00609c27e8.tar.gz sqlite-04e8a5866948996e4dd1540a9a736d00609c27e8.zip |
Merge recent trunk enhancements, including the read-after-ROLLBACK change
and the addition of sqlite3_stmt_scanstatus() support, as well as various
minor bug fixes.
FossilOrigin-Name: f09055f3c4348264c7336f90646375f0d98b061e
Diffstat (limited to 'src/printf.c')
-rw-r--r-- | src/printf.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/printf.c b/src/printf.c index 85d237f0e..ac7b05163 100644 --- a/src/printf.c +++ b/src/printf.c @@ -770,6 +770,11 @@ static int sqlite3StrAccumEnlarge(StrAccum *p, int N){ char *zOld = (p->zText==p->zBase ? 0 : p->zText); i64 szNew = p->nChar; szNew += N + 1; + if( szNew+p->nChar<=p->mxAlloc ){ + /* Force exponential buffer size growth as long as it does not overflow, + ** to avoid having to call this routine too often */ + szNew += p->nChar; + } if( szNew > p->mxAlloc ){ sqlite3StrAccumReset(p); setStrAccumError(p, STRACCUM_TOOBIG); @@ -786,6 +791,7 @@ static int sqlite3StrAccumEnlarge(StrAccum *p, int N){ assert( p->zText!=0 || p->nChar==0 ); if( zOld==0 && p->nChar>0 ) memcpy(zNew, p->zText, p->nChar); p->zText = zNew; + p->nAlloc = sqlite3DbMallocSize(p->db, zNew); }else{ sqlite3StrAccumReset(p); setStrAccumError(p, STRACCUM_NOMEM); |