MCPcopy Create free account
hub / github.com/F-Stack/f-stack / quicklistBookmarkCreate

Function quicklistBookmarkCreate

app/redis-6.2.6/src/quicklist.c:1455–1470  ·  view source on GitHub ↗

Create or update a bookmark in the list which will be updated to the next node * automatically when the one referenced gets deleted. * 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). * NOTE: use short simple names, so that string compare on find is quick. * NOTE: bookmark creation may r

Source from the content-addressed store, hash-verified

1453 may change and it's the caller responsibilty to update the reference.
1454 */
1455int quicklistBookmarkCreate(quicklist **ql_ref, const char *name, quicklistNode *node) {
1456 quicklist *ql = *ql_ref;
1457 if (ql->bookmark_count >= QL_MAX_BM)
1458 return 0;
1459 quicklistBookmark *bm = _quicklistBookmarkFindByName(ql, name);
1460 if (bm) {
1461 bm->node = node;
1462 return 1;
1463 }
1464 ql = zrealloc(ql, sizeof(quicklist) + (ql->bookmark_count+1) * sizeof(quicklistBookmark));
1465 *ql_ref = ql;
1466 ql->bookmarks[ql->bookmark_count].node = node;
1467 ql->bookmarks[ql->bookmark_count].name = zstrdup(name);
1468 ql->bookmark_count++;
1469 return 1;
1470}
1471
1472/* Find the quicklist node referenced by a named bookmark.
1473 * When the bookmarked node is deleted the bookmark is updated to the next node,

Callers 2

scanLaterListFunction · 0.85
quicklistTestFunction · 0.85

Calls 3

zreallocFunction · 0.85
zstrdupFunction · 0.85

Tested by

no test coverage detected