Commit 6251dea5 authored by Simon Morlat's avatar Simon Morlat

add new list function

parent fd8f21d7
......@@ -123,6 +123,7 @@ extern "C"{
void ms_thread_exit(void* ret_val);
MS2_PUBLIC MSList * ms_list_append(MSList *elem, void * data);
MS2_PUBLIC MSList *ms_list_append_link(MSList *elem, MSList *new_elem);
MS2_PUBLIC MSList * ms_list_prepend(MSList *elem, void * data);
MS2_PUBLIC MSList * ms_list_free(MSList *elem);
MS2_PUBLIC MSList * ms_list_concat(MSList *first, MSList *second);
......
......@@ -83,8 +83,7 @@ MSList *ms_list_new(void *data){
return new_elem;
}
MSList * ms_list_append(MSList *elem, void * data){
MSList *new_elem=ms_list_new(data);
MSList *ms_list_append_link(MSList *elem, MSList *new_elem){
MSList *it=elem;
if (elem==NULL) return new_elem;
while (it->next!=NULL) it=ms_list_next(it);
......@@ -93,6 +92,11 @@ MSList * ms_list_append(MSList *elem, void * data){
return elem;
}
MSList * ms_list_append(MSList *elem, void * data){
MSList *new_elem=ms_list_new(data);
return ms_list_append_link(elem,new_elem);
}
MSList * ms_list_prepend(MSList *elem, void *data){
MSList *new_elem=ms_list_new(data);
if (elem!=NULL) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment