From a15742a41b30b742d58f4ed260a4a36f02bdd9ac Mon Sep 17 00:00:00 2001 From: antirez Date: Fri, 10 Dec 2010 17:23:38 +0100 Subject: [PATCH] dont take the fast path for INCR if the resulting integer will fit into a shared integer range --- src/t_string.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/t_string.c b/src/t_string.c index cc6526fb..bb6b4ece 100644 --- a/src/t_string.c +++ b/src/t_string.c @@ -149,7 +149,8 @@ void incrDecrCommand(redisClient *c, long long incr) { if (o && o->refcount == 1 && o->encoding == REDIS_ENCODING_INT) { long long newval = ((long)o->ptr) + incr; - if (newval >= LONG_MIN && newval <= LONG_MAX) { + if (newval < 0 && newval >= REDIS_SHARED_INTEGERS && + newval >= LONG_MIN && newval <= LONG_MAX) { o->ptr = (void*) (long) newval; touchWatchedKey(c->db,c->argv[1]); server.dirty++;