/ Check-in [82b7a6f0]
Login

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

Overview
Comment:Remove unreachable code from util.c. (CVS 3784)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:82b7a6f05c737f6ad4a21f354e55ec268fa1b032
User & Date: drh 2007-03-31 22:33:48
Context
2007-03-31
22:34
Improvements to the output of the speed tests. (CVS 3785) check-in: 1a4d8024 user: drh tags: trunk
22:33
Remove unreachable code from util.c. (CVS 3784) check-in: 82b7a6f0 user: drh tags: trunk
22:29
Add the amalgamation generator to the makefile. (CVS 3783) check-in: a0f3c960 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/util.c.

    10     10   **
    11     11   *************************************************************************
    12     12   ** Utility functions used throughout sqlite.
    13     13   **
    14     14   ** This file contains functions for allocating memory, comparing
    15     15   ** strings, and stuff like that.
    16     16   **
    17         -** $Id: util.c,v 1.197 2007/03/27 13:36:37 drh Exp $
           17  +** $Id: util.c,v 1.198 2007/03/31 22:33:48 drh Exp $
    18     18   */
    19     19   #include "sqliteInt.h"
    20     20   #include "os.h"
    21     21   #include <stdarg.h>
    22     22   #include <ctype.h>
    23     23   
    24     24   /*
................................................................................
  1128   1128   }
  1129   1129   
  1130   1130   
  1131   1131   /*
  1132   1132   ** Change the sqlite.magic from SQLITE_MAGIC_OPEN to SQLITE_MAGIC_BUSY.
  1133   1133   ** Return an error (non-zero) if the magic was not SQLITE_MAGIC_OPEN
  1134   1134   ** when this routine is called.
         1135  +**
         1136  +** This routine is called when entering an SQLite API.  The SQLITE_MAGIC_OPEN
         1137  +** value indicates that the database connection passed into the API is
         1138  +** open and is not being used by another thread.  By changing the value
         1139  +** to SQLITE_MAGIC_BUSY we indicate that the connection is in use.
         1140  +** sqlite3SafetyOff() below will change the value back to SQLITE_MAGIC_OPEN
         1141  +** when the API exits. 
  1135   1142   **
  1136   1143   ** This routine is a attempt to detect if two threads use the
  1137   1144   ** same sqlite* pointer at the same time.  There is a race 
  1138   1145   ** condition so it is possible that the error is not detected.
  1139   1146   ** But usually the problem will be seen.  The result will be an
  1140   1147   ** error which can be used to debug the application that is
  1141   1148   ** using SQLite incorrectly.
................................................................................
  1162   1169   ** Return an error (non-zero) if the magic was not SQLITE_MAGIC_BUSY
  1163   1170   ** when this routine is called.
  1164   1171   */
  1165   1172   int sqlite3SafetyOff(sqlite3 *db){
  1166   1173     if( db->magic==SQLITE_MAGIC_BUSY ){
  1167   1174       db->magic = SQLITE_MAGIC_OPEN;
  1168   1175       return 0;
  1169         -  }else if( db->magic==SQLITE_MAGIC_OPEN ){
         1176  +  }else {
  1170   1177       db->magic = SQLITE_MAGIC_ERROR;
  1171   1178       db->u1.isInterrupted = 1;
         1179  +    return 1;
  1172   1180     }
  1173         -  return 1;
  1174   1181   }
  1175   1182   
  1176   1183   /*
  1177   1184   ** Check to make sure we have a valid db pointer.  This test is not
  1178   1185   ** foolproof but it does provide some measure of protection against
  1179   1186   ** misuse of the interface such as passing in db pointers that are
  1180   1187   ** NULL or which have been previously closed.  If this routine returns