Linux Perf
string2.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef PERF_STRING_H
3 #define PERF_STRING_H
4 
5 #include <linux/types.h>
6 #include <stddef.h>
7 #include <string.h>
8 
9 s64 perf_atoll(const char *str);
10 char **argv_split(const char *str, int *argcp);
11 void argv_free(char **argv);
12 bool strglobmatch(const char *str, const char *pat);
13 bool strglobmatch_nocase(const char *str, const char *pat);
14 bool strlazymatch(const char *str, const char *pat);
15 static inline bool strisglob(const char *str)
16 {
17  return strpbrk(str, "*?[") != NULL;
18 }
19 int strtailcmp(const char *s1, const char *s2);
20 char *strxfrchar(char *s, char from, char to);
21 
22 char *ltrim(char *s);
23 char *rtrim(char *s);
24 
25 static inline char *trim(char *s)
26 {
27  return ltrim(rtrim(s));
28 }
29 
30 char *asprintf_expr_inout_ints(const char *var, bool in, size_t nints, int *ints);
31 
32 static inline char *asprintf_expr_in_ints(const char *var, size_t nints, int *ints)
33 {
34  return asprintf_expr_inout_ints(var, true, nints, ints);
35 }
36 
37 static inline char *asprintf_expr_not_in_ints(const char *var, size_t nints, int *ints)
38 {
39  return asprintf_expr_inout_ints(var, false, nints, ints);
40 }
41 
42 char *strpbrk_esc(char *str, const char *stopset);
43 char *strdup_esc(const char *str);
44 
45 #endif /* PERF_STRING_H */
char * rtrim(char *s)
Definition: string.c:345
static char * asprintf_expr_in_ints(const char *var, size_t nints, int *ints)
Definition: string2.h:32
char * strdup_esc(const char *str)
Definition: string.c:417
bool strglobmatch(const char *str, const char *pat)
Definition: string.c:265
static bool strisglob(const char *str)
Definition: string2.h:15
char * strxfrchar(char *s, char from, char to)
Definition: string.c:314
char * strpbrk_esc(char *str, const char *stopset)
Definition: string.c:401
static char * trim(char *s)
Definition: string2.h:25
void argv_free(char **argv)
Definition: string.c:104
char ** argv_split(const char *str, int *argcp)
Definition: string.c:127
s64 perf_atoll(const char *str)
Definition: string.c:15
static int str(yyscan_t scanner, int token)
int strtailcmp(const char *s1, const char *s2)
Definition: string.c:295
static char * asprintf_expr_not_in_ints(const char *var, size_t nints, int *ints)
Definition: string2.h:37
char * ltrim(char *s)
Definition: string.c:330
bool strlazymatch(const char *str, const char *pat)
Definition: string.c:283
bool strglobmatch_nocase(const char *str, const char *pat)
Definition: string.c:270
char * asprintf_expr_inout_ints(const char *var, bool in, size_t nints, int *ints)
Definition: string.c:361