Lines Matching refs:slist
48 struct strlist *slist = container_of(rblist, struct strlist, rblist);
51 str_node__delete(snode, slist->dupstr);
62 int strlist__add(struct strlist *slist, const char *new_entry)
64 return rblist__add_node(&slist->rblist, new_entry);
67 int strlist__load(struct strlist *slist, const char *filename)
83 err = strlist__add(slist, entry);
94 void strlist__remove(struct strlist *slist, struct str_node *snode)
96 rblist__remove_node(&slist->rblist, &snode->rb_node);
99 struct str_node *strlist__find(struct strlist *slist, const char *entry)
102 struct rb_node *rb_node = rblist__find(&slist->rblist, entry);
110 static int strlist__parse_list_entry(struct strlist *slist, const char *s)
113 return strlist__load(slist, s + 7);
115 return strlist__add(slist, s);
118 int strlist__parse_list(struct strlist *slist, const char *s)
125 err = strlist__parse_list_entry(slist, s);
132 return *s ? strlist__parse_list_entry(slist, s) : 0;
137 struct strlist *slist = malloc(sizeof(*slist));
139 if (slist != NULL) {
140 rblist__init(&slist->rblist);
141 slist->rblist.node_cmp = strlist__node_cmp;
142 slist->rblist.node_new = strlist__node_new;
143 slist->rblist.node_delete = strlist__node_delete;
145 slist->dupstr = dupstr;
146 if (list && strlist__parse_list(slist, list) != 0)
150 return slist;
152 free(slist);
156 void strlist__delete(struct strlist *slist)
158 if (slist != NULL)
159 rblist__delete(&slist->rblist);
162 struct str_node *strlist__entry(const struct strlist *slist, unsigned int idx)
167 rb_node = rblist__entry(&slist->rblist, idx);