Convert the sorted set object into a ziplist if it is not already a ziplist * and if the number of elements and the maximum element size and total elements size * are within the expected ranges. */
| 1247 | * and if the number of elements and the maximum element size and total elements size |
| 1248 | * are within the expected ranges. */ |
| 1249 | void zsetConvertToZiplistIfNeeded(robj *zobj, size_t maxelelen, size_t totelelen) { |
| 1250 | if (zobj->encoding == OBJ_ENCODING_ZIPLIST) return; |
| 1251 | zset *set = (zset*)zobj->m_ptr; |
| 1252 | |
| 1253 | if (set->zsl->length <= g_pserver->zset_max_ziplist_entries && |
| 1254 | maxelelen <= g_pserver->zset_max_ziplist_value && |
| 1255 | ziplistSafeToAdd(NULL, totelelen)) |
| 1256 | zsetConvert(zobj,OBJ_ENCODING_ZIPLIST); |
| 1257 | } |
| 1258 | |
| 1259 | /* Return (by reference) the score of the specified member of the sorted set |
| 1260 | * storing it into *score. If the element does not exist C_ERR is returned |
no test coverage detected