1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #ifndef PERF_STRING_H 3 #define PERF_STRING_H 4 5 #include <linux/string.h> 6 #include <linux/types.h> 7 #include <stddef.h> 8 #include <string.h> 9 10 extern const char *graph_dotted_line; 11 extern const char *dots; 12 13 s64 perf_atoll(const char *str); 14 char **argv_split(const char *str, int *argcp); 15 void argv_free(char **argv); 16 bool strglobmatch(const char *str, const char *pat); 17 bool strglobmatch_nocase(const char *str, const char *pat); 18 bool strlazymatch(const char *str, const char *pat); 19 static inline bool strisglob(const char *str) 20 { 21 return strpbrk(str, "*?[") != NULL; 22 } 23 int strtailcmp(const char *s1, const char *s2); 24 char *strxfrchar(char *s, char from, char to); 25 26 char *rtrim(char *s); 27 28 char *asprintf_expr_inout_ints(const char *var, bool in, size_t nints, int *ints); 29 30 static inline char *asprintf_expr_in_ints(const char *var, size_t nints, int *ints) 31 { 32 return asprintf_expr_inout_ints(var, true, nints, ints); 33 } 34 35 static inline char *asprintf_expr_not_in_ints(const char *var, size_t nints, int *ints) 36 { 37 return asprintf_expr_inout_ints(var, false, nints, ints); 38 } 39 40 char *strpbrk_esc(char *str, const char *stopset); 41 char *strdup_esc(const char *str); 42 43 #endif /* PERF_STRING_H */ 44