diff options
author | danielk1977 <danielk1977@noemail.net> | 2009-01-20 16:53:39 +0000 |
---|---|---|
committer | danielk1977 <danielk1977@noemail.net> | 2009-01-20 16:53:39 +0000 |
commit | 78ca0e7eb429d6545284784425549b0c8e4487b0 (patch) | |
tree | 0ebbecace0d33b828bf813bc089891eacfefe050 /src/sqliteInt.h | |
parent | 770b3cb76399df3eab0282a0f004aa5006c8ada7 (diff) | |
download | sqlite-78ca0e7eb429d6545284784425549b0c8e4487b0.tar.gz sqlite-78ca0e7eb429d6545284784425549b0c8e4487b0.zip |
When not compiling for an EBCDIC system, use built-in alternatives to the tolowe
r(), toupper() and other ctype.h library functions. Ticket #3597. (CVS 6196)
FossilOrigin-Name: 1041abd6784d283bebf646c54e93599522f7889d
Diffstat (limited to 'src/sqliteInt.h')
-rw-r--r-- | src/sqliteInt.h | 25 |
1 files changed, 24 insertions, 1 deletions
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 |