ft_nm/src/tree.c

33 lines
596 B
C

#include "ft_nm.h"
int strcmp_nm(void *a, void *b) {
t_entry *aa = (t_entry *)a;
t_entry *bb = (t_entry *)b;
char *s1 = aa->symbol;
char *s2 = bb->symbol;
return ft_strcmp(s1, s2);
}
int reverse(void *a, void *b) {
return strcmp_nm(b, a);
}
int nosort(void *a, void *b) {
(void)a;
(void)b;
return 1;
}
void put_entry(void *data) {
t_node *node = (t_node *)data;
t_entry *entry = (t_entry *)node->data;
ft_putstr(entry->string);
}
void free_entry(void *data) {
t_node *node = (t_node *)data;
t_entry *entry = (t_entry *)node->data;
free(entry->string);
free(entry->symbol);
}