src/lib/cstl/src/dlink.c
/*!
 * @note don`t need to search dnode in dlink.
 * @param dnode   can`t be NULL otherwise will raise assert.
 * @return
 */
@note don`t need to search dnode in dlink.
@param dnode   can`t be NULL otherwise will raise assert.
@return
@note don ` t need to search dnode in dlink . @param dnode can ` t be NULL otherwise will raise assert . @return
dnode_t * dlink_remove_dnode_unsafe(dlink_t * dlink,dnode_t * dnode){
    ASSERT(dnode!=NULL&&dlink->size!=0);
    if(dnode->prev != NULL){
        dnode->prev->next = dnode->next;
    }
    else{
        dlink->head = dnode->next;
    }
    if(dnode->next != NULL){
        dnode->next->prev = dnode->prev;
    }
    else{
        dlink->tail = dnode->prev;
    }
    dlink->size--;
    return dnode;
}
dnode_t * dlink_remove_dnode_unsafe ( dlink_t * dlink , dnode_t * dnode ) { ASSERT ( dnode != NULL && dlink -> size != 0 ) ; if ( dnode -> prev != NULL ) { dnode -> prev -> next = dnode -> next ; } else { dlink -> head = dnode -> next ; } if ( dnode -> next != NULL ) { dnode -> next -> prev = dnode -> prev ; } else { dlink -> tail = dnode -> prev ; } dlink -> size -- ; return dnode ; }
@note don`t need to search dnode in dlink.
@note don ` t need to search dnode in dlink .