Commit 7d2a3021 authored by Simon Morlat's avatar Simon Morlat

add ms_list_copy_with_data()

parent 5662b24b
......@@ -141,6 +141,7 @@ MS2_PUBLIC int ms_list_index(const MSList *list, void *data);
MS2_PUBLIC MSList *ms_list_insert_sorted(MSList *list, void *data, MSCompareFunc compare_func);
MS2_PUBLIC MSList *ms_list_insert(MSList *list, MSList *before, void *data);
MS2_PUBLIC MSList *ms_list_copy(const MSList *list);
MS2_PUBLIC MSList *ms_list_copy_with_data(const MSList *list, void *(*copyfunc)(void *));
#undef MIN
#define MIN(a,b) ((a)>(b) ? (b) : (a))
......
......@@ -275,6 +275,15 @@ MSList *ms_list_copy(const MSList *list){
return copy;
}
MSList *ms_list_copy_with_data(const MSList *list, void *(*copyfunc)(void *)){
MSList *copy=NULL;
const MSList *iter;
for(iter=list;iter!=NULL;iter=ms_list_next(iter)){
copy=ms_list_append(copy,copyfunc(iter->data));
}
return copy;
}
int ms_load_plugins(const char *dir){
return ms_factory_load_plugins(ms_factory_get_fallback(),dir);
}
......
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