- if (incr) /* ZINCRBY */
- addReplyDouble(c,score);
- else /* ZADD */
- addReply(c,shared.czero);
- } else {
- /* Optimize: check if the element is too large or the list becomes
- * too long *before* executing zzlInsert. */
- zobj->ptr = zzlInsert(zobj->ptr,ele,score);
- if (zzlLength(zobj->ptr) > server.zset_max_ziplist_entries)
- zsetConvert(zobj,REDIS_ENCODING_RAW);
- if (sdslen(ele->ptr) > server.zset_max_ziplist_value)
- zsetConvert(zobj,REDIS_ENCODING_RAW);
-
- signalModifiedKey(c->db,key);
- server.dirty++;
-
- if (incr) /* ZINCRBY */
- addReplyDouble(c,score);
- else /* ZADD */
- addReply(c,shared.cone);
- }
- } else if (zobj->encoding == REDIS_ENCODING_RAW) {
- zset *zs = zobj->ptr;
- zskiplistNode *znode;
- dictEntry *de;
-
- ele = c->argv[3] = tryObjectEncoding(c->argv[3]);
- de = dictFind(zs->dict,ele);
- if (de != NULL) {
- curobj = dictGetEntryKey(de);
- curscore = *(double*)dictGetEntryVal(de);
-
- if (incr) {
- score += curscore;
- if (isnan(score)) {
- addReplyError(c,nanerr);
- /* Don't need to check if the sorted set is empty, because
- * we know it has at least one element. */
- return;
+ ele = c->argv[3+j*2] = tryObjectEncoding(c->argv[3+j*2]);
+ de = dictFind(zs->dict,ele);
+ if (de != NULL) {
+ curobj = dictGetEntryKey(de);
+ curscore = *(double*)dictGetEntryVal(de);
+
+ if (incr) {
+ score += curscore;
+ if (isnan(score)) {
+ addReplyError(c,nanerr);
+ /* Don't need to check if the sorted set is empty
+ * because we know it has at least one element. */
+ zfree(scores);
+ return;
+ }