mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-09 14:21:03 +03:00
Remove dead code from the lemon-generated parser. Better testing
of the sqlite3_file_control() interface, and in particular make sure the interface works on :memory: databases. (CVS 4738) FossilOrigin-Name: 83ca4fc7dc18d6deca58fe4181905eb9754e03da
This commit is contained in:
40
src/util.c
40
src/util.c
@@ -14,7 +14,7 @@
|
||||
** This file contains functions for allocating memory, comparing
|
||||
** strings, and stuff like that.
|
||||
**
|
||||
** $Id: util.c,v 1.214 2008/01/18 14:08:25 drh Exp $
|
||||
** $Id: util.c,v 1.215 2008/01/22 14:50:17 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include <stdarg.h>
|
||||
@@ -443,25 +443,6 @@ int sqlite3GetInt32(const char *zNum, int *pValue){
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
** Check to make sure we have a valid db pointer. This test is not
|
||||
** foolproof but it does provide some measure of protection against
|
||||
** misuse of the interface such as passing in db pointers that are
|
||||
** NULL or which have been previously closed. If this routine returns
|
||||
** TRUE it means that the db pointer is invalid and should not be
|
||||
** dereferenced for any reason. The calling function should invoke
|
||||
** SQLITE_MISUSE immediately.
|
||||
*/
|
||||
int sqlite3SafetyCheck(sqlite3 *db){
|
||||
int magic;
|
||||
if( db==0 ) return 1;
|
||||
magic = db->magic;
|
||||
if( magic!=SQLITE_MAGIC_CLOSED &&
|
||||
magic!=SQLITE_MAGIC_OPEN &&
|
||||
magic!=SQLITE_MAGIC_BUSY ) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
** The variable-length integer encoding is as follows:
|
||||
**
|
||||
@@ -705,3 +686,22 @@ int sqlite3SafetyOff(sqlite3 *db){
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** Check to make sure we have a valid db pointer. This test is not
|
||||
** foolproof but it does provide some measure of protection against
|
||||
** misuse of the interface such as passing in db pointers that are
|
||||
** NULL or which have been previously closed. If this routine returns
|
||||
** TRUE it means that the db pointer is invalid and should not be
|
||||
** dereferenced for any reason. The calling function should invoke
|
||||
** SQLITE_MISUSE immediately.
|
||||
*/
|
||||
int sqlite3SafetyCheck(sqlite3 *db){
|
||||
int magic;
|
||||
if( db==0 ) return 1;
|
||||
magic = db->magic;
|
||||
if( magic!=SQLITE_MAGIC_CLOSED &&
|
||||
magic!=SQLITE_MAGIC_OPEN &&
|
||||
magic!=SQLITE_MAGIC_BUSY ) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user