38 static void str_node__delete(
struct str_node *
self,
bool dupstr)
41 free((
void *)self->s);
46 void strlist__node_delete(
struct rblist *rblist,
struct rb_node *
rb_node)
48 struct strlist *slist =
container_of(rblist,
struct strlist, rblist);
51 str_node__delete(snode, slist->
dupstr);
54 static int strlist__node_cmp(
struct rb_node *
rb_node,
const void *entry)
71 FILE *
fp = fopen(filename,
"r");
76 while (fgets(entry,
sizeof(entry), fp) !=
NULL) {
81 entry[len - 1] =
'\0';
110 static int strlist__parse_list_entry(
struct strlist *
self,
const char *s)
112 if (
strncmp(s,
"file://", 7) == 0)
125 err = strlist__parse_list_entry(
self, s);
132 return *s ? strlist__parse_list_entry(
self, s) : 0;
137 struct strlist *
self =
malloc(
sizeof(*
self));
141 self->rblist.node_cmp = strlist__node_cmp;
142 self->rblist.node_new = strlist__node_new;
143 self->rblist.node_delete = strlist__node_delete;