Exemple #1
0
list_t *
list_new() {
  list_t *self;
  if (!(self = LIST_CALLOC(1, sizeof(list_t))))
    return NULL;
  return self;
}
Exemple #2
0
/* ----------------------------------------------------
 * this function creates a new list, with the initial
 * size indicated by "lsize" parameter.
 * 
 * Parameters :
 *      int lsize : initial size for the list
 * Return :
 *      AwList * : a pointer to the new created list
 * --------------------------------------------------   
 */
extern AwList * AwList_new (int lsize) 
{
    AwList* nlist=NULL;

    nlist = (AwList *) LIST_CALLOC(1,sizeof (AwList));
    if (nlist != NULL) 
     {
        nlist->elements = (void **) LIST_CALLOC(lsize,sizeof(void *));
        if (nlist->elements == NULL) 
         {
            LIST_FREE (nlist);
            return NULL;
         }
        else
         {
            nlist->size = lsize;
            nlist->index=0;
            nlist->next=0;
         }
     }
    return nlist;
}