示例#1
0
char *
GetMoviePathName(dbADT db,const char * movieName)
{
    genreNode * genreN;
    movieNode * movieN;
    char * resp; 
    int i=0,j=0;
    if(db==NULL || movieName==NULL)
	return NULL;
    if( listIsEmpty(db->genreList) )
	return NULL;
    SetBegin(db->genreList);
    while( GetData(db->genreList,(listElementT*)&genreN)!=0 && i<db->cantGenre)
    {
	if( !listIsEmpty(genreN->movieList) )
	{
	    SetBegin(genreN->movieList);
	    while( GetData(genreN->movieList,(listElementT*)&movieN) && j<genreN->cantMoviesGenre)
	    {
			if( strcmp(movieN->movie.name,movieName)==0 )
			{
				if( (resp=malloc(sizeof(char)*(strlen(movieN->pathName)+1)))==NULL )
				return NULL;
				strcpy(resp,movieN->pathName);
				return resp;
			}
		j++;
	    }
		j=0;
	}
	i++;
    }
    return NULL;
}
//===================================================================================================
void addListBaseDesc(ListBaseDesc * listBaseDesc, char path[globs_maxPathLength], long address, int date){
	BaseDescriptor ptr_add = (BaseDescriptor) malloc(sizeof(struct FileDescriptor));
	ptr_add->path = path;
	ptr_add->address = address;
	ptr_add->date = date;
	ptr_add->next = NULL;
	// if the list is empty
	if(listIsEmpty(*listBaseDesc))
		base = ptr_add;
	else{
		// We create two traveler pointers, one which check the address with the one from the new element : ptr_pres, 
		// and another to do again chaining : ptr_prev
		BaseDescriptor ptr_prev = *base;
		BaseDescriptor ptr_pres = *base;
		while(ptr_pres != NULL){
			if(ptr_pres->address > address){
				ptr_add->next = ptr_pres;
				if(*base->next == NULL)
					*base = ptr_add;
				else
					ptr_prev->next = ptr_add; 				
				break;
			}
			ptr_prev = ptr_pres;
			ptr_pres = ptr_pres->next;
		}
		// If the new address is bigger than any of the list
		if(ptr_pres == NULL)
			ptr_prev->next = ptr_add;
	}
	//DO THE SAME ON THE FILE LISTBASEDESCRIPTOR
}
//===================================================================================================
void removeDesc(BaseDesc * base, FileType type){
    if(listIsEmpty(*base))
        printf("Sorry bitch, nothing to put out of there\n");
    else{
		FILE * baseDesc;
		switch(type){
			/*case TEXT: fopen("TextBaseDesc.db", "w+");
		    break;*/
		    case PICTURE: fopen("PictureBaseDesc.db", "w+");
		    break;
		    case SOUND: fopen("SoundBaseDesc.db", "w+");
		    break;
		}
        BaseDesc ptr_p = *base;
        while(ptr_p != NULL){
            if(ptr_p->next == NULL)
                break;
			switch(type){
				/*case TEXT:
						writeTextDesc(baseDesc, ptr_p->element);
				break;*/
				case PICTURE:
						writePictureDesc(baseDesc, ptr_p->element);
				break;
				case SOUND:
						writeSoundDesc(baseDesc, ptr_p->element);
				break; 
			}
            ptr_p = ptr_p->next;
		}
        free(ptr_p);   
	}
}
示例#4
0
void thread_write_audio(cyg_addrword_t data)
{
	VP_BUFFER_TEST_AUDIO_BITSTREAM_T *ptestaudio;
	IO_THREAD_READ_T readarg;
	
	while(1)
	{
		cyg_semaphore_wait(&g_testaudio.pcAudio.consumer);
		if (!listIsEmpty (&g_testaudio.listAudio))
		{
			ptestaudio = GetParentAddr (g_testaudio.listAudio.pNext, VP_BUFFER_TEST_AUDIO_BITSTREAM_T, list);
			listDetach(&ptestaudio->list);
		}
		else
		{
			diag_printf("No auido data???\n");
			while(1);
		}
		
		readarg.txbuf = ptestaudio->aucAudio;
		readarg.txlen = ptestaudio->iAudioLen;
		readarg.mediatype = MEDIA_TYPE_AUDIO;
		iothread_Write(&readarg);
		
		bufTestAudioDecRef(ptestaudio);
		cyg_semaphore_post(&g_testaudio.pcAudio.producer);
	}
	cyg_thread_exit();
}
//===================================================================================================
void addDescriptor(BaseDescriptor *base, void * structDescriptor, FileType type){
	BaseDescriptor ptr_add = (BaseDescriptor) malloc(sizeof(struct Descriptor));    
	ptr_add->element = structDescriptor;
	if(listIsEmpty(*base))
        *base = ptr_add;
    else{
        BaseDescriptor ptr_p = *base;
		// We will go to the last element of the chained list to add next to it the new element
        do{
            if(ptr_p->next == NULL)
                break;
            ptr_p = ptr_p->next;
        }while(ptr_p != NULL);
        ptr_p->next = ptr_add;
    }
    // DO THE SAME ON THE FILE BASEDESCRIPTOR
	FILE * fileAdd;
	switch(type){
		case TEXT: TextDescriptor * desc = (TextDescriptor*)structDescriptor;
			fileAdd = fopen("TextBaseDescriptor", "a");
        break;
        case PICTURE: PictureDescriptor * desc = (PictureDescriptor*)structDescriptor;
			fileAdd = fopen("PictureBaseDescriptor", "a");
        break;
        case SOUND: SoundDescriptor * desc = (SoundDescriptor*)structDescriptor;
			fileAdd = fopen("SoundBaseDescriptor", "a");
        break; 
	}
	writeFile(fileAdd, desc);
	fclose(fileAdd);
}
//===================================================================================================
BaseDescriptor initBaseDescriptor(FileType fileType){
	BaseDescriptor newBase;
	char * fileDescriptor;
	switch(fileType){
		case TEXT: fileDescriptor = "TextBaseDescriptor";
        break;
        case PICTURE: fileDescriptor = "PictureBaseDescriptor";
        break;
        case SOUND: fileDescriptor = "SoundBaseDescriptor";
        break;
	}
	FILE * baseDesc = fopen(fileDescriptor, "r");
	void * structDescriptor;
	BaseDescriptor ptr_p;
	while(structDescriptor = readFile(baseDesc)){
		BaseDescriptor ptr_add = (BaseDescriptor) malloc(sizeof(struct Descriptor));    
		ptr_add->element = structDescriptor;
		if(listIsEmpty(newBase)){
		    newBase = ptr_add;
			ptr_p = newBase;
		}
		else{
			ptr_p->next = ptr_add;
			ptr_p = ptr_p->next;
		}
	}
	fclose(baseDesc);
	return newBase;
}
示例#7
0
void listAddFirst(List *L, NodeList *newNode){
    if(listIsEmpty(L)){
        L->header = L->last = newNode;
    }else{
        newNode->next = L->header;
        L->header = newNode;
    }
}
示例#8
0
void listAddNode(List *L, NodeList *newNode){
    nodeListSetNext(newNode, NULL);
    if(listIsEmpty(L))
        L->header = L->last = newNode;
    else {
        nodeListSetNext(L->last, newNode);
        L->last = newNode;
    }
}
示例#9
0
NodeList *listRemoveFirst(List *L){
    NodeList *tmp;
    if(listIsEmpty(L)) return NULL;
    tmp = L->header;
    if(L->header == L->last) L->last = NULL;
    L->header = L->header->next;
    tmp->next = NULL;
    return tmp;
}
示例#10
0
GEdge *graphGetLink(GVertex *source, GVertex *destination)
{
	NodeList *p;

	if (!source->LAdjacents || listIsEmpty(source->LAdjacents)) return(NULL);

	p = listSearch(source->LAdjacents,destination,gEdgeCmpxDestination);
	if (!p) return(NULL);

	return((GEdge*)nodeListGetCont(p));
}
示例#11
0
NodeList *listRemoveLast(List *L){
    NodeList *tmp;
    if(listIsEmpty(L)) return NULL;
    tmp = L->last;
    if(L->header == L->last) L->header = L->last = NULL;
    else{
        NodeList *ant = listGetPrevious(L, L->last);
        L->last = ant;
        ant->next = NULL;
    }
    return tmp;
}
//===================================================================================================
BaseDesc initBaseDesc(FileType fileType){
	BaseDesc newBase = NULL;
	int size = sizeof(struct desc *);
	FILE * baseDesc;
	void * structDesc;
	BaseDesc ptr_p;
	void * desc;
	switch(fileType){
		/*case TEXT:
				baseDesc = fopen("TextBaseDesc.db", "r");
				structDesc = readTextDesc(baseDesc);
				size += sizeof(TextDesc);
        break;
        case PICTURE:
				baseDesc = fopen("PictureBaseDesc.db", "r");
				structDesc = readPictureDesc(baseDesc);
				size += sizeof(PictureDesc);
        break;*/
        case SOUND:
				baseDesc = fopen("SoundBaseDesc.db", "r");
				printf("%d\n", ftell(baseDesc));
				structDesc = readSoundDesc(baseDesc);				
				size += sizeof(SoundDesc);
        break; 
	}
	while(structDesc != NULL){
		BaseDesc ptr_add = (BaseDesc) malloc(size);    
		ptr_add->element = structDesc;
		printf("Yohoho\n");
		if(listIsEmpty(newBase)){
		    newBase = ptr_add;
			ptr_p = newBase;
		}
		else{
			ptr_p->next = ptr_add;
			ptr_p = ptr_p->next;
		}
		fseek(baseDesc, 1, SEEK_CUR);
		switch(fileType){
			/*case TEXT:
					structDesc = readTextDesc(baseDesc);
		    break;*/
		    case PICTURE:
					structDesc = readPictureDesc(baseDesc);
		    break;
		    case SOUND:
					structDesc = readSoundDesc(baseDesc);
		    break; 
		}
	}
	fclose(baseDesc);
	return newBase;
}
示例#13
0
static void freeMailInfo(struct MHINFO *w)
{
	struct MHINFO *v;
	while (!listIsEmpty(&w->components)) {
		v = w->components.next;
		delFromList(v);
		freeMailInfo(v);
	}
	nzFree(w->tolist);
	nzFree(w->cclist);
	nzFree(w);
}				/* freeMailInfo */
示例#14
0
struct ListNode* listMerge(listNode* list1, listNode* list2){

    listNode* returnNode = NULL;
    listNode* this = NULL;

    if(listIsEmpty(list1) == FALSE_T && listIsEmpty(list2) == FALSE_T){

        this = list1;

        while(this -> next != NULL){
            this = this -> next;
        }

        this -> next = list2;
        returnNode = list1;
    }
    else if(listIsEmpty(list1) == TRUE_T && listIsEmpty(list2) == FALSE_T){
        returnNode = list2;
    }
    else if(listIsEmpty(list1) == FALSE_T && listIsEmpty(list2) == TRUE_T){
        returnNode = list1;
    }
    else{
        returnNode = NULL;
    }

    return returnNode;
}
示例#15
0
void printCheaters(List** table,int studentNumber)
{
    printList(table[studentNumber]);

    ListElement* tmp = table[studentNumber]->first;
    if (!(listIsEmpty(table[studentNumber])))
        while(tmp != NULL)
        {
            printCheaters(table,tmp->value);
            tmp = tmp->next;
        }
    return;
}
示例#16
0
struct ListNode* listInsert(struct ListNode* list, unsigned int value){

    listNode* newNode = (struct ListNode*)malloc(sizeof(struct ListNode));
    newNode -> value = value;
    newNode -> next = NULL;

    if(listIsEmpty(list) == TRUE_T){
        return newNode;
    }

    newNode -> next = list;
    return newNode;
}
示例#17
0
void addToHashTable(HashTable* hTable, char string[])
{
	int index = hashFunction(string);
	if (listIsEmpty(hTable->hArray[index]))
	{
		add( hTable->hArray[index] , string );
	}
		
	else if (stringExsists(hTable->hArray[index],string))
		(search(hTable->hArray[index],string))->value2 ++ ;
		else 
			add( hTable->hArray[index] , string );

}
//===================================================================================================
void remove(DescriptorBase * p){
    if(listIsEmpty(*p))
        /** error **/;
    else{
        BaseDescriptor ptr_p = *base;
        do{
            if(ptr_p->next == NULL)
                break;
            ptr_p = ptr_p->next;
        }while(ptr_p != NULL);
        free(ptr_p->next)
    }
    // DO THE SAME ON THE FILE BASEDESCRIPTOR
}
示例#19
0
static void __tt_wq_set_event (void *arg)
{
	TT_WQ_T *wait_queue = (TT_WQ_T *)arg;
	
	while (!listIsEmpty (&wait_queue->list))
	{
		LIST_T *list = listGetNext (&wait_queue->list);
		TT_THREAD_T *thread = GetParentAddr (list, TT_THREAD_T, list_schedule);

		/* Append the thread to running thread */
		tt_set_thread_running (thread);
		
		__tt_schedule_yield (NULL);
	}	
}
示例#20
0
文件: List.c 项目: JacksonTeh/List
/*
 * To remove data out of the list and throw an error if list is empty
 *
 * Input
 *		list	is a pointer to List object
 *
 * Return
 *		dataRemove		data that remove out from the list
 */
int listRemove(List *list)
{
	int dataRemove;
	
	if(listIsEmpty(list))
		Throw(ERR_LIST_IS_EMPTY);
	
	// printf("buffer1: %d\n" , *list->buffer);
	// list->buffer++;
	// printf("buffer2: %d\n" , *list->buffer);
	// dataRemove = *list->buffer;
	list->size--;
	dataRemove = list->buffer[list->length - (list->size + 1)];
	// printf("dataRemove: %i\n", dataRemove);
	
	return dataRemove;
}
示例#21
0
int *retrieve(List *list , int *size)
{	
	int i = 0 ;
	int CountSize = 0;
	int *Storage;
	
	Storage = malloc(sizeof(int) * (*size));
	
	while(!listIsEmpty(list))
	{
		Storage[i++] = listRemove(list);
		CountSize++;
	}
	
	*size = CountSize;
	
	return Storage;
}
示例#22
0
/**
*	mergeList
*
*		Merge two lists. The list identified by parameter pSource is merged
*		with list pDest by appending all entries in pSource at the tail of
*		pDest.
*
*	@param	pDest			Address destination list
*	@param	pSource			Address source list.
*
*	@return		Address merged list (pDest).
**/
LIST *mergeList( LIST *pDest, LIST *pSource )
{
	if( pDest && !pDest->pvData )
	{
		if( pSource && !pSource->pvData && !listIsEmpty(pSource) )
		{
			pDest->pPrev->pNext	  = pSource->pNext;
			pSource->pNext->pPrev = pDest->pPrev;

			pDest->pPrev		= pSource->pPrev;
			pDest->pPrev->pNext = pDest;

			pSource->pNext = pSource;
			pSource->pPrev = pSource;
		}
	}
	return pDest;
}
示例#23
0
void add(List* list , int n , int i)
{
	if(!(listIsEmpty(list)))
	{

		if (i != 1)
		{
			ListElement* tmp = list->first ;
		for (int k = 1 ; k < i-1 ; k++)
		{
			tmp = tmp->next ;
		}
		ListElement* tmp2 = tmp->next ;
		tmp->next = new ListElement ;
		tmp->next->value = n ;
		tmp->next->next = tmp2 ;
		}
		else
		{
			ListElement* tmp = list->first ;
			for(int i = 1 ; i < elementsLeft(list) ; i++ )
				tmp = tmp->next;
			ListElement* tmp2 = new ListElement ;
			tmp2->value = n ;
			tmp2->next = list->first ;
			list->first = tmp2 ;
			tmp->next = tmp2 ;
		}
	}
	else
	{
		list->first = new ListElement ;
			ListElement* tmp = list->first ;
		for (int k = 1 ; k < i-1 ; k++)
		{
			tmp = tmp->next ;
		}
		ListElement* tmp2 = tmp->next ;
		tmp->next = new ListElement ;
		tmp->next->value = n ;
		tmp->next->next = tmp2 ;
	}
}
//===================================================================================================
void addDesc(BaseDesc *base, void * structDesc, FileType type){
	int size = sizeof(struct desc *);
	FILE * fileAdd;
	void * desc;
	switch(type){
		/*case TEXT: 
				size += sizeof(TextDesc);
				desc = (TextDesc*)structDesc;
				fileAdd = fopen("TextBaseDesc.db", "a");
				writeTextDesc(fileAdd, desc);
		break;*/
		case PICTURE: 
				size += sizeof(PictureDesc*);
				desc = (PictureDesc*)structDesc;
				fileAdd = fopen("PictureBaseDesc.db", "a");
				writePictureDesc(fileAdd, desc);
		break;
		case SOUND: 	
				size += sizeof(SoundDesc*);
				desc = (SoundDesc*)structDesc;
				fileAdd = fopen("SoundBaseDesc.db", "a");
				writeSoundDesc(fileAdd, desc);
		break;
	}
	fprintf(fileAdd, "\n");
	fclose(fileAdd);
	BaseDesc ptr_add = (BaseDesc) malloc(size);
	ptr_add->element = desc;	
	if(listIsEmpty(*base)){
        *base = ptr_add;
	}
    else{
        BaseDesc ptr_p = *base;
		// We will go to the last element of the chained list to add next to it the new element
        while(ptr_p != NULL){
            if(ptr_p->next == NULL)
                break;
            ptr_p = ptr_p->next;
        }
        ptr_p->next = ptr_add;
    }
}
//===================================================================================================
void printList(BaseDesc base, FileType type){
    // If the list is empty
    if(listIsEmpty(base))
        printf("Your list is empty, sir...\n");
    else{
        BaseDesc ptr_p = base;
        // We are using the pointer to travel few every element of the list until the last one
        while(ptr_p!=NULL){
			switch(type){
				/*case TEXT: printTextDesc(ptr_p->element);
				break;*/
				case PICTURE: printPictureDesc(ptr_p->element);
				break;
				case SOUND: printSoundDesc(ptr_p->element);
				break;
			}
            ptr_p = ptr_p->next;
        }
    }
}
示例#26
0
static genreNode *
GetGenreNode(dbADT db ,const char * genre)
{
    genreNode * node;
    int i=0,salgo=0;
    if(listIsEmpty(db->genreList))
	return NULL;
    SetBegin(db->genreList);
    while(!salgo)
    {
	if(GetData(db->genreList,(listElementT*)&node)==0 || i==db->cantGenre)
	    salgo=1;
	else
	{
	    if(strcmp(node->genre,genre)==0)
		return node;
	    i++;
	}
    }
    return NULL;
}
示例#27
0
int graphIsEmpty(Graph *G)
{
	return listIsEmpty(G);
}
示例#28
0
int main(int argc, char *argv[])
{
    List list;
    Data *data[6];

    int i, errors = 0;

    for (i = 0; i < 6; i++) {
        data[i] = calloc(1, sizeof(Data));
    }

    listInitialize(&list);

    TEST_INT(listLength(&list), 0);
    TEST_INT(listIsEmpty(&list),  TRUE);

    listAppendTail(&list, data[0]);
    listAppendTail(&list, data[1]);
    listAppendTail(&list, data[2]);
    listAppendTail(&list, data[3]);

    TEST_INT(listLength(&list), 4);
    TEST_INT(listIsEmpty(&list),  FALSE);

    TEST_PTR(listHead(&list), data[0]);
    TEST_PTR(listTail(&list), data[3]);

    TEST_PTR(listNext(data[0]), data[1]);
    TEST_PTR(listNext(data[1]), data[2]);
    TEST_PTR(listNext(data[2]), data[3]);
    TEST_PTR(listNext(data[3]), NULL);

    TEST_PTR(listPrev(data[3]), data[2]);
    TEST_PTR(listPrev(data[2]), data[1]);
    TEST_PTR(listPrev(data[1]), data[0]);
    TEST_PTR(listPrev(data[0]), NULL);

    TEST_PTR(listContaining(data[0]), &list);
    TEST_PTR(listContaining(data[1]), &list);
    TEST_PTR(listContaining(data[2]), &list);
    TEST_PTR(listContaining(data[3]), &list);

    listRemove(&list, data[0]);
    listRemove(&list, data[1]);
    listRemove(&list, data[2]);
    listRemove(&list, data[3]);

    TEST_INT(listLength(&list), 0);
    TEST_INT(listIsEmpty(&list),  TRUE);

    TEST_PTR(listContaining(data[0]), NULL);
    TEST_PTR(listContaining(data[1]), NULL);
    TEST_PTR(listContaining(data[2]), NULL);
    TEST_PTR(listContaining(data[3]), NULL);

    listInsertHead(&list, data[3]);
    listInsertHead(&list, data[2]);
    listInsertHead(&list, data[1]);
    listInsertHead(&list, data[0]);

    TEST_INT(listLength(&list), 4);
    TEST_INT(listIsEmpty(&list),  FALSE);

    TEST_PTR(listHead(&list), data[0]);
    TEST_PTR(listTail(&list), data[3]);

    TEST_PTR(listNext(data[0]), data[1]);
    TEST_PTR(listNext(data[1]), data[2]);
    TEST_PTR(listNext(data[2]), data[3]);
    TEST_PTR(listNext(data[3]), NULL);

    TEST_PTR(listPrev(data[3]), data[2]);
    TEST_PTR(listPrev(data[2]), data[1]);
    TEST_PTR(listPrev(data[1]), data[0]);
    TEST_PTR(listPrev(data[0]), NULL);

    TEST_PTR(listRemoveHead(&list), data[0]);
    TEST_PTR(listRemoveHead(&list), data[1]);
    TEST_PTR(listRemoveTail(&list), data[3]);
    TEST_PTR(listRemoveTail(&list), data[2]);

    TEST_INT(listLength(&list), 0);
    TEST_INT(listIsEmpty(&list),  TRUE);

    listAppendTail(&list, data[0]);
    listAppendTail(&list, data[3]);
    listAppend(&list, data[1], data[0]);
    listInsert(&list, data[2], data[3]);

    TEST_PTR(listRemoveHead(&list), data[0]);
    TEST_PTR(listRemoveHead(&list), data[1]);
    TEST_PTR(listRemoveTail(&list), data[3]);
    TEST_PTR(listRemoveTail(&list), data[2]);

    data[0]->i = 3;
    data[1]->i = 4;
    data[2]->i = 5;
    data[3]->i = 1;
    data[4]->i = 2;
    data[5]->i = 3;

    listAppendTail(&list, data[0]);
    listAppendTail(&list, data[1]);
    listAppendTail(&list, data[2]);
    listAppendTail(&list, data[3]);
    listAppendTail(&list, data[4]);
    listAppendTail(&list, data[5]);

    listSort(&list, cmp);

    TEST_PTR(listRemoveHead(&list), data[3]);
    TEST_PTR(listRemoveHead(&list), data[4]);
    TEST_PTR(listRemoveHead(&list), data[0]);
    TEST_PTR(listRemoveHead(&list), data[5]);
    TEST_PTR(listRemoveHead(&list), data[1]);
    TEST_PTR(listRemoveHead(&list), data[2]);

    exit(errors);
}
示例#29
0
文件: list.c 项目: Vifon/linked-list
void listPushBack(List root, void* val)
{
    listAddAfter(root,
                 listIsEmpty(root) ? root : listRBegin(root),
                 val);
}
示例#30
0
文件: oss.c 项目: liuchunhua/oss
ListBucketResult* ListObject(OSSPtr oss, const char* bucket, const char* prefix,
        unsigned int maxkeys, const char* marker, const char* delimiter)
{
    HttpRequest *request;
    HttpResponse * response;
    ListBucketResult* result;

    request = HttpRequestClass.init();
    request->method = strdup("GET");

    if(!oss->bucket)
        oss->bucket = strdup(bucket);

    char buf[1024] =
    { };
    buf[0] = '/';
    List list = listInit();
    char max_keys[5];
    sprintf(max_keys, "%d", maxkeys);

    if (prefix && strlen(prefix) > 0)
    {
        struct pair* p = malloc(sizeof(struct pair));
        p->key = "prefix";
        p->value = (char *)prefix;
        listAdd(list, p);
    }
    if (maxkeys > 0)
    {
        struct pair* p = malloc(sizeof(struct pair));
        p->key = "max-keys";
        p->value = max_keys;
        listAdd(list, p);
    }
    if (marker && strlen(marker) > 0)
    {
        struct pair* p = malloc(sizeof(struct pair));
        p->key = "marker";
        p->value = (char *)marker;
        listAdd(list, p);
    }
    if (delimiter && strlen(delimiter) > 0)
    {
        struct pair* p = malloc(sizeof(struct pair));
        p->key = "delimiter";
        p->value = (char *)delimiter;
        listAdd(list, p);
    }
    if (!listIsEmpty(list))
    {
        strcat(buf, "?");
        List node;
        for_each(node,list)
        {
            if (strstr(buf, "=") != NULL )
                strcat(buf, "&");
            struct pair* p = (struct pair*) node->ptr;
            strcat(buf, p->key);
            strcat(buf, "=");
            strcat(buf, (char*) p->value);
        }
    }