blob: 2f619681bd6a7084f5620ea077e8e69d1d659893 [file] [log] [blame]
Arnaldo Carvalho de Meloa0675582017-04-17 16:51:59 -03001#ifndef PERF_STRING_H
2#define PERF_STRING_H
3
4#include <linux/types.h>
5#include <stddef.h>
6#include <string.h>
7
8s64 perf_atoll(const char *str);
9char **argv_split(const char *str, int *argcp);
10void argv_free(char **argv);
11bool strglobmatch(const char *str, const char *pat);
12bool strglobmatch_nocase(const char *str, const char *pat);
13bool strlazymatch(const char *str, const char *pat);
14static inline bool strisglob(const char *str)
15{
16 return strpbrk(str, "*?[") != NULL;
17}
18int strtailcmp(const char *s1, const char *s2);
19char *strxfrchar(char *s, char from, char to);
20
21char *ltrim(char *s);
22char *rtrim(char *s);
23
24static inline char *trim(char *s)
25{
26 return ltrim(rtrim(s));
27}
28
29char *asprintf_expr_inout_ints(const char *var, bool in, size_t nints, int *ints);
30
31static inline char *asprintf_expr_in_ints(const char *var, size_t nints, int *ints)
32{
33 return asprintf_expr_inout_ints(var, true, nints, ints);
34}
35
36static inline char *asprintf_expr_not_in_ints(const char *var, size_t nints, int *ints)
37{
38 return asprintf_expr_inout_ints(var, false, nints, ints);
39}
40
41
42#endif /* PERF_STRING_H */