| 460 | } |
| 461 | |
| 462 | REDIS_STATIC int _quicklistNodeAllowMerge(const quicklistNode *a, |
| 463 | const quicklistNode *b, |
| 464 | const int fill) { |
| 465 | if (!a || !b) |
| 466 | return 0; |
| 467 | |
| 468 | /* approximate merged ziplist size (- 11 to remove one ziplist |
| 469 | * header/trailer) */ |
| 470 | unsigned int merge_sz = a->sz + b->sz - 11; |
| 471 | if (likely(_quicklistNodeSizeMeetsOptimizationRequirement(merge_sz, fill))) |
| 472 | return 1; |
| 473 | /* when we return 1 above we know that the limit is a size limit (which is |
| 474 | * safe, see comments next to optimization_level and SIZE_SAFETY_LIMIT) */ |
| 475 | else if (!sizeMeetsSafetyLimit(merge_sz)) |
| 476 | return 0; |
| 477 | else if ((int)(a->count + b->count) <= fill) |
| 478 | return 1; |
| 479 | else |
| 480 | return 0; |
| 481 | } |
| 482 | |
| 483 | #define quicklistNodeUpdateSz(node) \ |
| 484 | do { \ |
no test coverage detected