aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2011-02-17 15:58:20 +0000
committerdrh <drh@noemail.net>2011-02-17 15:58:20 +0000
commitcd92e84d07c9e5446370b1138dccc3835f63f99c (patch)
tree4f9aae7de85f0b0779ec94b5b7e90b20e68b0cd9 /src
parent0cf0e6c912b71bf9422c0ebb4026bd1bbc6af8fb (diff)
downloadsqlite-cd92e84d07c9e5446370b1138dccc3835f63f99c.tar.gz
sqlite-cd92e84d07c9e5446370b1138dccc3835f63f99c.zip
Remove a no-op code path from sqlite3ExprIsInteger(). Replace it with an
assert() that proves it always does nothing. FossilOrigin-Name: 7af66d1bd53fd5973281646511e4e1d3b16601a3
Diffstat (limited to 'src')
-rw-r--r--src/expr.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/expr.c b/src/expr.c
index f62413342..b7b73946c 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -1198,16 +1198,17 @@ int sqlite3ExprIsConstantOrFunction(Expr *p){
*/
int sqlite3ExprIsInteger(Expr *p, int *pValue){
int rc = 0;
+
+ /* If an expression is an integer literal that fits in a signed 32-bit
+ ** integer, then the EP_IntValue flag will have already been set */
+ assert( p->op!=TK_INTEGER || (p->flags & EP_IntValue)!=0
+ || sqlite3GetInt32(p->u.zToken, &rc)==0 );
+
if( p->flags & EP_IntValue ){
*pValue = p->u.iValue;
return 1;
}
switch( p->op ){
- case TK_INTEGER: {
- rc = sqlite3GetInt32(p->u.zToken, pValue);
- assert( rc==0 );
- break;
- }
case TK_UPLUS: {
rc = sqlite3ExprIsInteger(p->pLeft, pValue);
break;