src/adlist.c
static list *_listAddNodeHead(list *list, void *value, int on_dram)
{
    listNode *node;
    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) {
        list->head = list->tail = node;
        node->prev = node->next = NULL;
    } else {
        node->prev = NULL;
        node->next = list->head;
        list->head->prev = node;
        list->head = node;
    }
    list->len++;
    return list;
}
/* Add a new node to the list, to head, containing the specified 'value'
 * pointer as 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. */
Add a new node to the list, to head, containing the specified 'value'
pointer as value.

On error, NULL is returned and no operation is performed .
On success the 'list' pointer you pass to the function is returned.
Add a new node to the list to head containing the specified ' value ' pointer as value . On error NULL is returned and no operation is performed . On success the ' list ' pointer you pass to the function is returned .
static list *_listAddNodeHead(list *list, void *value, int on_dram)
{
    listNode *node;
    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) {
        list->head = list->tail = node;
        node->prev = node->next = NULL;
    } else {
        node->prev = NULL;
        node->next = list->head;
        list->head->prev = node;
        list->head = node;
    }
    list->len++;
    return list;
}
static list * _listAddNodeHead ( list * list , void * value , int on_dram ) { listNode * node ; 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 ) { list -> head = list -> tail = node ; node -> prev = node -> next = NULL ; } else { node -> prev = NULL ; node -> next = list -> head ; list -> head -> prev = node ; list -> head = node ; } list -> len ++ ; return list ; }
Add a new node to the list, to head, containing the specified 'value'
 pointer as value.
Add a new node to the list to head containing the specified ' value ' pointer as value .