mtd: nandsim: Define CONFIG_NANDSIM_MAX_PARTS and use it instead of MAX_MTD_DEVICES
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / tools / perf / util / strlist.h
blobcb4659306d7bd02221091716e6cc4151d560d1ef
1 #ifndef __PERF_STRLIST_H
2 #define __PERF_STRLIST_H
4 #include <linux/rbtree.h>
5 #include <stdbool.h>
7 struct str_node {
8 struct rb_node rb_node;
9 const char *s;
12 struct strlist {
13 struct rb_root entries;
14 unsigned int nr_entries;
15 bool dupstr;
18 struct strlist *strlist__new(bool dupstr, const char *slist);
19 void strlist__delete(struct strlist *self);
21 void strlist__remove(struct strlist *self, struct str_node *sn);
22 int strlist__load(struct strlist *self, const char *filename);
23 int strlist__add(struct strlist *self, const char *str);
25 struct str_node *strlist__entry(const struct strlist *self, unsigned int idx);
26 bool strlist__has_entry(struct strlist *self, const char *entry);
28 static inline bool strlist__empty(const struct strlist *self)
30 return self->nr_entries == 0;
33 static inline unsigned int strlist__nr_entries(const struct strlist *self)
35 return self->nr_entries;
38 int strlist__parse_list(struct strlist *self, const char *s);
39 #endif /* __PERF_STRLIST_H */