"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/quicklist.c" between
redis-6.2-rc3.tar.gz and redis-6.2.0.tar.gz

About: redis is an advanced key-value store. It is often referred to as a data structure server since keys can contain strings, hashes, lists, sets and sorted sets.

quicklist.c  (redis-6.2-rc3):quicklist.c  (redis-6.2.0)
skipping to change at line 683 skipping to change at line 683
/* Replace quicklist entry at offset 'index' by 'data' with length 'sz'. /* Replace quicklist entry at offset 'index' by 'data' with length 'sz'.
* *
* Returns 1 if replace happened. * Returns 1 if replace happened.
* Returns 0 if replace failed and no changes happened. */ * Returns 0 if replace failed and no changes happened. */
int quicklistReplaceAtIndex(quicklist *quicklist, long index, void *data, int quicklistReplaceAtIndex(quicklist *quicklist, long index, void *data,
int sz) { int sz) {
quicklistEntry entry; quicklistEntry entry;
if (likely(quicklistIndex(quicklist, index, &entry))) { if (likely(quicklistIndex(quicklist, index, &entry))) {
/* quicklistIndex provides an uncompressed node */ /* quicklistIndex provides an uncompressed node */
entry.node->zl = ziplistDelete(entry.node->zl, &entry.zi); entry.node->zl = ziplistReplace(entry.node->zl, entry.zi, data, sz);
entry.node->zl = ziplistInsert(entry.node->zl, entry.zi, data, sz);
quicklistNodeUpdateSz(entry.node); quicklistNodeUpdateSz(entry.node);
quicklistCompress(quicklist, entry.node); quicklistCompress(quicklist, entry.node);
return 1; return 1;
} else { } else {
return 0; return 0;
} }
} }
/* Given two nodes, try to merge their ziplists. /* Given two nodes, try to merge their ziplists.
* *
skipping to change at line 1430 skipping to change at line 1429
} else if (where == QUICKLIST_TAIL) { } else if (where == QUICKLIST_TAIL) {
quicklistPushTail(quicklist, value, sz); quicklistPushTail(quicklist, value, sz);
} }
} }
/* Create or update a bookmark in the list which will be updated to the next nod e /* Create or update a bookmark in the list which will be updated to the next nod e
* automatically when the one referenced gets deleted. * automatically when the one referenced gets deleted.
* Returns 1 on success (creation of new bookmark or override of an existing one ). * Returns 1 on success (creation of new bookmark or override of an existing one ).
* Returns 0 on failure (reached the maximum supported number of bookmarks). * Returns 0 on failure (reached the maximum supported number of bookmarks).
* NOTE: use short simple names, so that string compare on find is quick. * NOTE: use short simple names, so that string compare on find is quick.
* NOTE: bookmakrk creation may re-allocate the quicklist, so the input pointer * NOTE: bookmark creation may re-allocate the quicklist, so the input pointer
may change and it's the caller responsibilty to update the reference. may change and it's the caller responsibilty to update the reference.
*/ */
int quicklistBookmarkCreate(quicklist **ql_ref, const char *name, quicklistNode *node) { int quicklistBookmarkCreate(quicklist **ql_ref, const char *name, quicklistNode *node) {
quicklist *ql = *ql_ref; quicklist *ql = *ql_ref;
if (ql->bookmark_count >= QL_MAX_BM) if (ql->bookmark_count >= QL_MAX_BM)
return 0; return 0;
quicklistBookmark *bm = _quicklistBookmarkFindByName(ql, name); quicklistBookmark *bm = _quicklistBookmarkFindByName(ql, name);
if (bm) { if (bm) {
bm->node = node; bm->node = node;
return 1; return 1;
 End of changes. 2 change blocks. 
3 lines changed or deleted 2 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)