-
- /* Fast path if the object is integer encoded and is not shared. */
- if (o && o->refcount == 1 && o->encoding == REDIS_ENCODING_INT) {
- long long newval = ((long)o->ptr) + incr;
-
- 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++;
- addReplyLongLong(c,newval);
- return;
- }
- /* ... else take the usual safe path */
- }
-
- /* Otherwise we create a new object and replace the old one. */