Beispiel #1
0
LNKLST *utilListDirectory(char *path)
{
DIR *dir;
struct dirent *dp;
struct stat sbuf;
LNKLST *list;

    if (path == NULL) {
        errno = EINVAL;
        return NULL;
    }

    if (!utilDirectoryExists(path)) {
        errno = ENOENT;
        return NULL;
    }

    if ((dir = opendir(path)) == NULL) return NULL;
    if ((list = listCreate()) == NULL) return NULL;

    for (dp = readdir(dir); dp != NULL; dp = readdir(dir)) {
        if (!listAppend(list, dp->d_name, strlen(dp->d_name)+1)) {
            listDestroy(list);
            return NULL;
        }
    }
    closedir(dir);
    
    if (!listSetArrayView(list)) {
        listDestroy(list);
        return NULL;
    }

    return list;
}
Beispiel #2
0
static void ifiDb_IrFree(ir_t *pIr)
{
	if(pIr != NULL)
	{
		listDestroy(pIr->pListAddress, &ifiDb_IrFreeCallback, NULL);
		listDestroy(pIr->pListException, &ifiDb_IrFreeCallback, NULL);
		free(pIr);
	}
}
void idaClearHandle(IDA *ida)
{
    if (ida == NULL) return;
    if (ida->site != NULL) free(ida->site);
    listDestroy(ida->chnlocmap);
    listDestroy(ida->tqual);
    listDestroy(ida->cfs);
    idaInitHandle(ida);
}
void hypnomixDestroy(struct hypnomix *hyp)
{
	if(hyp->mod != NULL) {
		(*(hyp->mod->destroy))(hyp);
		moduleUnload(hyp->mod);
	}
	shaderDestroy(hyp->pg.id);
	presetDestroy(&hyp->pr);

	listDestroy(hyp->modlist.li);
	listDestroy(hyp->prlist.li);

	free(hyp->morphsamples);
	(*hyp->log)(HYP_SUCCESS, "hypnomixDestroy()\n");
}
Beispiel #5
0
List
CreateRecordList(HPktHdr *hpktp)
{
	List	reclist;
	int		i, numrecs;
	void	*item;

	reclist = listInit();

	if ( (hpktp->datalen)%sizeof(host_rec) != 0) {
		NETERROR(MRSD, ("Hello Pkt Corrupt\n"));
		return (NULL);
	}

	numrecs = (hpktp->datalen)/sizeof(host_rec);	

	for (i = 0; i < numrecs; i++) {
		item = Malloc(sizeof(host_rec));
		memcpy(item, (void *)((host_rec *)(hpktp+1) + i), sizeof(host_rec));
		if ( listAddItem(reclist, item) != 0) {
			NETERROR(MRSD, ("Error Adding Item to record list \n"));
			listDestroy(reclist);
			return (NULL);
		}
	}

	return (reclist);
}
Beispiel #6
0
int main(int argc, char *argv[])
{
 /**   simple_lls *head;
    head=(simple_lls *)malloc(sizeof(simple_lls));
    head->node.data=1;
    head->next=NULL;
    
    printf("head data = %d \n",head->node.data);
    free(head);**/
    
    List *list=(List *)malloc(sizeof(List));
    int data=1;
    int data2=2;
    int data3;
    listInit(list,&destroy);
    listInsertNext(list,NULL,(void *)&data);
    listInsertNext(list,NULL,(void *)&data2);
    listInsertNext(list,list->head->next,(void *)&data2);
    listRemoveNext(list,NULL,(void **)&data3);
    printf("list data = %d %d  \n",*(int *)list->head->data
    ,*(int *)list->head->next->data);
    listDestroy(list);
  
  system("PAUSE");	
  return 0;
}
Beispiel #7
0
LNKLST *utilStringTokenList(char *input, char *delimiters, char quote)
{
    LNKLST *list;
    char *copy, *token, *s1, *lasts;

    if ((list = listCreate()) == NULL) return NULL;

    if ((copy = strdup(input)) == NULL) {
        free(list);
        return NULL;
    }
    SaveBlanks(copy, quote);

    s1 = copy;
    while ((token = (char *) strtok_r(s1, delimiters, &lasts)) != NULL) {
        s1 = NULL;
        RestoreBlanks(token);
        if (!listAppend(list, token, strlen(token)+1)) {
            free(copy);
            listDestroy(list);
            return FALSE;
        }
    }

    free(copy);
    return list;
}
Beispiel #8
0
/**
* Creates a copy of target list.
*
* The new copy will contain all the elements from the source list in the same
* order and will use the same functions as the original list for copying and
* freeing elements.
*
* @param list The target list to copy
* @return
* NULL if a NULL was sent or a memory allocation failed.
* A List containing the same elements with same order as list otherwise.
*/
List listCopy(List list) {
	List copy = NULL;
	if (list != NULL) {
		copy = listCreate(list->copyElementFunc, list->freeElementFunc);
	}
	if ((copy != NULL) && (list->First != NULL)) {
		ListItem item_to_copy = list->First;
		while ((item_to_copy != NULL) &&  (copy != NULL)) {
			if (listInsertLast(copy, item_to_copy->Element) == LIST_SUCCESS) {
				if (list->Current == item_to_copy){
					int size = GetListLength(copy);
					listGetFirst(copy);
					for (int i = 1; i < size; i++) {
						listGetNext(copy);
					}
				}
				item_to_copy = item_to_copy->Next;
			} else {
				listDestroy(copy);
				copy = NULL;
			}
		}
	}
	return copy;
}
void test_checkIsListNull_should_return_0_if_is_not_NULL()
{
	LinkedList *list = listCreate(0x200) ;
	
	TEST_ASSERT_EQUAL(0,checkIsListNull(list));
	listDestroy(list);
}
Beispiel #10
0
static list_t* ifiDb_IrBuildAddressList(char *pStr, int *pAfType)
{	list_t *pList = NULL;

	if(pStr != NULL && *pStr)
	{	char *p1;
		char *p2;

		pList = listCreate();
		while((p1 = mlfi_stradvtok(&pStr, ',')) != NULL && *p1)
		{
			p2 = p1;
			p1 = mlfi_stradvtok(&p2, '/');

			if(p1 != NULL && p2 != NULL && *p1 && p2)
			{	ira_t ira;

				ira.maskLen = atoi(p2);
				if((*pAfType == AF_UNSPEC || *pAfType == AF_INET)
					&& ira.maskLen <=32
					&& inet_pton(AF_INET, p1, &ira.ipv4)
					)
				{
					*pAfType = ira.afType = AF_INET;
				}
				else if(
					(*pAfType == AF_UNSPEC || *pAfType == AF_INET6)
					&& ira.maskLen <= 128
					&& inet_pton(AF_INET6, p1, &ira.ipv6)
					)
				{
					*pAfType = ira.afType = AF_INET6;
				}
				else
				{
					*pAfType = ira.afType = AF_UNSPEC;
					ira.maskLen = 0;
				}

				if(ira.afType != AF_UNSPEC)
				{	ira_t *pIra = calloc(1, sizeof(ira_t));

					if(pIra != NULL)
					{
						*pIra = ira;
						listAdd(pList, pIra);
					}
				}
			}
		}

		if(listQty(pList) == 0)
		{
			listDestroy(pList, NULL, NULL);
			pList = NULL;
		}
	}

	return pList;
}
Beispiel #11
0
static Q330_CFG *ReadCfgCleanReturn(FILE *fp, Q330_CFG *cfg, LNKLST *list, Q330_CFG *retval)
{
    if (fp != NULL) fclose(fp);
    if (cfg != NULL) q330DestroyCfg(cfg);
    if (list != NULL) listDestroy(list);

    return retval;
}
/**
 * Called by the TEAR_DOWN macro from testing_utilities.h. This function should
 * deallocate and clear all the code
 * @param examples
 */
void tearDown(Examples examples) {
	personDestroy(examples.haimMoshe);
	personDestroy(examples.oferLevi);
	personDestroy(examples.eyalGolan);
	personDestroy(examples.aviBitter);
	personDestroy(examples.idanTal);
	listDestroy(examples.list);
}
void test_checkIsListMatchTarget_should_return_0_if_both_are_not_the_same()
{
	LinkedList *list = listCreate(0x200) ;
	LinkedList *list1 = listCreate(0x200) ;
	
	TEST_ASSERT_EQUAL(0,checkIsListMatchTarget(list,list1));

	listDestroy(list);
}
/*
 * HTDestroy will destroy the hash table and free all allocated memory associated with it
 */
void HTDestroy(HashTableT* ht){
    int i;
    for(i = 0 ; i < ht->size; i++){
        if(ht->lists[i]!=NULL)
            listDestroy(ht->lists[i]);
    }
    free(ht->lists);
    free(ht);
}
void test_setTail__to_list_should_set_Tail_to_the_target_List()
{
	LinkedList *list = listCreate(0x200) ;
	LinkedList *Tail ;
	
	setTail(&Tail,list);
	TEST_ASSERT_EQUAL(list,Tail);
	
	listDestroy(list);
}
void test_setHead_to_list_should_set_Head_to_the_target_List()
{
	LinkedList *list = listCreate(0x200) ;
	LinkedList *Head ;
	
	setHead(&Head,list);
	TEST_ASSERT_EQUAL(list,Head);
	
	listDestroy(list);
}
Beispiel #17
0
int Graph::MaxFlow(int s, int t) 
{    
   flownode *L; 
   flownode *itr; 
   int i, u, oldheight; 
   //构造每个结点的Neightbour list; 
   for(u = 0; u < V; ++u) 
   { 
      N[u] = new flownode; 
      N[u]->next = NULL;       
   } 
   for(u = 0; u < V; ++u) 
   { 
      for(i = 0; i < u; ++i) 
         if( c[u][i] || c[i][u] ) 
         { 
            listInsert(N[u],i); 
            listInsert(N[i],u); 
         } 
   } 
   //构造L 
   L = new flownode; 
   L ->next = NULL; 
   for( i = 0; i < V; ++i) 
   { 
      if(i == s || i == t) continue; 
      listInsert(L,i); 
   } 
   //初始化preflow 
   InitializePreflow(s); 
   // 
    
   for(itr = L; itr->next; itr = itr->next ) 
   { 
      u = itr->next->adjnum; 
      oldheight = h[u]; 
      DischargePreflow(u); 
      if(h[u] > oldheight) 
      { 
         listErase(itr); 
         listInsert(L,u); 
         itr = L; 
      } 
   } 
   listDestroy(L); 
   maxflow = 0; 
   for( itr = N[s]->next; itr; itr = itr->next) 
   { 
      if(f[s][itr->adjnum]  ) 
         maxflow += f[s][itr->adjnum]; 
   } 
   neighborDestroy(); 
   return maxflow; 
} 
/**
 * List of tests, one for each function is usually a good thumb rule.
 */
static bool testListCreate() {
	ASSERT_TEST(listCreate(NULL,NULL) == NULL);
	ASSERT_TEST(listCreate(NULL,NULL) == NULL);
	ASSERT_TEST(listCreate(personCopyHelper,NULL) == NULL);
	ASSERT_TEST(listCreate(NULL,personDestroyHelper) == NULL);
	List list = listCreate(personCopyHelper, personDestroyHelper);
	ASSERT_TEST(list != NULL);
	listDestroy(list);

	return true;
}
Beispiel #19
0
void stDestroy(symtable *st)
{
    if (listSize(st->blockList) != 1)
        fprintf(stderr, "Symbol table block leak!\n");
    block *b = (block *) listRemoveBack(st->blockList);
    stringDestroy(b->name);
    bstDestroy(b->symbols, bstDelSymbol); //Cleanup memory for symbols in bst
    free(b);
    listDestroy(st->blockList);
    free(st);
    st = NULL;
}
int qdplusReadStateFile(QDPLUS *handle)
{
FILE *fp;
int status;
UINT16 flag;
UINT64 serialno;
LNKLST_NODE *crnt;
QDPLUS_STATE state;
QDPLUS_DIGITIZER *digitizer;

    status = QDPLUS_STATE_BUG;
    if ((fp = OpenStateFile(handle, "rb", &status)) == NULL) return status;

    if (fread(&flag, sizeof(UINT16), 1, fp) != 1) {
        status = feof(fp) ? QDPLUS_STATE_EMPTY : QDPLUS_STATE_IOERR;
        fclose(fp);
        return status;
    }

    if (flag != QDPLUS_FLAG_CLEAN) {
        fclose(fp);
        return QDPLUS_STATE_DIRTY;
    }

    while (fread(&serialno, sizeof(UINT64), 1, fp) == 1) {
        if ((digitizer = qdplusGetDigitizer(handle, serialno)) == NULL) {
            fclose(fp);
            return QDPLUS_STATE_BUG;
        }
        if (digitizer->state != NULL) listDestroy(digitizer->state);
        if ((digitizer->state = listCreate()) == NULL) {
            fclose(fp);
            return QDPLUS_STATE_NOMEM;
        }
        while ((status = ReadState(fp, &state)) == STATE_READ_OK) {
            if (!listAppend(digitizer->state, &state, sizeof(QDPLUS_STATE))) {
                fclose(fp);
                return QDPLUS_STATE_NOMEM;
            }
        }
        if (status != STATE_READ_FINISHED) {
            fclose(fp);
            return QDPLUS_STATE_IOERR;
        }
    }

    status = feof(fp) ? QDPLUS_STATE_OK : QDPLUS_STATE_IOERR;
    fclose(fp);

    return status;
}
/*******************************************************************************
**
** Function         phNxpNciHal_cleanup_monitor
**
** Description      Clean up semaphore monitor
**
** Returns          None
**
*******************************************************************************/
void phNxpNciHal_cleanup_monitor(void)
{
    if (nxpncihal_monitor != NULL)
    {
        pthread_mutex_destroy(&nxpncihal_monitor->concurrency_mutex);
        pthread_mutex_destroy(&nxpncihal_monitor->reentrance_mutex);
        phNxpNciHal_releaseall_cb_data();
        listDestroy(&nxpncihal_monitor->sem_list);
    }

    free(nxpncihal_monitor);
    nxpncihal_monitor = NULL;

    return;
}
static ISI_DL_MASTER *FailedOpen(ISI_DL *dl, ISI_DL_MASTER *master)
{
UINT32 i;

    if (dl != NULL) isidlCloseDiskLoop(dl);
    if (master != NULL) {
        if (listSetArrayView(&master->list)) {
            for (i = 0; i < master->list.count; i++) isidlCloseDiskLoop((ISI_DL *) master->list.array[i]);
        }
        listDestroy(&master->list);
        free(master);
    }

    return NULL;
}
void ispDecodeChnLocMap(IDA *ida, UINT8 *src)
{
UINT32 ltmp;
UINT8 *ptr;
static char *fid = "ispDecodeChnLocMap";

    if (ida == NULL) return;

    ptr = (UINT8 *) src;
    ptr += utilUnpackBytes(src, (UINT8 *) ida->mapname, IDA_MNAMLEN);
    ida->mapname[IDA_MNAMLEN] = 0;

    listDestroy(ida->chnlocmap);
    ida->chnlocmap = listCreate();

}
Beispiel #24
0
int
nsm_kill(nbr_info *nbrp)
{
	host_rec	*nbr_rec;
	List		tmp;
	char fn[] = "nsm_kill";
	struct in_addr nbr_ip_addr;
        char buf[INET_ADDRSTRLEN];

	if (nbrp == NULL) {
		return(1);
	}

	NETDEBUG(MRSD, NETLOG_DEBUG2, ("%s: called \n", fn));

	nbr_rec = (host_rec *)listGetFirstItem(nbrp->records);
	if ((tmp = SearchListforMatch(hcp->hrecs, (void *)nbr_rec, \
		match_rec_nbr)) == NULL) {
		NETDEBUG(MRSD, NETLOG_DEBUG1, ("host does not contain record for neigbour which died\n"));
	}
	else {
		nbr_ip_addr.s_addr = nbr_rec->host;
		NETINFOMSG(MRSD, ("Neighbour %s died \n", 
			inet_ntop( AF_INET, &nbr_ip_addr, buf, INET_ADDRSTRLEN) ));
		listDeleteItem(hcp->hrecs, tmp->item);
	}

	hcp->printflag = 1;	  /* Print list is true */
	publish_host_table();

	Free(nbrp->sa);
	Free(nbrp->curpkt);
	listDestroy(nbrp->records);
	listDeleteItem(hcp->nsm_list, nbrp);
	Free(nbrp);

	if (LeaderChanged()) 
		exec_hsm_event(HSM_EVENT_NBRCHNG);

	if (CheckNSMStates() && LeaderAgreed()) {
		/* A kludgy way to give system some time before we call init */
		msleep(500);
		exec_hsm_event(HSM_EVENT_FULLCONN);
	}

	return(1);
}
uint64_t algorithm() {
    uint64_t primeSum=2;
    cellList list;

    listInit(&list);
    listAdd(cellNew(2),&list);

    //printf("%"PRIu32" %"PRIu32"\n",list.first->value,list.last->value);

    for(uint64_t i=3; i<LIMIT; i++)
        if(isPrime(i,&list) == TRUE) {
            printf("-->%"PRIu64"\n",i);
            listAdd(cellNew(i),&list);
            primeSum+=i;
        }

    listDestroy(&list);
    return primeSum;
}
Beispiel #26
0
static void Process(char *path)
{
int i;
char *name;
LNKLST *list;

    if ((list = utilListDirectory(path)) == NULL) {
        printf("utilListDirectory: '%s': %s\n", path, strerror(errno));
        return;
    }

    printf("path='%s'\n", path);
    for (i = 0; i < list->count; i++) {
        name = (char *) list->array[i];
        printf("%s\n", name);
    }

    listDestroy(list);
}
Beispiel #27
0
/**
* Creates a new filtered copy of a list.
*
* This creates a new list with only the elements for which the filtering
* function returned true.
*
* For example, the following code creates a new list, given a list of strings
* containing only the strings which are longer than 10 characters.
* @code
*
* bool isLongerThan(ListElement string, ListFilterKey key) {
*   return strlen(string) > *(int*)key;
* }
*
* List createFilteredList(List listOfStrings) {
*   int key = 10;
*   return listFilter(listOfStrings, isLongerThan, &key);
* }
* @endcode
*
* @param list The list for which a filtered copy will be made
* @param filterElement The function used for determining whether a given
* element should be in the resulting list or not.
* @param key Any extra values that need to be sent to the filtering function
* when called
* @return
* NULL if list or filterElement are NULL or a memory allocation failed.
* A List containing only elements from list which filterElement returned true
* for.
*/
List listFilter(List list, FilterListElement filterElement, ListFilterKey key){
	if((list == NULL) && (filterElement == NULL)) return NULL;
	List filtered = listCopy(list);
	if (filtered == NULL) return NULL;
	if (filtered->First != NULL) {
		filtered->Current = filtered->First;
		while((filtered != NULL) && (filtered->Current != NULL)) {
			if (!filterElement(filtered->Current->Element, key)) {
				ListItem new_current = filtered->Current->Next;
				if (listRemoveCurrent(filtered) != LIST_SUCCESS) {
					listDestroy(filtered);
					filtered = NULL;
				} else {
					filtered->Current = new_current;
				}
			} else {
				filtered->Current = filtered->Current->Next;
			}
		}
	}
	if (filtered != NULL) filtered->Current = filtered->First;
	return filtered;
}
Beispiel #28
0
void
listDestroy(LIST_T *list, void (*destroy)(LIST_ENTRY_T *))
{
    LIST_ENTRY_T *entry;

    while (! LIST_IS_EMPTY(list)) {
        entry = list->forw;

        listRemoveEntry(list, entry);
        if (destroy)
            (*destroy)(entry);
        else
            free(entry);
    }

    if (list->allowObservers) {

        listDestroy(list->observers,
                    (LIST_ENTRY_DESTROY_FUNC_T)&listObserverDestroy);
    }

    free(list->name);
    free(list);
}
Beispiel #29
0
List listCopy(List list) {
	if (!list) {
		return NULL;
	}
	assert(list->copyElement);
	assert(list->freeElement);

	List newList = listCreate(list->copyElement,list->freeElement);
	VERIFY_ALLOCATION_RETURN_PTR(newList);
	newList->current = newList->head;
	Node current = NULL;
	FOREACH(ptr,list) {
		ListResult listResult = listInsertAfterCurrent(newList, ptr->data);
		if (listResult == LIST_OUT_OF_MEMORY) {
			listDestroy(newList);
			return NULL;
		}

		assert(listResult == LIST_SUCCESS);
		listGetNext(newList);
		if (ptr == list->current) {
		    current = newList->current;
		}
	}
static bool testClientsManagerGetSortedPayments(){
	Email email = NULL, mail1 = NULL ,mail2 = NULL, mail3 = NULL;
	emailCreate("gaba@ganosh", &email);
	emailCreate("baba@gash", &mail1);
	emailCreate("baba@gash2", &mail2);
	emailCreate("baaa@gash", &mail3);
	ClientsManager manager = clientsManagerCreate();
	clientsManagerAdd( manager, email, 1, 1, 200);
	clientsManagerAdd( manager, mail1, 1, 2, 1000);
	clientsManagerAdd( manager, mail2, 1, 2, 1000);
	clientsManagerAdd( manager, mail3, 1, 2, 1000);

	List clients_list = NULL;
	ASSERT_TEST( clientsManagerGetSortedPayments(NULL, &clients_list) ==
			CLIENT_MANAGER_INVALID_PARAMETERS);
	ASSERT_TEST( clientsManagerGetSortedPayments(manager,NULL) ==
			CLIENT_MANAGER_INVALID_PARAMETERS);
	ASSERT_TEST( clientsManagerGetSortedPayments(manager, &clients_list) ==
				CLIENT_MANAGER_SUCCESS);
	ASSERT_TEST( listGetSize(clients_list) == 0);
	listDestroy(clients_list);

	clientsManagerExecutePurchase( manager, email, 330);
	ASSERT_TEST( clientsManagerGetSortedPayments(manager, &clients_list) ==
				CLIENT_MANAGER_SUCCESS);
	ASSERT_TEST( listGetSize(clients_list) == 1);
	listDestroy(clients_list);

	clientsManagerExecutePurchase( manager, mail1, 900);
	ASSERT_TEST( clientsManagerGetSortedPayments(manager, &clients_list) ==
			CLIENT_MANAGER_SUCCESS);
	ASSERT_TEST( listGetSize(clients_list) == 2);
	ClientPurchaseBill top_bill = listGetFirst(clients_list);
	ASSERT_TEST( emailAreEqual(
			clientPurchaseBillGetClientEmail(top_bill), mail1));
	ClientPurchaseBill second_bill = listGetNext(clients_list);
	ASSERT_TEST( emailAreEqual(
		clientPurchaseBillGetClientEmail(second_bill), email));
	listDestroy(clients_list);

	clientsManagerExecutePurchase( manager, mail2, 900);
	ASSERT_TEST( clientsManagerGetSortedPayments(manager, &clients_list) ==
			CLIENT_MANAGER_SUCCESS);
	ASSERT_TEST( listGetSize(clients_list) == 3);
	top_bill = listGetFirst(clients_list);
	ASSERT_TEST( emailAreEqual(
			clientPurchaseBillGetClientEmail(top_bill), mail1));
	second_bill = listGetNext(clients_list);
	ASSERT_TEST( emailAreEqual(
		clientPurchaseBillGetClientEmail(second_bill), mail2));
	second_bill = listGetNext(clients_list);
	ASSERT_TEST( emailAreEqual(
		clientPurchaseBillGetClientEmail(second_bill), email));
	listDestroy(clients_list);

	clientsManagerExecutePurchase( manager, mail3, 900);
	ASSERT_TEST( clientsManagerGetSortedPayments(manager, &clients_list) ==
			CLIENT_MANAGER_SUCCESS);
	ASSERT_TEST( listGetSize(clients_list) == 4);
	top_bill = listGetFirst(clients_list);
	ASSERT_TEST( emailAreEqual(
			clientPurchaseBillGetClientEmail(top_bill), mail3));
	second_bill = listGetNext(clients_list);
	ASSERT_TEST( emailAreEqual(
		clientPurchaseBillGetClientEmail(second_bill), mail1));
	second_bill = listGetNext(clients_list);
	ASSERT_TEST( emailAreEqual(
		clientPurchaseBillGetClientEmail(second_bill), mail2));
	second_bill = listGetNext(clients_list);
	ASSERT_TEST( emailAreEqual(
		clientPurchaseBillGetClientEmail(second_bill), email));
	listDestroy(clients_list);

	clientsManagerExecutePurchase(manager, email, 900);
	ASSERT_TEST( clientsManagerGetSortedPayments(manager, &clients_list) ==
			CLIENT_MANAGER_SUCCESS);
	ASSERT_TEST( listGetSize(clients_list) == 4);
	top_bill = listGetFirst(clients_list);
	ASSERT_TEST( emailAreEqual(
			clientPurchaseBillGetClientEmail(top_bill), email));
	second_bill = listGetNext(clients_list);
	ASSERT_TEST( emailAreEqual(
		clientPurchaseBillGetClientEmail(second_bill), mail3));
	second_bill = listGetNext(clients_list);
	ASSERT_TEST( emailAreEqual(
		clientPurchaseBillGetClientEmail(second_bill), mail1));
	second_bill = listGetNext(clients_list);
	ASSERT_TEST( emailAreEqual(
		clientPurchaseBillGetClientEmail(second_bill), mail2));
	listDestroy(clients_list);

	emailDestroy(email);
	emailDestroy(mail1);
	emailDestroy(mail2);
	emailDestroy(mail3);
	clientsManagerDestroy(manager);
	return true;
}