#include #include #include #include "llist.h" void list_LList (LList l, int (*visit)(void*)) { if (l){ visit(l->elem); list_LList (l->next, visit); } } LList insert_LList(LList l, void *e, int size) { LList aux; aux = (LList) malloc(sizeof (LListNode)); aux->elem = malloc(size); memcpy( aux->elem, e, size); aux->next = l; return aux; } LList sortedinsert(LList l, void *e, int size, int (*comp)(void*, void*)) { if(!l || (comp(e,l->elem)==1)) return insert_LList(l,e,size); else { l->next = sortedinsert(l->next, e, size, comp); return l; } } LList removeLList(LList l, void *e, int (*comp)(void*, void*)) { LList aux; printf("\nENTREI: %s\n\n", e); if(!l || (comp(e,l->elem)==1)) return l; else if(!comp(e,l->elem)) { aux = l->next; free(l->elem); free(l); return aux; } else { l->next = removeLList( l->next, e, comp ); return l; } }