SQLite

Check-in [88b84bf18a]
Login

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

Overview
Comment:Replace some unreachable branch instructions with assert() statements.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | bug-b351d95f9c
Files: files | file ages | folders
SHA1: 88b84bf18a4b27626f8a0a2d313706ddd4f13749
User & Date: drh 2010-09-28 07:11:24.000
Context
2010-09-28
07:14
Merge fixes for ticket [b351d95f9cd5ef17e9d9dbae18f5ca8611190001] into the trunk. (check-in: 1f7ef0af8d user: drh tags: trunk)
07:11
Replace some unreachable branch instructions with assert() statements. (Closed-Leaf check-in: 88b84bf18a user: drh tags: bug-b351d95f9c)
06:00
Tweaks to help facilitate structural test coverage. (check-in: ff49a5f00b user: drh tags: bug-b351d95f9c)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/expr.c.
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
  int target,        /* Where to write results */
  int doHardCopy     /* Make a hard copy of every element */
){
  struct ExprList_item *pItem;
  int i, n;
  assert( pList!=0 );
  assert( target>0 );
  assert( pParse->pVdbe || pParse->db->mallocFailed );
  if( pParse->pVdbe==0 ) return 0;
  n = pList->nExpr;
  for(pItem=pList->a, i=0; i<n; i++, pItem++){
    Expr *pExpr = pItem->pExpr;
    int inReg = sqlite3ExprCodeTarget(pParse, pExpr, target+i);
    if( inReg!=target+i ){
      sqlite3VdbeAddOp2(pParse->pVdbe, doHardCopy ? OP_Copy : OP_SCopy,
                        inReg, target+i);







|
<







3048
3049
3050
3051
3052
3053
3054
3055

3056
3057
3058
3059
3060
3061
3062
  int target,        /* Where to write results */
  int doHardCopy     /* Make a hard copy of every element */
){
  struct ExprList_item *pItem;
  int i, n;
  assert( pList!=0 );
  assert( target>0 );
  assert( pParse->pVdbe!=0 );  /* Never gets this far otherwise */

  n = pList->nExpr;
  for(pItem=pList->a, i=0; i<n; i++, pItem++){
    Expr *pExpr = pItem->pExpr;
    int inReg = sqlite3ExprCodeTarget(pParse, pExpr, target+i);
    if( inReg!=target+i ){
      sqlite3VdbeAddOp2(pParse->pVdbe, doHardCopy ? OP_Copy : OP_SCopy,
                        inReg, target+i);
Changes to src/vdbe.c.
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
#ifdef SQLITE_DEBUG
      { int i; for(i=0; i<r.nField; i++) assert( memIsValid(&r.aMem[i]) ); }
#endif
      r.flags = UNPACKED_PREFIX_MATCH;
      pIdxKey = &r;
    }else{
      assert( pIn3->flags & MEM_Blob );
      ExpandBlob(pIn3);
      pIdxKey = sqlite3VdbeRecordUnpack(pC->pKeyInfo, pIn3->n, pIn3->z,
                                        aTempRec, sizeof(aTempRec));
      if( pIdxKey==0 ){
        goto no_mem;
      }
      pIdxKey->flags |= UNPACKED_PREFIX_MATCH;
    }







|







3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
#ifdef SQLITE_DEBUG
      { int i; for(i=0; i<r.nField; i++) assert( memIsValid(&r.aMem[i]) ); }
#endif
      r.flags = UNPACKED_PREFIX_MATCH;
      pIdxKey = &r;
    }else{
      assert( pIn3->flags & MEM_Blob );
      assert( (pIn3->flags & MEM_Zero)==0 );  /* zeroblobs already expanded */
      pIdxKey = sqlite3VdbeRecordUnpack(pC->pKeyInfo, pIn3->n, pIn3->z,
                                        aTempRec, sizeof(aTempRec));
      if( pIdxKey==0 ){
        goto no_mem;
      }
      pIdxKey->flags |= UNPACKED_PREFIX_MATCH;
    }