Linux Perf
string.c File Reference
#include "string2.h"
#include <linux/kernel.h>
#include <linux/string.h>
#include <stdlib.h>
#include "sane_ctype.h"
Include dependency graph for string.c:

Go to the source code of this file.

Macros

#define K   1024LL
 

Functions

s64 perf_atoll (const char *str)
 
static const char * skip_sep (const char *cp)
 
static const char * skip_arg (const char *cp)
 
static int count_argc (const char *str)
 
void argv_free (char **argv)
 
char ** argv_split (const char *str, int *argcp)
 
static bool __match_charclass (const char *pat, char c, const char **npat)
 
static bool __match_glob (const char *str, const char *pat, bool ignore_space, bool case_ins)
 
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)
 
int strtailcmp (const char *s1, const char *s2)
 
char * strxfrchar (char *s, char from, char to)
 
char * ltrim (char *s)
 
char * rtrim (char *s)
 
char * asprintf_expr_inout_ints (const char *var, bool in, size_t nints, int *ints)
 
char * strpbrk_esc (char *str, const char *stopset)
 
char * strdup_esc (const char *str)
 

Macro Definition Documentation

◆ K

#define K   1024LL

Definition at line 9 of file string.c.

Function Documentation

◆ __match_charclass()

static bool __match_charclass ( const char *  pat,
char  c,
const char **  npat 
)
static

Definition at line 167 of file string.c.

◆ __match_glob()

static bool __match_glob ( const char *  str,
const char *  pat,
bool  ignore_space,
bool  case_ins 
)
static

Definition at line 205 of file string.c.

Here is the call graph for this function:

◆ argv_free()

void argv_free ( char **  argv)

argv_free - free an argv - the argument vector to be freed

Frees an argv and the strings it points to.

Definition at line 104 of file string.c.

Here is the call graph for this function:

◆ argv_split()

char** argv_split ( const char *  str,
int *  argcp 
)

argv_split - split a string at whitespace, returning an argv : the string to be split : returned argument count

Returns an array of pointers to strings which are split out from . This is performed by strictly splitting on white-space; no quote processing is performed. Multiple whitespace characters are considered to be a single argument separator. The returned array is always NULL-terminated. Returns NULL on memory allocation failure.

Definition at line 127 of file string.c.

Here is the call graph for this function:

◆ asprintf_expr_inout_ints()

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

Definition at line 361 of file string.c.

Here is the call graph for this function:

◆ count_argc()

static int count_argc ( const char *  str)
static

Definition at line 83 of file string.c.

Here is the call graph for this function:

◆ ltrim()

char* ltrim ( char *  s)

ltrim - Removes leading whitespace from . : The string to be stripped.

Return pointer to the first non-whitespace character in .

Definition at line 330 of file string.c.

◆ perf_atoll()

s64 perf_atoll ( const char *  str)

Definition at line 15 of file string.c.

◆ rtrim()

char* rtrim ( char *  s)

rtrim - Removes trailing whitespace from . : The string to be stripped.

Note that the first trailing whitespace is replaced with a NUL-terminator in the given string . Returns .

Definition at line 345 of file string.c.

◆ skip_arg()

static const char* skip_arg ( const char *  cp)
static

Definition at line 75 of file string.c.

◆ skip_sep()

static const char* skip_sep ( const char *  cp)
static

Definition at line 67 of file string.c.

◆ strdup_esc()

char* strdup_esc ( const char *  str)

Definition at line 417 of file string.c.

◆ strglobmatch()

bool strglobmatch ( const char *  str,
const char *  pat 
)

strglobmatch - glob expression pattern matching : the target string to match : the pattern string to match

This returns true if the matches . can includes wildcards ('*','?') and character classes ([CHARS], complementation and ranges are also supported). Also, this supports escape character ('\') to use special characters as normal character.

Note: if syntax is broken, this always returns false.

Definition at line 265 of file string.c.

Here is the call graph for this function:

◆ strglobmatch_nocase()

bool strglobmatch_nocase ( const char *  str,
const char *  pat 
)

Definition at line 270 of file string.c.

Here is the call graph for this function:

◆ strlazymatch()

bool strlazymatch ( const char *  str,
const char *  pat 
)

strlazymatch - matching pattern strings lazily with glob pattern : the target string to match : the pattern string to match

This is similar to strglobmatch, except this ignores spaces in the target string.

Definition at line 283 of file string.c.

Here is the call graph for this function:

◆ strpbrk_esc()

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

Definition at line 401 of file string.c.

◆ strtailcmp()

int strtailcmp ( const char *  s1,
const char *  s2 
)

strtailcmp - Compare the tail of two strings : 1st string to be compared : 2nd string to be compared

Return 0 if whole of either string is same as another's tail part.

Definition at line 295 of file string.c.

◆ strxfrchar()

char* strxfrchar ( char *  s,
char  from,
char  to 
)

strxfrchar - Locate and replace character in : The string to be searched/changed. : Source character to be replaced. : Destination character.

Return pointer to the changed string.

Definition at line 314 of file string.c.