Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/adlist.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,12 @@ list *listAddNodeHeadDRAM(list *list, void *value)
* On error, NULL is returned and no operation is performed (i.e. the
* list remains unaltered).
* On success the 'list' pointer you pass to the function is returned. */
list *listAddNodeTail(list *list, void *value)
list *_listAddNodeTail(list *list, void *value, int on_dram)
{
listNode *node;

if ((node = zmalloc(sizeof(*node))) == NULL)
node = (on_dram == LIST_DRAM_VARIANT) ? zmalloc_dram(sizeof(*node)) : zmalloc(sizeof(*node));
if (node == NULL)
return NULL;
node->value = value;
if (list->len == 0) {
Expand All @@ -189,6 +190,14 @@ list *listAddNodeTail(list *list, void *value)
return list;
}

list *listAddNodeTail(list *list, void *value) {
return _listAddNodeTail(list, value, LIST_GENERAL_VARIANT);
}

list *listAddNodeTailDRAM(list *list, void *value) {
return _listAddNodeTail(list, value, LIST_DRAM_VARIANT);
}

list *listInsertNode(list *list, listNode *old_node, void *value, int after) {
listNode *node;

Expand Down
1 change: 1 addition & 0 deletions src/adlist.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ void listEmptyDRAM(list *list);
list *listAddNodeHead(list *list, void *value);
list *listAddNodeHeadDRAM(list *list, void *value);
list *listAddNodeTail(list *list, void *value);
list *listAddNodeTailDRAM(list *list, void *value);
list *listInsertNode(list *list, listNode *old_node, void *value, int after);
void listDelNode(list *list, listNode *node);
void listDelNodeDRAM(list *list, listNode *node);
Expand Down