/ Check-in [ff5e733c]
Login

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

Overview
Comment:Change two MallocZero() calls into MallocRaw() to avoid unnecessary memset().
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: ff5e733cbffd73faa4046e0f1c7f24bb6e131738
User & Date: drh 2017-02-16 17:18:07
Context
2017-02-16
20:52
Change the name of WhereInfo.pDistinctSet to pResultSet, since it is now used for more than just DISTINCT processing. check-in: 9fc5cd50 user: drh tags: trunk
17:18
Change two MallocZero() calls into MallocRaw() to avoid unnecessary memset(). check-in: ff5e733c user: drh tags: trunk
16:26
Fix a comment on a field of the ExprList object. No changes to code. check-in: bb8e2642 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/expr.c.

  2363   2363   static char *exprINAffinity(Parse *pParse, Expr *pExpr){
  2364   2364     Expr *pLeft = pExpr->pLeft;
  2365   2365     int nVal = sqlite3ExprVectorSize(pLeft);
  2366   2366     Select *pSelect = (pExpr->flags & EP_xIsSelect) ? pExpr->x.pSelect : 0;
  2367   2367     char *zRet;
  2368   2368   
  2369   2369     assert( pExpr->op==TK_IN );
  2370         -  zRet = sqlite3DbMallocZero(pParse->db, nVal+1);
         2370  +  zRet = sqlite3DbMallocRaw(pParse->db, nVal+1);
  2371   2371     if( zRet ){
  2372   2372       int i;
  2373   2373       for(i=0; i<nVal; i++){
  2374   2374         Expr *pA = sqlite3VectorFieldSubexpr(pLeft, i);
  2375   2375         char a = sqlite3ExprAffinity(pA);
  2376   2376         if( pSelect ){
  2377   2377           zRet[i] = sqlite3CompareAffinity(pSelect->pEList->a[i].pExpr, a);

Changes to src/legacy.c.

    69     69         rc = sqlite3_step(pStmt);
    70     70   
    71     71         /* Invoke the callback function if required */
    72     72         if( xCallback && (SQLITE_ROW==rc || 
    73     73             (SQLITE_DONE==rc && !callbackIsInit
    74     74                              && db->flags&SQLITE_NullCallback)) ){
    75     75           if( !callbackIsInit ){
    76         -          azCols = sqlite3DbMallocZero(db, 2*nCol*sizeof(const char*) + 1);
           76  +          azCols = sqlite3DbMallocRaw(db, (2*nCol+1)*sizeof(const char*));
    77     77             if( azCols==0 ){
    78     78               goto exec_out;
    79     79             }
    80     80             for(i=0; i<nCol; i++){
    81     81               azCols[i] = (char *)sqlite3_column_name(pStmt, i);
    82     82               /* sqlite3VdbeSetColName() installs column names as UTF8
    83     83               ** strings so there is no way for sqlite3_column_name() to fail. */
................................................................................
    90     90             for(i=0; i<nCol; i++){
    91     91               azVals[i] = (char *)sqlite3_column_text(pStmt, i);
    92     92               if( !azVals[i] && sqlite3_column_type(pStmt, i)!=SQLITE_NULL ){
    93     93                 sqlite3OomFault(db);
    94     94                 goto exec_out;
    95     95               }
    96     96             }
           97  +          azVals[i] = 0;
    97     98           }
    98     99           if( xCallback(pArg, nCol, azVals, azCols) ){
    99    100             /* EVIDENCE-OF: R-38229-40159 If the callback function to
   100    101             ** sqlite3_exec() returns non-zero, then sqlite3_exec() will
   101    102             ** return SQLITE_ABORT. */
   102    103             rc = SQLITE_ABORT;
   103    104             sqlite3VdbeFinalize((Vdbe *)pStmt);