Logo Search packages:      
Sourcecode: log4c version File versions  Download package

sd_list_iter_t* sd_list_add ( sd_list_t a_this,
void *  a_data 

Adds the given data into the list object. If the data already exists, the associated iterator is returned.

the element is added at the begining of the list.
a_data the data to add
a pointer to the created or found iterator.

Definition at line 119 of file list.c.

    sd_list_iter_t* i;
    if (! a_this) return 0;
    if ((i = sd_calloc(1, sizeof(*i))) == 0)
      return 0;
    i->data       = a_data;
    i->list       = a_this;    
    i->__next           = a_this->head;
    i->__prev           = 0;
    a_this->head  = i;
    if (i->__next) i->__next->__prev      = i;
    if (!a_this->tail) a_this->tail = i;
    return i;

Generated by  Doxygen 1.6.0   Back to index