Release 4.10 tools/perf/util/strlist.h
#ifndef __PERF_STRLIST_H
#define __PERF_STRLIST_H
#include <linux/rbtree.h>
#include <stdbool.h>
#include "rblist.h"
struct str_node {
struct rb_node rb_node;
const char *s;
};
struct strlist {
struct rblist rblist;
bool dupstr;
bool file_only;
};
/*
* @file_only: When dirname is present, only consider entries as filenames,
* that should not be added to the list if dirname/entry is not
* found
*/
struct strlist_config {
bool dont_dupstr;
bool file_only;
const char *dirname;
};
struct strlist *strlist__new(const char *slist, const struct strlist_config *config);
void strlist__delete(struct strlist *slist);
void strlist__remove(struct strlist *slist, struct str_node *sn);
int strlist__load(struct strlist *slist, const char *filename);
int strlist__add(struct strlist *slist, const char *str);
struct str_node *strlist__entry(const struct strlist *slist, unsigned int idx);
struct str_node *strlist__find(struct strlist *slist, const char *entry);
static inline bool strlist__has_entry(struct strlist *slist, const char *entry)
{
return strlist__find(slist, entry) != NULL;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
masami hiramatsu | masami hiramatsu | 25 | 92.59% | 1 | 50.00% |
arnaldo carvalho de melo | arnaldo carvalho de melo | 2 | 7.41% | 1 | 50.00% |
| Total | 27 | 100.00% | 2 | 100.00% |
static inline bool strlist__empty(const struct strlist *slist)
{
return rblist__empty(&slist->rblist);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
arnaldo carvalho de melo | arnaldo carvalho de melo | 17 | 77.27% | 3 | 75.00% |
david ahern | david ahern | 5 | 22.73% | 1 | 25.00% |
| Total | 22 | 100.00% | 4 | 100.00% |
static inline unsigned int strlist__nr_entries(const struct strlist *slist)
{
return rblist__nr_entries(&slist->rblist);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
arnaldo carvalho de melo | arnaldo carvalho de melo | 18 | 78.26% | 3 | 75.00% |
david ahern | david ahern | 5 | 21.74% | 1 | 25.00% |
| Total | 23 | 100.00% | 4 | 100.00% |
/* For strlist iteration */
static inline struct str_node *strlist__first(struct strlist *slist)
{
struct rb_node *rn = rb_first(&slist->rblist.entries);
return rn ? rb_entry(rn, struct str_node, rb_node) : NULL;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
masami hiramatsu | masami hiramatsu | 40 | 90.91% | 1 | 33.33% |
arnaldo carvalho de melo | arnaldo carvalho de melo | 2 | 4.55% | 1 | 33.33% |
david ahern | david ahern | 2 | 4.55% | 1 | 33.33% |
| Total | 44 | 100.00% | 3 | 100.00% |
static inline struct str_node *strlist__next(struct str_node *sn)
{
struct rb_node *rn;
if (!sn)
return NULL;
rn = rb_next(&sn->rb_node);
return rn ? rb_entry(rn, struct str_node, rb_node) : NULL;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
masami hiramatsu | masami hiramatsu | 52 | 100.00% | 1 | 100.00% |
| Total | 52 | 100.00% | 1 | 100.00% |
/**
* strlist_for_each - iterate over a strlist
* @pos: the &struct str_node to use as a loop cursor.
* @slist: the &struct strlist for loop.
*/
#define strlist__for_each_entry(pos, slist) \
for (pos = strlist__first(slist); pos; pos = strlist__next(pos))
/**
* strlist_for_each_safe - iterate over a strlist safe against removal of
* str_node
* @pos: the &struct str_node to use as a loop cursor.
* @n: another &struct str_node to use as temporary storage.
* @slist: the &struct strlist for loop.
*/
#define strlist__for_each_entry_safe(pos, n, slist) \
for (pos = strlist__first(slist), n = strlist__next(pos); pos;\
pos = n, n = strlist__next(n))
#endif /* __PERF_STRLIST_H */
Overall Contributors
| Person | Tokens | Prop | Commits | CommitProp |
arnaldo carvalho de melo | arnaldo carvalho de melo | 192 | 53.78% | 7 | 58.33% |
masami hiramatsu | masami hiramatsu | 138 | 38.66% | 2 | 16.67% |
david ahern | david ahern | 17 | 4.76% | 1 | 8.33% |
namhyung kim | namhyung kim | 7 | 1.96% | 1 | 8.33% |
john kacur | john kacur | 3 | 0.84% | 1 | 8.33% |
| Total | 357 | 100.00% | 12 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.