From: drh Date: Thu, 5 Jun 2003 14:27:56 +0000 (+0000) Subject: Remove unused code from util.c. (CVS 1006) X-Git-Tag: version-3.6.10~5062 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8649d6a1a83a6878aeaf669d428a99962b214414;p=thirdparty%2Fsqlite.git Remove unused code from util.c. (CVS 1006) FossilOrigin-Name: 1bcaa841a396e4d592de30d10846f7cefbbdcd0e --- diff --git a/manifest b/manifest index e559311fe2..9003c78fde 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\sbug\sin\sUPDATE\sOR\sREPLACE\sthat\swas\sintroduced\sby\scheck-in\s(999).\nAlso\sclean\sup\ssome\scompiler\swarnings\sfor\sVC++.\s(CVS\s1005) -D 2003-06-04T16:24:39 +C Remove\sunused\scode\sfrom\sutil.c.\s(CVS\s1006) +D 2003-06-05T14:27:56 F Makefile.in 1ff85c27d4350c74118341024e8a4fb2a04a3a43 F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906 F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd @@ -57,7 +57,7 @@ F src/threadtest.c d641a5219e718e18a1a80a50eb9bb549f451f42e F src/tokenize.c 2ba93fe10d5f57f0cc20b07417c3244a30c324b3 F src/trigger.c 6ff205aaac4869e402d9902e528e1d22a85de14c F src/update.c 24260b4fda00c9726d27699a0561d53c0dccc397 -F src/util.c 18d16fa3171e34b6f6f73ef0c61e7d9b73b78826 +F src/util.c 566c7780170dd11fb1ad5de3ba81f0dfea7cccf0 F src/vacuum.c 0820984615786c9ccdaad8032a792309b354a8eb F src/vdbe.c 5602825b5f71496963997985de773ad4750eba65 F src/vdbe.h 985c24f312d10f9ef8f9a8b8ea62fcdf68e82f21 @@ -165,7 +165,7 @@ F www/speed.tcl cb4c10a722614aea76d2c51f32ee43400d5951be F www/sqlite.tcl 4bd1729e320f5fa9125f0022b281fbe839192125 F www/tclsqlite.tcl 1db15abeb446aad0caf0b95b8b9579720e4ea331 F www/vdbe.tcl 2013852c27a02a091d39a766bc87cff329f21218 -P fa10c6df5a80127508fb198c21ef93acfc93ebe2 -R 94482faf4cbad2ee70a44fe5ffdac4f3 +P af6f2bdf59fb621ff3e1d061e429f01ebd7d0b42 +R 23537f7b325631f9a84ccee7dc37dfd8 U drh -Z 13ad783eb6736db498d85a49fe1b10fe +Z e1539ac99c912a1f3368ac10a6ba549b diff --git a/manifest.uuid b/manifest.uuid index af8f2f1825..53f55db320 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -af6f2bdf59fb621ff3e1d061e429f01ebd7d0b42 \ No newline at end of file +1bcaa841a396e4d592de30d10846f7cefbbdcd0e \ No newline at end of file diff --git a/src/util.c b/src/util.c index 6470aad489..be5baa59c2 100644 --- a/src/util.c +++ b/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.64 2003/06/02 06:17:10 jplyon Exp $ +** $Id: util.c,v 1.65 2003/06/05 14:27:56 drh Exp $ */ #include "sqliteInt.h" #include @@ -613,188 +613,6 @@ int sqliteStrNICmp(const char *zLeft, const char *zRight, int N){ return N<0 ? 0 : *a - *b; } -#if 0 /* NOT USED */ -/* -** The sortStrCmp() function below is used to order elements according -** to the ORDER BY clause of a SELECT. The sort order is a little different -** from what one might expect. This note attempts to describe what is -** going on. -** -** We want the main string comparision function used for sorting to -** sort both numbers and alphanumeric words into the correct sequence. -** The same routine should do both without prior knowledge of which -** type of text the input represents. It should even work for strings -** which are a mixture of text and numbers. (It does not work for -** numeric substrings in exponential notation, however.) -** -** To accomplish this, we keep track of a state number while scanning -** the two strings. The states are as follows: -** -** 1 Beginning of word -** 2 Arbitrary text -** 3 Integer -** 4 Negative integer -** 5 Real number -** 6 Negative real -** -** The scan begins in state 1, beginning of word. Transitions to other -** states are determined by characters seen, as shown in the following -** chart: -** -** Current State Character Seen New State -** -------------------- -------------- ------------------- -** 0 Beginning of word "-" 3 Negative integer -** digit 2 Integer -** space 0 Beginning of word -** otherwise 1 Arbitrary text -** -** 1 Arbitrary text space 0 Beginning of word -** digit 2 Integer -** otherwise 1 Arbitrary text -** -** 2 Integer space 0 Beginning of word -** "." 4 Real number -** digit 2 Integer -** otherwise 1 Arbitrary text -** -** 3 Negative integer space 0 Beginning of word -** "." 5 Negative Real num -** digit 3 Negative integer -** otherwise 1 Arbitrary text -** -** 4 Real number space 0 Beginning of word -** digit 4 Real number -** otherwise 1 Arbitrary text -** -** 5 Negative real num space 0 Beginning of word -** digit 5 Negative real num -** otherwise 1 Arbitrary text -** -** To implement this state machine, we first classify each character -** into on of the following categories: -** -** 0 Text -** 1 Space -** 2 Digit -** 3 "-" -** 4 "." -** -** Given an arbitrary character, the array charClass[] maps that character -** into one of the atove categories. -*/ -static const unsigned char charClass[] = { - /* x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE xF */ -/* 0x */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, -/* 1x */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -/* 2x */ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 4, 0, -/* 3x */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, -/* 4x */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -/* 5x */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -/* 6x */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -/* 7x */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -/* 8x */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -/* 9x */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -/* Ax */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -/* Bx */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -/* Cx */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -/* Dx */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -/* Ex */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -/* Fx */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -}; -#define N_CHAR_CLASS 5 - -/* -** Given the current state number (0 thru 5), this array figures -** the new state number given the character class. -*/ -static const unsigned char stateMachine[] = { - /* Text, Space, Digit, "-", "." */ - 1, 0, 2, 3, 1, /* State 0: Beginning of word */ - 1, 0, 2, 1, 1, /* State 1: Arbitrary text */ - 1, 0, 2, 1, 4, /* State 2: Integer */ - 1, 0, 3, 1, 5, /* State 3: Negative integer */ - 1, 0, 4, 1, 1, /* State 4: Real number */ - 1, 0, 5, 1, 1, /* State 5: Negative real num */ -}; - -/* This routine does a comparison of two strings. Case is used only -** if useCase!=0. Numeric substrings compare in numerical order for the -** most part but this routine does not understand exponential notation. -*/ -static int sortStrCmp(const char *atext, const char *btext, int useCase){ - register unsigned char *a, *b, *map, ca, cb; - int result; - register int cclass = 0; - - a = (unsigned char *)atext; - b = (unsigned char *)btext; - if( useCase ){ - do{ - if( (ca= *a++)!=(cb= *b++) ) break; - cclass = stateMachine[cclass*N_CHAR_CLASS + charClass[ca]]; - }while( ca!=0 ); - }else{ - map = UpperToLower; - do{ - if( (ca=map[*a++])!=(cb=map[*b++]) ) break; - cclass = stateMachine[cclass*N_CHAR_CLASS + charClass[ca]]; - }while( ca!=0 ); - if( ca>='[' && ca<='`' ) cb = b[-1]; - if( cb>='[' && cb<='`' ) ca = a[-1]; - } - switch( cclass ){ - case 0: - case 1: { - if( isdigit(ca) && isdigit(cb) ){ - cclass = 2; - } - break; - } - default: { - break; - } - } - switch( cclass ){ - case 2: - case 3: { - if( isdigit(ca) ){ - if( isdigit(cb) ){ - int acnt, bcnt; - acnt = bcnt = 0; - while( isdigit(*a++) ) acnt++; - while( isdigit(*b++) ) bcnt++; - result = acnt - bcnt; - if( result==0 ) result = ca-cb; - }else{ - result = 1; - } - }else if( isdigit(cb) ){ - result = -1; - }else if( ca=='.' ){ - result = 1; - }else if( cb=='.' ){ - result = -1; - }else{ - result = ca - cb; - cclass = 2; - } - if( cclass==3 ) result = -result; - break; - } - case 0: - case 1: - case 4: { - result = ca - cb; - break; - } - case 5: { - result = cb - ca; - }; - } - return result; -} -#endif /* NOT USED */ - /* ** Return TRUE if z is a pure numeric string. Return FALSE if the ** string contains any character which is not part of a number.