/home/aching/Avery/Work.School/Research/pvfs2-lock/s3asim/src/llist.c File Reference

#include "llist.h"

Defines

#define LIST1   1
#define LIST2   2

Functions

lresult_smerge_lresult (struct lresult_s *list1_p, struct lresult_s *list2_p)
void free_lresult_list (struct lresult_s *list_head)
int cpy_result (struct result_s *dest_result_p, struct result_s *src_result_p)
void print_lresult_list (struct lresult_s *list_head)
lresult_screate_list_head (struct result_s *result_p)
void push_list (struct lresult_s *list_head, struct result_s *result_p)
lresult_sdelete_list_head (struct lresult_s *list_head)

Define Documentation

#define LIST1   1

#define LIST2   2


Function Documentation

int cpy_result ( struct result_s dest_result_p,
struct result_s src_result_p 
)

Copy information from one result to another. If the src result has result data, copy that as well.

Parameters:
dest_result_p Result which will be overwritten.
src_result_p Result which will be used as the source.
Returns:
0 on success.

struct lresult_s* create_list_head ( struct result_s result_p  ) 

Allocate and fill in the attributes for a list head from a result.

Parameters:
result_p Result information to be added to the list head.
Returns:
The list head.

struct lresult_s* delete_list_head ( struct lresult_s list_head  ) 

Attempts to delete the list_head. It could return NULL, which indicates that the list no longer exists.

Parameters:
list_head Pointer to the head of a result list.
Returns:
The new list head.

void free_lresult_list ( struct lresult_s list_head  ) 

For every element in the result list, it frees the data of each list element and then frees the list element itself.

Parameters:
list_head Result list to be freed.

struct lresult_s* merge_lresult ( struct lresult_s list1_p,
struct lresult_s list2_p 
)

Takes two locally ordered linked lists and merges them into one sorted linked list which is returned. The ordering is based on the score and then secondly the result_id. The memory from the input result lists is freed.

Parameters:
list1_p Locally ordered linked list 1.
list2_p Locally ordered linked list 2.
Returns:
Ordered merged linked list.

void print_lresult_list ( struct lresult_s list_head  ) 

Print result attributes and data of an entire result list.

Parameters:
list_head The head pointer of a result list.

void push_list ( struct lresult_s list_head,
struct result_s result_p 
)

Add an element to the result list.

Parameters:
list_head A result list pointer, where the next pointer will point to the new element.
result_p Result information to be added to the new element in the list.


Generated on Sun May 20 13:10:04 2007 for s3asim by  doxygen 1.4.7