Just created ticket #1224 to remove config.h from build, but there appears
to be no way to attach a patch to the ticket itself. Have I missed
something?
Regardless, the attached patch removes config.h and related pointer
macros from the source files. Pointer differences use standard pointer
subtraction (which I believe is valid) and the busy callback timeout is
handled in the sqlite3 structure and passed to the callback. This patch
does not remove the generation of config.h.
All tests pass regression on Linux on x86.
Patch is public domain.
Christian
--
/"\
\ / ASCII RIBBON CAMPAIGN - AGAINST HTML MAIL
X - AGAINST MS ATTACHMENTS
/ \
Index: src/btree.c
===================================================================
RCS file: /sqlite/sqlite/src/btree.c,v
retrieving revision 1.256
diff -u -d -r1.256 btree.c
--- src/btree.c 29 Mar 2005 13:17:46 -0000 1.256
+++ src/btree.c 26 Apr 2005 16:10:37 -0000
@@ -1216,8 +1216,6 @@
assert( sizeof(u32)==4 );
assert( sizeof(u16)==2 );
assert( sizeof(Pgno)==4 );
- assert( sizeof(ptr)==sizeof(char*) );
- assert( sizeof(uptr)==sizeof(ptr) );
pBt = sqliteMalloc( sizeof(*pBt) );
if( pBt==0 ){
Index: src/build.c
===================================================================
RCS file: /sqlite/sqlite/src/build.c,v
retrieving revision 1.318
diff -u -d -r1.318 build.c
--- src/build.c 29 Mar 2005 03:10:59 -0000 1.318
+++ src/build.c 26 Apr 2005 16:10:37 -0000
@@ -1510,7 +1510,7 @@
if( pSelect ){
zStmt = createTableStmt(p);
}else{
- n = Addr(pEnd->z) - Addr(pParse->sNameToken.z) + 1;
+ n = pEnd->z - pParse->sNameToken.z + 1;
zStmt = sqlite3MPrintf("CREATE %s %.*s", zType2, n,
pParse->sNameToken.z);
}
@@ -2463,7 +2463,7 @@
/* A named index with an explicit CREATE INDEX statement */
zStmt = sqlite3MPrintf("CREATE%s INDEX %.*s",
onError==OE_None ? "" : " UNIQUE",
- Addr(pEnd->z) - Addr(pName->z) + 1,
+ pEnd->z - pName->z + 1,
pName->z);
}else{
/* An automatic index created by a PRIMARY KEY or UNIQUE constraint */
Index: src/expr.c
===================================================================
RCS file: /sqlite/sqlite/src/expr.c,v
retrieving revision 1.198
diff -u -d -r1.198 expr.c
--- src/expr.c 22 Apr 2005 02:38:38 -0000 1.198
+++ src/expr.c 26 Apr 2005 16:10:38 -0000
@@ -265,7 +265,7 @@
assert( pLeft->dyn==0 || pLeft->z[pLeft->n]==0 );
if( pLeft->dyn==0 && pRight->dyn==0 ){
pExpr->span.z = pLeft->z;
- pExpr->span.n = pRight->n + Addr(pRight->z) - Addr(pLeft->z);
+ pExpr->span.n = pRight->n + (pRight->z - pLeft->z);
}else{
pExpr->span.z = 0;
}
Index: src/main.c
===================================================================
RCS file: /sqlite/sqlite/src/main.c,v
retrieving revision 1.285
diff -u -d -r1.285 main.c
--- src/main.c 29 Mar 2005 23:34:58 -0000 1.285
+++ src/main.c 26 Apr 2005 16:10:38 -0000
@@ -614,7 +614,7 @@
** argument.
*/
static int sqliteDefaultBusyCallback(
- void *Timeout, /* Maximum amount of time to wait */
+ void *ptr, /* Database connection */
int count /* Number of times table has been busy */
){
#if SQLITE_MIN_SLEEP_MS==1
@@ -623,8 +623,8 @@
static const short int totals[] =
{ 0, 1, 3, 8, 18, 33, 53, 78, 103, 128, 178, 228, 287};
# define NDELAY (sizeof(delays)/sizeof(delays[0]))
- ptr timeout = (ptr)Timeout;
- ptr delay, prior;
+ int timeout = ((sqlite3 *)ptr)->busy_timeout;
+ int delay, prior;
if( count <= NDELAY ){
delay = delays[count-1];
@@ -699,7 +699,8 @@
*/
int sqlite3_busy_timeout(sqlite3 *db, int ms){
if( ms>0 ){
- sqlite3_busy_handler(db, sqliteDefaultBusyCallback, (void*)(ptr)ms);
+ db->busy_timeout = ms;
+ sqlite3_busy_handler(db, sqliteDefaultBusyCallback, (void*)db);
}else{
sqlite3_busy_handler(db, 0, 0);
}
Index: src/sqliteInt.h
===================================================================
RCS file: /sqlite/sqlite/src/sqliteInt.h,v
retrieving revision 1.376
diff -u -d -r1.376 sqliteInt.h
--- src/sqliteInt.h 22 Apr 2005 02:38:38 -0000 1.376
+++ src/sqliteInt.h 26 Apr 2005 16:10:38 -0000
@@ -39,7 +39,6 @@
# define _LARGEFILE_SOURCE 1
#endif
-#include "config.h"
#include "sqlite3.h"
#include "hash.h"
#include "parse.h"
@@ -180,20 +179,6 @@
#ifndef LONGDOUBLE_TYPE
# define LONGDOUBLE_TYPE long double
#endif
-#ifndef INTPTR_TYPE
-# if SQLITE_PTR_SZ==4
-# define INTPTR_TYPE int
-# else
-# define INTPTR_TYPE sqlite_int64
-# endif
-#endif
-#ifndef UINTPTR_TYPE
-# if SQLITE_PTR_SZ==4
-# define UINTPTR_TYPE unsigned int
-# else
-# define UINTPTR_TYPE sqlite_uint64
-# endif
-#endif
typedef sqlite_int64 i64; /* 8-byte signed integer */
typedef UINT64_TYPE u64; /* 8-byte unsigned integer */
typedef UINT32_TYPE u32; /* 4-byte unsigned integer */
@@ -201,8 +186,6 @@
typedef INT16_TYPE i16; /* 2-byte signed integer */
typedef UINT8_TYPE u8; /* 1-byte unsigned integer */
typedef UINT8_TYPE i8; /* 1-byte signed integer */
-typedef INTPTR_TYPE ptr; /* Big enough to hold a pointer */
-typedef UINTPTR_TYPE uptr; /* Big enough to hold a pointer */
/*
** Macros to determine whether the machine is big or little endian,
@@ -422,6 +405,7 @@
u8 temp_store; /* 1: file 2: memory 0: default */
int nTable; /* Number of tables in the database */
BusyHandler busyHandler; /* Busy callback */
+ int busy_timeout; /* Busy handler timeout, in msec */
void *pCommitArg; /* Argument to xCommitCallback() */
int (*xCommitCallback)(void*);/* Invoked at every commit. */
Hash aFunc; /* All functions that can be in SQL exprs */