string2.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef PERF_STRING_H
  3. #define PERF_STRING_H
  4. #include <linux/string.h>
  5. #include <linux/types.h>
  6. #include <sys/types.h> // pid_t
  7. #include <stddef.h>
  8. #include <string.h>
  9. extern const char *graph_dotted_line;
  10. extern const char *dots;
  11. s64 perf_atoll(const char *str);
  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 *asprintf_expr_inout_ints(const char *var, bool in, size_t nints, int *ints);
  21. static inline char *asprintf_expr_in_ints(const char *var, size_t nints, int *ints)
  22. {
  23. return asprintf_expr_inout_ints(var, true, nints, ints);
  24. }
  25. static inline char *asprintf_expr_not_in_ints(const char *var, size_t nints, int *ints)
  26. {
  27. return asprintf_expr_inout_ints(var, false, nints, ints);
  28. }
  29. char *asprintf__tp_filter_pids(size_t npids, pid_t *pids);
  30. char *strpbrk_esc(char *str, const char *stopset);
  31. char *strdup_esc(const char *str);
  32. char *strpbrk_esq(char *str, const char *stopset);
  33. char *strdup_esq(const char *str);
  34. unsigned int hex(char c);
  35. char *strreplace_chars(char needle, const char *haystack, const char *replace);
  36. #endif /* PERF_STRING_H */