Replace quicklist entry at offset 'index' by 'data' with length 'sz'. * * Returns 1 if replace happened. * Returns 0 if replace failed and no changes happened. */
| 689 | * Returns 1 if replace happened. |
| 690 | * Returns 0 if replace failed and no changes happened. */ |
| 691 | int quicklistReplaceAtIndex(quicklist *quicklist, long index, void *data, |
| 692 | int sz) { |
| 693 | quicklistEntry entry; |
| 694 | if (likely(quicklistIndex(quicklist, index, &entry))) { |
| 695 | /* quicklistIndex provides an uncompressed node */ |
| 696 | entry.node->zl = ziplistReplace(entry.node->zl, entry.zi, data, sz); |
| 697 | quicklistNodeUpdateSz(entry.node); |
| 698 | quicklistCompress(quicklist, entry.node); |
| 699 | return 1; |
| 700 | } else { |
| 701 | return 0; |
| 702 | } |
| 703 | } |
| 704 | |
| 705 | /* Given two nodes, try to merge their ziplists. |
| 706 | * |
no test coverage detected