SQLite

Check-in [a2304a3474]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Make sure the %z optimization for printf() is not invoked if there has been a prior error (SQLITE_NOMEM or SQLITE_TOOBIG) associated with the same printf() call.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: a2304a3474b0ca35eee0af64286ce2f7cb24d181323e128d5f04f7fe6e1c0980
User & Date: drh 2018-09-13 17:07:12.853
Context
2018-09-13
17:11
Update releasetest.tcl to run "make test" as part of the "Fast-One" configuration. (check-in: d5ebfe1c75 user: dan tags: trunk)
17:07
Make sure the %z optimization for printf() is not invoked if there has been a prior error (SQLITE_NOMEM or SQLITE_TOOBIG) associated with the same printf() call. (check-in: a2304a3474 user: drh tags: trunk)
13:17
Fix a requirement mark on a test script. No changes to code. (check-in: 628d5c0aa0 user: drh tags: trunk)
Changes
Unified Diff Show Whitespace Changes Patch
Changes to src/printf.c.
682
683
684
685
686
687
688
689





690
691
692
693
694
695
696
          xtype = etSTRING;
        }else{
          bufpt = va_arg(ap,char*);
        }
        if( bufpt==0 ){
          bufpt = "";
        }else if( xtype==etDYNSTRING ){
          if( pAccum->nChar==0 && pAccum->mxAlloc && width==0 && precision<0 ){





            /* Special optimization for sqlite3_mprintf("%z..."):
            ** Extend an existing memory allocation rather than creating
            ** a new one. */
            assert( (pAccum->printfFlags&SQLITE_PRINTF_MALLOCED)==0 );
            pAccum->zText = bufpt;
            pAccum->nAlloc = sqlite3DbMallocSize(pAccum->db, bufpt);
            pAccum->nChar = 0x7fffffff & (int)strlen(bufpt);







|
>
>
>
>
>







682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
          xtype = etSTRING;
        }else{
          bufpt = va_arg(ap,char*);
        }
        if( bufpt==0 ){
          bufpt = "";
        }else if( xtype==etDYNSTRING ){
          if( pAccum->nChar==0
           && pAccum->mxAlloc
           && width==0
           && precision<0
           && pAccum->accError==0
          ){
            /* Special optimization for sqlite3_mprintf("%z..."):
            ** Extend an existing memory allocation rather than creating
            ** a new one. */
            assert( (pAccum->printfFlags&SQLITE_PRINTF_MALLOCED)==0 );
            pAccum->zText = bufpt;
            pAccum->nAlloc = sqlite3DbMallocSize(pAccum->db, bufpt);
            pAccum->nChar = 0x7fffffff & (int)strlen(bufpt);