/ Check-in [cede2bf8]
Login

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

Overview
Comment:Reduce the number of calls to memset() in sqlite3DbMallocZero().
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: cede2bf8e42ac140a8cc75a1d173083f543ba467
User & Date: drh 2016-01-08 12:46:39
Context
2016-01-08
17:28
Remove an obsolete #ifdef related to iOS support. check-in: e9a51d2a user: drh tags: trunk
12:46
Reduce the number of calls to memset() in sqlite3DbMallocZero(). check-in: cede2bf8 user: drh tags: trunk
08:35
Fix test file vtabH.test so that it works with SQLITE_ENABLE_ICU builds. check-in: 19c1f448 user: dan tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/expr.c.

   457    457     if( pToken ){
   458    458       if( op!=TK_INTEGER || pToken->z==0
   459    459             || sqlite3GetInt32(pToken->z, &iValue)==0 ){
   460    460         nExtra = pToken->n+1;
   461    461         assert( iValue>=0 );
   462    462       }
   463    463     }
   464         -  pNew = sqlite3DbMallocZero(db, sizeof(Expr)+nExtra);
          464  +  pNew = sqlite3DbMallocRaw(db, sizeof(Expr)+nExtra);
   465    465     if( pNew ){
          466  +    memset(pNew, 0, sizeof(Expr));
   466    467       pNew->op = (u8)op;
   467    468       pNew->iAgg = -1;
   468    469       if( pToken ){
   469    470         if( nExtra==0 ){
   470    471           pNew->flags |= EP_IntValue;
   471    472           pNew->u.iValue = iValue;
   472    473         }else{

Changes to src/select.c.

   107    107     u16 selFlags,         /* Flag parameters, such as SF_Distinct */
   108    108     Expr *pLimit,         /* LIMIT value.  NULL means not used */
   109    109     Expr *pOffset         /* OFFSET value.  NULL means no offset */
   110    110   ){
   111    111     Select *pNew;
   112    112     Select standin;
   113    113     sqlite3 *db = pParse->db;
   114         -  pNew = sqlite3DbMallocZero(db, sizeof(*pNew) );
          114  +  pNew = sqlite3DbMallocRaw(db, sizeof(*pNew) );
   115    115     if( pNew==0 ){
   116    116       assert( db->mallocFailed );
   117    117       pNew = &standin;
   118         -    memset(pNew, 0, sizeof(*pNew));
   119    118     }
   120    119     if( pEList==0 ){
   121    120       pEList = sqlite3ExprListAppend(pParse, 0, sqlite3Expr(db,TK_ASTERISK,0));
   122    121     }
   123    122     pNew->pEList = pEList;
          123  +  pNew->op = TK_SELECT;
          124  +  pNew->selFlags = selFlags;
          125  +  pNew->iLimit = 0;
          126  +  pNew->iOffset = 0;
          127  +  pNew->addrOpenEphm[0] = -1;
          128  +  pNew->addrOpenEphm[1] = -1;
          129  +  pNew->nSelectRow = 0;
   124    130     if( pSrc==0 ) pSrc = sqlite3DbMallocZero(db, sizeof(*pSrc));
   125    131     pNew->pSrc = pSrc;
   126    132     pNew->pWhere = pWhere;
   127    133     pNew->pGroupBy = pGroupBy;
   128    134     pNew->pHaving = pHaving;
   129    135     pNew->pOrderBy = pOrderBy;
   130         -  pNew->selFlags = selFlags;
   131         -  pNew->op = TK_SELECT;
          136  +  pNew->pPrior = 0;
          137  +  pNew->pNext = 0;
   132    138     pNew->pLimit = pLimit;
   133    139     pNew->pOffset = pOffset;
          140  +  pNew->pWith = 0;
   134    141     assert( pOffset==0 || pLimit!=0 || pParse->nErr>0 || db->mallocFailed!=0 );
   135         -  pNew->addrOpenEphm[0] = -1;
   136         -  pNew->addrOpenEphm[1] = -1;
   137    142     if( db->mallocFailed ) {
   138    143       clearSelect(db, pNew, pNew!=&standin);
   139    144       pNew = 0;
   140    145     }else{
   141    146       assert( pNew->pSrc!=0 || pParse->nErr>0 );
   142    147     }
   143    148     assert( pNew!=&standin );