From 009db6764504746d64fef7e6ccf661f7882bd72e Mon Sep 17 00:00:00 2001 From: antirez Date: Fri, 15 Apr 2011 18:08:24 +0200 Subject: [PATCH] addReplyLongLong optimized to return shared objects when the value to reply is 0 or 1 --- src/networking.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/networking.c b/src/networking.c index 32c063060..c8a39ba5c 100644 --- a/src/networking.c +++ b/src/networking.c @@ -321,7 +321,12 @@ void _addReplyLongLong(redisClient *c, long long ll, char prefix) { } void addReplyLongLong(redisClient *c, long long ll) { - _addReplyLongLong(c,ll,':'); + if (ll == 0) + addReply(c,shared.czero); + else if (ll == 1) + addReply(c,shared.cone); + else + _addReplyLongLong(c,ll,':'); } void addReplyMultiBulkLen(redisClient *c, long length) {