summaryrefslogtreecommitdiffstats
path: root/tools/perf/util/string2.h
blob: 52cb8ba057c7797139b78cb8b9838ab3df36e194 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef PERF_STRING_H
#define PERF_STRING_H

#include <linux/string.h>
#include <linux/types.h>
#include <sys/types.h> // pid_t
#include <stddef.h>
#include <string.h>

extern const char *graph_dotted_line;
extern const char *dots;

s64 perf_atoll(const char *str);
bool strglobmatch(const char *str, const char *pat);
bool strglobmatch_nocase(const char *str, const char *pat);
bool strlazymatch(const char *str, const char *pat);
static inline bool strisglob(const char *str)
{
	return strpbrk(str, "*?[") != NULL;
}
int strtailcmp(const char *s1, const char *s2);

char *asprintf_expr_inout_ints(const char *var, bool in, size_t nints, int *ints);

static inline char *asprintf_expr_in_ints(const char *var, size_t nints, int *ints)
{
	return asprintf_expr_inout_ints(var, true, nints, ints);
}

static inline char *asprintf_expr_not_in_ints(const char *var, size_t nints, int *ints)
{
	return asprintf_expr_inout_ints(var, false, nints, ints);
}

char *asprintf__tp_filter_pids(size_t npids, pid_t *pids);

char *strpbrk_esc(char *str, const char *stopset);
char *strdup_esc(const char *str);

unsigned int hex(char c);
char *strreplace_chars(char needle, const char *haystack, const char *replace);

#endif /* PERF_STRING_H */