diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/alter.c | 5 | ||||
-rw-r--r-- | src/build.c | 9 | ||||
-rw-r--r-- | src/date.c | 19 | ||||
-rw-r--r-- | src/expr.c | 7 | ||||
-rw-r--r-- | src/func.c | 13 | ||||
-rw-r--r-- | src/global.c | 67 | ||||
-rw-r--r-- | src/legacy.c | 5 | ||||
-rw-r--r-- | src/loadext.c | 3 | ||||
-rw-r--r-- | src/main.c | 3 | ||||
-rw-r--r-- | src/malloc.c | 3 | ||||
-rw-r--r-- | src/pragma.c | 5 | ||||
-rw-r--r-- | src/prepare.c | 3 | ||||
-rw-r--r-- | src/sqliteInt.h | 25 | ||||
-rw-r--r-- | src/test2.c | 6 | ||||
-rw-r--r-- | src/tokenize.c | 25 | ||||
-rw-r--r-- | src/util.c | 25 | ||||
-rw-r--r-- | src/vdbe.c | 3 | ||||
-rw-r--r-- | src/vdbeaux.c | 9 | ||||
-rw-r--r-- | src/vdbemem.c | 3 |
19 files changed, 155 insertions, 83 deletions
diff --git a/src/alter.c b/src/alter.c index 9733c56cd..f7c60266d 100644 --- a/src/alter.c +++ b/src/alter.c @@ -12,10 +12,9 @@ ** This file contains C code routines that used to generate VDBE code ** that implements the ALTER TABLE command. ** -** $Id: alter.c,v 1.51 2008/12/10 19:26:22 drh Exp $ +** $Id: alter.c,v 1.52 2009/01/20 16:53:40 danielk1977 Exp $ */ #include "sqliteInt.h" -#include <ctype.h> /* ** The code in this file only exists if we are not omitting the @@ -513,7 +512,7 @@ void sqlite3AlterFinishAddColumn(Parse *pParse, Token *pColDef){ zCol = sqlite3DbStrNDup(db, (char*)pColDef->z, pColDef->n); if( zCol ){ char *zEnd = &zCol[pColDef->n-1]; - while( (zEnd>zCol && *zEnd==';') || isspace(*(unsigned char *)zEnd) ){ + while( (zEnd>zCol && *zEnd==';') || sqlite3Isspace(*zEnd) ){ *zEnd-- = '\0'; } sqlite3NestedParse(pParse, diff --git a/src/build.c b/src/build.c index c61fbb340..27ded7ebb 100644 --- a/src/build.c +++ b/src/build.c @@ -22,10 +22,9 @@ ** COMMIT ** ROLLBACK ** -** $Id: build.c,v 1.511 2008/12/30 06:24:58 danielk1977 Exp $ +** $Id: build.c,v 1.512 2009/01/20 16:53:40 danielk1977 Exp $ */ #include "sqliteInt.h" -#include <ctype.h> /* ** This routine is called when a new SQL statement is beginning to @@ -1339,9 +1338,9 @@ static void identPut(char *z, int *pIdx, char *zSignedIdent){ int i, j, needQuote; i = *pIdx; for(j=0; zIdent[j]; j++){ - if( !isalnum(zIdent[j]) && zIdent[j]!='_' ) break; + if( !sqlite3Isalnum(zIdent[j]) && zIdent[j]!='_' ) break; } - needQuote = zIdent[j]!=0 || isdigit(zIdent[0]) + needQuote = zIdent[j]!=0 || sqlite3Isdigit(zIdent[0]) || sqlite3KeywordCode(zIdent, j)!=TK_ID; if( needQuote ) z[i++] = '"'; for(j=0; zIdent[j]; j++){ @@ -1712,7 +1711,7 @@ void sqlite3CreateView( sEnd.n = 0; n = (int)(sEnd.z - pBegin->z); z = (const unsigned char*)pBegin->z; - while( n>0 && (z[n-1]==';' || isspace(z[n-1])) ){ n--; } + while( n>0 && (z[n-1]==';' || sqlite3Isspace(z[n-1])) ){ n--; } sEnd.z = &z[n-1]; sEnd.n = 1; diff --git a/src/date.c b/src/date.c index ae991255e..ea487a970 100644 --- a/src/date.c +++ b/src/date.c @@ -16,7 +16,7 @@ ** sqlite3RegisterDateTimeFunctions() found at the bottom of the file. ** All other code has file scope. ** -** $Id: date.c,v 1.99 2008/12/20 13:18:50 drh Exp $ +** $Id: date.c,v 1.100 2009/01/20 16:53:40 danielk1977 Exp $ ** ** SQLite processes all times and dates as Julian Day numbers. The ** dates and times are stored as the number of days since noon @@ -46,7 +46,6 @@ ** Richmond, Virginia (USA) */ #include "sqliteInt.h" -#include <ctype.h> #include <stdlib.h> #include <assert.h> #include <time.h> @@ -118,7 +117,7 @@ static int getDigits(const char *zDate, ...){ pVal = va_arg(ap, int*); val = 0; while( N-- ){ - if( !isdigit(*(u8*)zDate) ){ + if( !sqlite3Isdigit(*zDate) ){ goto end_getDigits; } val = val*10 + *zDate - '0'; @@ -162,7 +161,7 @@ static int parseTimezone(const char *zDate, DateTime *p){ int sgn = 0; int nHr, nMn; int c; - while( isspace(*(u8*)zDate) ){ zDate++; } + while( sqlite3Isspace(*zDate) ){ zDate++; } p->tz = 0; c = *zDate; if( c=='-' ){ @@ -182,7 +181,7 @@ static int parseTimezone(const char *zDate, DateTime *p){ zDate += 5; p->tz = sgn*(nMn + nHr*60); zulu_time: - while( isspace(*(u8*)zDate) ){ zDate++; } + while( sqlite3Isspace(*zDate) ){ zDate++; } return *zDate!=0; } @@ -206,10 +205,10 @@ static int parseHhMmSs(const char *zDate, DateTime *p){ return 1; } zDate += 2; - if( *zDate=='.' && isdigit((u8)zDate[1]) ){ + if( *zDate=='.' && sqlite3Isdigit(zDate[1]) ){ double rScale = 1.0; zDate++; - while( isdigit(*(u8*)zDate) ){ + while( sqlite3Isdigit(*zDate) ){ ms = ms*10.0 + *zDate - '0'; rScale *= 10.0; zDate++; @@ -294,7 +293,7 @@ static int parseYyyyMmDd(const char *zDate, DateTime *p){ return 1; } zDate += 10; - while( isspace(*(u8*)zDate) || 'T'==*(u8*)zDate ){ zDate++; } + while( sqlite3Isspace(*zDate) || 'T'==*(u8*)zDate ){ zDate++; } if( parseHhMmSs(zDate, p)==0 ){ /* We got the time */ }else if( *zDate==0 ){ @@ -641,7 +640,7 @@ static int parseModifier(const char *zMod, DateTime *p){ const char *z2 = z; DateTime tx; sqlite3_int64 day; - if( !isdigit(*(u8*)z2) ) z2++; + if( !sqlite3Isdigit(*z2) ) z2++; memset(&tx, 0, sizeof(tx)); if( parseHhMmSs(z2, &tx) ) break; computeJD(&tx); @@ -656,7 +655,7 @@ static int parseModifier(const char *zMod, DateTime *p){ break; } z += n; - while( isspace(*(u8*)z) ) z++; + while( sqlite3Isspace(*z) ) z++; n = sqlite3Strlen30(z); if( n>10 || n<3 ) break; if( z[n-1]=='s' ){ z[n-1] = 0; n--; } diff --git a/src/expr.c b/src/expr.c index 6e114719d..746b598a8 100644 --- a/src/expr.c +++ b/src/expr.c @@ -12,10 +12,9 @@ ** This file contains routines used for analyzing expressions and ** for generating VDBE code that evaluates expressions in SQLite. ** -** $Id: expr.c,v 1.409 2009/01/10 13:24:51 drh Exp $ +** $Id: expr.c,v 1.410 2009/01/20 16:53:40 danielk1977 Exp $ */ #include "sqliteInt.h" -#include <ctype.h> /* ** Return the 'affinity' of the expression pExpr if any. @@ -1452,7 +1451,7 @@ static char *dup8bytes(Vdbe *v, const char *in){ */ static void codeReal(Vdbe *v, const char *z, int n, int negateFlag, int iMem){ assert( z || v==0 || sqlite3VdbeDb(v)->mallocFailed ); - assert( !z || !isdigit(z[n]) ); + assert( !z || !sqlite3Isdigit(z[n]) ); UNUSED_PARAMETER(n); if( z ){ double value; @@ -1486,7 +1485,7 @@ static void codeInteger(Vdbe *v, Expr *pExpr, int negFlag, int iMem){ }else if( (z = (char*)pExpr->token.z)!=0 ){ int i; int n = pExpr->token.n; - assert( !isdigit(z[n]) ); + assert( !sqlite3Isdigit(z[n]) ); if( sqlite3GetInt32(z, &i) ){ if( negFlag ) i = -i; sqlite3VdbeAddOp2(v, OP_Integer, i, iMem); diff --git a/src/func.c b/src/func.c index 611f1e78e..7a7ce8dc0 100644 --- a/src/func.c +++ b/src/func.c @@ -16,10 +16,9 @@ ** sqliteRegisterBuildinFunctions() found at the bottom of the file. ** All other code has file scope. ** -** $Id: func.c,v 1.209 2008/12/10 23:04:13 drh Exp $ +** $Id: func.c,v 1.210 2009/01/20 16:53:40 danielk1977 Exp $ */ #include "sqliteInt.h" -#include <ctype.h> #include <stdlib.h> #include <assert.h> #include "vdbeInt.h" @@ -276,14 +275,14 @@ static void upperFunc(sqlite3_context *context, int argc, sqlite3_value **argv){ if( z1 ){ memcpy(z1, z2, n+1); for(i=0; z1[i]; i++){ - z1[i] = (char)toupper(z1[i]); + z1[i] = (char)sqlite3Toupper(z1[i]); } sqlite3_result_text(context, z1, -1, sqlite3_free); } } } static void lowerFunc(sqlite3_context *context, int argc, sqlite3_value **argv){ - char *z1; + u8 *z1; const char *z2; int i, n; if( argc<1 || SQLITE_NULL==sqlite3_value_type(argv[0]) ) return; @@ -296,9 +295,9 @@ static void lowerFunc(sqlite3_context *context, int argc, sqlite3_value **argv){ if( z1 ){ memcpy(z1, z2, n+1); for(i=0; z1[i]; i++){ - z1[i] = (char)tolower(z1[i]); + z1[i] = sqlite3Tolower(z1[i]); } - sqlite3_result_text(context, z1, -1, sqlite3_free); + sqlite3_result_text(context, (char *)z1, -1, sqlite3_free); } } } @@ -980,7 +979,7 @@ static void soundexFunc( for(i=0; zIn[i] && !isalpha(zIn[i]); i++){} if( zIn[i] ){ u8 prevcode = iCode[zIn[i]&0x7f]; - zResult[0] = toupper(zIn[i]); + zResult[0] = sqlite3Toupper(zIn[i]); for(j=1; j<4 && zIn[i]; i++){ int code = iCode[zIn[i]&0x7f]; if( code>0 ){ diff --git a/src/global.c b/src/global.c index 757b75a5c..2b2f096a7 100644 --- a/src/global.c +++ b/src/global.c @@ -12,7 +12,7 @@ ** ** This file contains definitions of global variables and contants. ** -** $Id: global.c,v 1.9 2008/12/08 18:19:18 drh Exp $ +** $Id: global.c,v 1.10 2009/01/20 16:53:40 danielk1977 Exp $ */ #include "sqliteInt.h" @@ -63,6 +63,71 @@ const unsigned char sqlite3UpperToLower[] = { }; /* +** The following 256 byte lookup table is used to support SQLites built-in +** equivalents to the following standard library functions: +** +** isspace() 0x01 +** isalnum() 0x02 +** isdigit() 0x04 +** isxdigit() 0x08 +** toupper() 0x20 +** +** Bit 0x20 is set if the mapped character requires translation to upper +** case. i.e. if the character is a lower-case ASCII character.character. +** If x is a lower-case ASCII character, then its upper-case equivalent +** is (x - 0x20). Therefore toupper() can be implemented as: +** +** (x & ~(map[x]&0x20)) +** +** Standard function tolower() is implemented using the sqlite3UpperToLower[] +** array. tolower() is used more often than toupper() by SQLite. +** +** SQLite's versions are identical to the standard versions assuming a +** locale of "C". They are implemented as macros in sqliteInt.h. +*/ +#ifdef SQLITE_ASCII +const unsigned char sqlite3CtypeMap[256] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 00..07 ........ */ + 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, /* 08..0f ........ */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 10..17 ........ */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 18..1f ........ */ + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 20..27 !"#$%&' */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 28..2f ()*+,-./ */ + 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, /* 30..37 01234567 */ + 0x0e, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 38..3f 89:;<=>? */ + + 0x00, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x02, /* 40..47 @ABCDEFG */ + 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, /* 48..4f HIJKLMNO */ + 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, /* 50..57 PQRSTUVW */ + 0x02, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, /* 58..5f XYZ[\]^_ */ + 0x00, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x22, /* 60..67 `abcdefg */ + 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, /* 68..6f hijklmno */ + 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, /* 70..77 pqrstuvw */ + 0x22, 0x22, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, /* 78..7f xyz{|}~. */ + + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 80..87 ........ */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 88..8f ........ */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 90..97 ........ */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 98..9f ........ */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* a0..a7 ........ */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* a8..af ........ */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* b0..b7 ........ */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* b8..bf ........ */ + + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* c0..c7 ........ */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* c8..cf ........ */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* d0..d7 ........ */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* d8..df ........ */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* e0..e7 ........ */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* e8..ef ........ */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* f0..f7 ........ */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 /* f8..ff ........ */ +}; +#endif + + + +/* ** The following singleton contains the global configuration for ** the SQLite library. */ diff --git a/src/legacy.c b/src/legacy.c index 5b037f067..e83817da7 100644 --- a/src/legacy.c +++ b/src/legacy.c @@ -14,11 +14,10 @@ ** other files are for internal use by SQLite and should not be ** accessed by users of the library. ** -** $Id: legacy.c,v 1.30 2008/12/10 19:26:24 drh Exp $ +** $Id: legacy.c,v 1.31 2009/01/20 16:53:40 danielk1977 Exp $ */ #include "sqliteInt.h" -#include <ctype.h> /* ** Execute SQL code. Return one of the SQLITE_ success/failure @@ -115,7 +114,7 @@ int sqlite3_exec( if( rc!=SQLITE_SCHEMA ){ nRetry = 0; zSql = zLeftover; - while( isspace((unsigned char)zSql[0]) ) zSql++; + while( sqlite3Isspace(zSql[0]) ) zSql++; } break; } diff --git a/src/loadext.c b/src/loadext.c index c59cd9c1f..0a1d1550c 100644 --- a/src/loadext.c +++ b/src/loadext.c @@ -12,7 +12,7 @@ ** This file contains code used to dynamically load extensions into ** the SQLite library. ** -** $Id: loadext.c,v 1.57 2008/12/08 18:19:18 drh Exp $ +** $Id: loadext.c,v 1.58 2009/01/20 16:53:40 danielk1977 Exp $ */ #ifndef SQLITE_CORE @@ -21,7 +21,6 @@ #include "sqlite3ext.h" #include "sqliteInt.h" #include <string.h> -#include <ctype.h> #ifndef SQLITE_OMIT_LOAD_EXTENSION diff --git a/src/main.c b/src/main.c index 35f36661b..35272048a 100644 --- a/src/main.c +++ b/src/main.c @@ -14,10 +14,9 @@ ** other files are for internal use by SQLite and should not be ** accessed by users of the library. ** -** $Id: main.c,v 1.521 2009/01/10 16:15:22 drh Exp $ +** $Id: main.c,v 1.522 2009/01/20 16:53:41 danielk1977 Exp $ */ #include "sqliteInt.h" -#include <ctype.h> #ifdef SQLITE_ENABLE_FTS3 # include "fts3.h" diff --git a/src/malloc.c b/src/malloc.c index f4fc0d325..a92fae06b 100644 --- a/src/malloc.c +++ b/src/malloc.c @@ -12,11 +12,10 @@ ** ** Memory allocation functions used throughout sqlite. ** -** $Id: malloc.c,v 1.53 2008/12/16 17:20:38 shane Exp $ +** $Id: malloc.c,v 1.54 2009/01/20 16:53:41 danielk1977 Exp $ */ #include "sqliteInt.h" #include <stdarg.h> -#include <ctype.h> /* ** This routine runs when the memory allocator sees that the diff --git a/src/pragma.c b/src/pragma.c index 4d30fa494..ad35d5420 100644 --- a/src/pragma.c +++ b/src/pragma.c @@ -11,10 +11,9 @@ ************************************************************************* ** This file contains code used to implement the PRAGMA command. ** -** $Id: pragma.c,v 1.201 2009/01/13 20:14:16 drh Exp $ +** $Id: pragma.c,v 1.202 2009/01/20 16:53:41 danielk1977 Exp $ */ #include "sqliteInt.h" -#include <ctype.h> /* Ignore this whole file if pragmas are disabled */ @@ -37,7 +36,7 @@ static u8 getSafetyLevel(const char *z){ static const u8 iLength[] = {2, 2, 3, 5, 3, 4, 4}; static const u8 iValue[] = {1, 0, 0, 0, 1, 1, 2}; int i, n; - if( isdigit(*z) ){ + if( sqlite3Isdigit(*z) ){ return (u8)atoi(z); } n = sqlite3Strlen30(z); diff --git a/src/prepare.c b/src/prepare.c index 38faaf78e..a4448d9ad 100644 --- a/src/prepare.c +++ b/src/prepare.c @@ -13,10 +13,9 @@ ** interface, and routines that contribute to loading the database schema ** from disk. ** -** $Id: prepare.c,v 1.104 2009/01/09 02:49:32 drh Exp $ +** $Id: prepare.c,v 1.105 2009/01/20 16:53:41 danielk1977 Exp $ */ #include "sqliteInt.h" -#include <ctype.h> /* ** Fill the InitData structure with an error message that indicates diff --git a/src/sqliteInt.h b/src/sqliteInt.h index 3e860feb6..63529f67e 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -11,7 +11,7 @@ ************************************************************************* ** Internal interface definitions for SQLite. ** -** @(#) $Id: sqliteInt.h,v 1.827 2009/01/16 16:23:38 danielk1977 Exp $ +** @(#) $Id: sqliteInt.h,v 1.828 2009/01/20 16:53:41 danielk1977 Exp $ */ #ifndef _SQLITEINT_H_ #define _SQLITEINT_H_ @@ -2148,6 +2148,28 @@ int sqlite3WalkSelectFrom(Walker*, Select*); #endif /* +** The following macros mimic the standard library functions toupper(), +** isspace(), isalnum(), isdigit() and isxdigit(), respectively. The +** sqlite versions only work for ASCII characters, regardless of locale. +*/ +#ifdef SQLITE_ASCII +# define sqlite3Toupper(x) ((x)&~(sqlite3CtypeMap[(unsigned char)(x)]&0x20)) +# define sqlite3Isspace(x) (sqlite3CtypeMap[(unsigned char)(x)]&0x01) +# define sqlite3Isalnum(x) (sqlite3CtypeMap[(unsigned char)(x)]&0x02) +# define sqlite3Isdigit(x) (sqlite3CtypeMap[(unsigned char)(x)]&0x04) +# define sqlite3Isxdigit(x) (sqlite3CtypeMap[(unsigned char)(x)]&0x08) +# define sqlite3Tolower(x) (sqlite3UpperToLower[(unsigned char)(x)]) +#else +# include <ctype.h> +# define sqlite3Toupper(x) toupper((unsigned char)(x)) +# define sqlite3Isspace(x) isspace((unsigned char)(x)) +# define sqlite3Isalnum(x) isalnum((unsigned char)(x)) +# define sqlite3Isdigit(x) isdigit((unsigned char)(x)) +# define sqlite3Isxdigit(x) isxdigit((unsigned char)(x)) +# define sqlite3Tolower(x) tolower((unsigned char)(x)) +#endif + +/* ** Internal function prototypes */ int sqlite3StrICmp(const char *, const char *); @@ -2503,6 +2525,7 @@ int sqlite3ValueFromExpr(sqlite3 *, Expr *, u8, u8, sqlite3_value **); void sqlite3ValueApplyAffinity(sqlite3_value *, u8, u8); #ifndef SQLITE_AMALGAMATION extern const unsigned char sqlite3UpperToLower[]; +extern const unsigned char sqlite3CtypeMap[]; extern SQLITE_WSD struct Sqlite3Config sqlite3Config; extern SQLITE_WSD FuncDefHash sqlite3GlobalFunctions; #endif diff --git a/src/test2.c b/src/test2.c index f8665ba7f..8ac75a50e 100644 --- a/src/test2.c +++ b/src/test2.c @@ -13,7 +13,7 @@ ** is not included in the SQLite library. It is used for automated ** testing of the SQLite library. ** -** $Id: test2.c,v 1.67 2009/01/16 16:23:38 danielk1977 Exp $ +** $Id: test2.c,v 1.68 2009/01/20 16:53:41 danielk1977 Exp $ */ #include "sqliteInt.h" #include "tcl.h" @@ -584,10 +584,10 @@ static int testBitvecBuiltinTest( if( Tcl_GetInt(interp, argv[1], &sz) ) return TCL_ERROR; z = argv[2]; while( nProg<99 && *z ){ - while( *z && !isdigit(*z) ){ z++; } + while( *z && !sqlite3Isdigit(*z) ){ z++; } if( *z==0 ) break; aProg[nProg++] = atoi(z); - while( isdigit(*z) ){ z++; } + while( sqlite3Isdigit(*z) ){ z++; } } aProg[nProg] = 0; rc = sqlite3_test_control(SQLITE_TESTCTRL_BITVEC_TEST, sz, aProg); diff --git a/src/tokenize.c b/src/tokenize.c index 9682cc206..afc3dd639 100644 --- a/src/tokenize.c +++ b/src/tokenize.c @@ -15,10 +15,9 @@ ** individual tokens and sends those tokens one-by-one over to the ** parser for analysis. ** -** $Id: tokenize.c,v 1.152 2008/09/01 15:52:11 drh Exp $ +** $Id: tokenize.c,v 1.153 2009/01/20 16:53:41 danielk1977 Exp $ */ #include "sqliteInt.h" -#include <ctype.h> #include <stdlib.h> /* @@ -124,7 +123,7 @@ int sqlite3GetToken(const unsigned char *z, int *tokenType){ int i, c; switch( *z ){ case ' ': case '\t': case '\n': case '\f': case '\r': { - for(i=1; isspace(z[i]); i++){} + for(i=1; sqlite3Isspace(z[i]); i++){} *tokenType = TK_SPACE; return i; } @@ -258,7 +257,7 @@ int sqlite3GetToken(const unsigned char *z, int *tokenType){ } case '.': { #ifndef SQLITE_OMIT_FLOATING_POINT - if( !isdigit(z[1]) ) + if( !sqlite3Isdigit(z[1]) ) #endif { *tokenType = TK_DOT; @@ -270,20 +269,20 @@ int sqlite3GetToken(const unsigned char *z, int *tokenType){ case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': { *tokenType = TK_INTEGER; - for(i=0; isdigit(z[i]); i++){} + for(i=0; sqlite3Isdigit(z[i]); i++){} #ifndef SQLITE_OMIT_FLOATING_POINT if( z[i]=='.' ){ i++; - while( isdigit(z[i]) ){ i++; } + while( sqlite3Isdigit(z[i]) ){ i++; } *tokenType = TK_FLOAT; } if( (z[i]=='e' || z[i]=='E') && - ( isdigit(z[i+1]) - || ((z[i+1]=='+' || z[i+1]=='-') && isdigit(z[i+2])) + ( sqlite3Isdigit(z[i+1]) + || ((z[i+1]=='+' || z[i+1]=='-') && sqlite3Isdigit(z[i+2])) ) ){ i += 2; - while( isdigit(z[i]) ){ i++; } + while( sqlite3Isdigit(z[i]) ){ i++; } *tokenType = TK_FLOAT; } #endif @@ -300,11 +299,11 @@ int sqlite3GetToken(const unsigned char *z, int *tokenType){ } case '?': { *tokenType = TK_VARIABLE; - for(i=1; isdigit(z[i]); i++){} + for(i=1; sqlite3Isdigit(z[i]); i++){} return i; } case '#': { - for(i=1; isdigit(z[i]); i++){} + for(i=1; sqlite3Isdigit(z[i]); i++){} if( i>1 ){ /* Parameters of the form #NNN (where NNN is a number) are used ** internally by sqlite3NestedParse. */ @@ -328,7 +327,7 @@ int sqlite3GetToken(const unsigned char *z, int *tokenType){ }else if( c=='(' && n>0 ){ do{ i++; - }while( (c=z[i])!=0 && !isspace(c) && c!=')' ); + }while( (c=z[i])!=0 && !sqlite3Isspace(c) && c!=')' ); if( c==')' ){ i++; }else{ @@ -350,7 +349,7 @@ int sqlite3GetToken(const unsigned char *z, int *tokenType){ if( z[1]=='\'' ){ *tokenType = TK_BLOB; for(i=2; (c=z[i])!=0 && c!='\''; i++){ - if( !isxdigit(c) ){ + if( !sqlite3Isxdigit(c) ){ *tokenType = TK_ILLEGAL; } } diff --git a/src/util.c b/src/util.c index 2846c3942..4eb01b0da 100644 --- a/src/util.c +++ b/src/util.c @@ -14,11 +14,10 @@ ** This file contains functions for allocating memory, comparing ** strings, and stuff like that. ** -** $Id: util.c,v 1.246 2009/01/10 16:15:22 drh Exp $ +** $Id: util.c,v 1.247 2009/01/20 16:53:41 danielk1977 Exp $ */ #include "sqliteInt.h" #include <stdarg.h> -#include <ctype.h> /* @@ -256,23 +255,23 @@ int sqlite3IsNumber(const char *z, int *realnum, u8 enc){ int incr = (enc==SQLITE_UTF8?1:2); if( enc==SQLITE_UTF16BE ) z++; if( *z=='-' || *z=='+' ) z += incr; - if( !isdigit(*(u8*)z) ){ + if( !sqlite3Isdigit(*z) ){ return 0; } z += incr; if( realnum ) *realnum = 0; - while( isdigit(*(u8*)z) ){ z += incr; } + while( sqlite3Isdigit(*z) ){ z += incr; } if( *z=='.' ){ z += incr; - if( !isdigit(*(u8*)z) ) return 0; - while( isdigit(*(u8*)z) ){ z += incr; } + if( !sqlite3Isdigit(*z) ) return 0; + while( sqlite3Isdigit(*z) ){ z += incr; } if( realnum ) *realnum = 1; } if( *z=='e' || *z=='E' ){ z += incr; if( *z=='+' || *z=='-' ) z += incr; - if( !isdigit(*(u8*)z) ) return 0; - while( isdigit(*(u8*)z) ){ z += incr; } + if( !sqlite3Isdigit(*z) ) return 0; + while( sqlite3Isdigit(*z) ){ z += incr; } if( realnum ) *realnum = 1; } return *z==0; @@ -296,7 +295,7 @@ int sqlite3AtoF(const char *z, double *pResult){ const char *zBegin = z; LONGDOUBLE_TYPE v1 = 0.0; int nSignificant = 0; - while( isspace(*(u8*)z) ) z++; + while( sqlite3Isspace(*z) ) z++; if( *z=='-' ){ sign = -1; z++; @@ -306,7 +305,7 @@ int sqlite3AtoF(const char *z, double *pResult){ while( z[0]=='0' ){ z++; } - while( isdigit(*(u8*)z) ){ + while( sqlite3Isdigit(*z) ){ v1 = v1*10.0 + (*z - '0'); z++; nSignificant++; @@ -320,7 +319,7 @@ int sqlite3AtoF(const char *z, double *pResult){ z++; } } - while( isdigit(*(u8*)z) ){ + while( sqlite3Isdigit(*z) ){ if( nSignificant<18 ){ v1 = v1*10.0 + (*z - '0'); divisor *= 10.0; @@ -341,7 +340,7 @@ int sqlite3AtoF(const char *z, double *pResult){ }else if( *z=='+' ){ z++; } - while( isdigit(*(u8*)z) ){ + while( sqlite3Isdigit(*z) ){ eval = eval*10 + *z - '0'; z++; } @@ -400,7 +399,7 @@ int sqlite3Atoi64(const char *zNum, i64 *pNum){ int neg; int i, c; const char *zStart; - while( isspace(*(u8*)zNum) ) zNum++; + while( sqlite3Isspace(*zNum) ) zNum++; if( *zNum=='-' ){ neg = 1; zNum++; diff --git a/src/vdbe.c b/src/vdbe.c index 60ce2d094..9fe0e823c 100644 --- a/src/vdbe.c +++ b/src/vdbe.c @@ -43,10 +43,9 @@ ** in this file for details. If in doubt, do not deviate from existing ** commenting and indentation practices when changing or adding code. ** -** $Id: vdbe.c,v 1.811 2009/01/14 00:55:10 drh Exp $ +** $Id: vdbe.c,v 1.812 2009/01/20 16:53:41 danielk1977 Exp $ */ #include "sqliteInt.h" -#include <ctype.h> #include "vdbeInt.h" /* diff --git a/src/vdbeaux.c b/src/vdbeaux.c index 059958c0e..488d53c4b 100644 --- a/src/vdbeaux.c +++ b/src/vdbeaux.c @@ -14,10 +14,9 @@ ** to version 2.8.7, all this code was combined into the vdbe.c source file. ** But that file was getting too big so this subroutines were split out. ** -** $Id: vdbeaux.c,v 1.432 2009/01/16 16:23:38 danielk1977 Exp $ +** $Id: vdbeaux.c,v 1.433 2009/01/20 16:53:41 danielk1977 Exp $ */ #include "sqliteInt.h" -#include <ctype.h> #include "vdbeInt.h" @@ -963,7 +962,7 @@ void sqlite3VdbePrintSql(Vdbe *p){ pOp = &p->aOp[0]; if( pOp->opcode==OP_Trace && pOp->p4.z!=0 ){ const char *z = pOp->p4.z; - while( isspace(*(u8*)z) ) z++; + while( sqlite3Isspace(*z) ) z++; printf("SQL: [%s]\n", z); } } @@ -983,9 +982,9 @@ void sqlite3VdbeIOTraceSql(Vdbe *p){ int i, j; char z[1000]; sqlite3_snprintf(sizeof(z), z, "%s", pOp->p4.z); - for(i=0; isspace((unsigned char)z[i]); i++){} + for(i=0; sqlite3Isspace(z[i]); i++){} for(j=0; z[i]; i++){ - if( isspace((unsigned char)z[i]) ){ + if( sqlite3Isspace(z[i]) ){ if( z[i-1]!=' ' ){ z[j++] = ' '; } diff --git a/src/vdbemem.c b/src/vdbemem.c index f97d4a950..8c4af32fd 100644 --- a/src/vdbemem.c +++ b/src/vdbemem.c @@ -15,10 +15,9 @@ ** only within the VDBE. Interface routines refer to a Mem using the ** name sqlite_value ** -** $Id: vdbemem.c,v 1.134 2009/01/05 22:30:39 drh Exp $ +** $Id: vdbemem.c,v 1.135 2009/01/20 16:53:41 danielk1977 Exp $ */ #include "sqliteInt.h" -#include <ctype.h> #include "vdbeInt.h" /* |