linux/tools/perf/util/string2.h
<<
>>
Prefs
   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
   9s64 perf_atoll(const char *str);
  10char **argv_split(const char *str, int *argcp);
  11void argv_free(char **argv);
  12bool strglobmatch(const char *str, const char *pat);
  13bool strglobmatch_nocase(const char *str, const char *pat);
  14bool strlazymatch(const char *str, const char *pat);
  15static inline bool strisglob(const char *str)
  16{
  17        return strpbrk(str, "*?[") != NULL;
  18}
  19int strtailcmp(const char *s1, const char *s2);
  20char *strxfrchar(char *s, char from, char to);
  21
  22char *ltrim(char *s);
  23char *rtrim(char *s);
  24
  25static inline char *trim(char *s)
  26{
  27        return ltrim(rtrim(s));
  28}
  29
  30char *asprintf_expr_inout_ints(const char *var, bool in, size_t nints, int *ints);
  31
  32static 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
  37static 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
  42char *strpbrk_esc(char *str, const char *stopset);
  43char *strdup_esc(const char *str);
  44
  45#endif /* PERF_STRING_H */
  46