Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
string.c File Reference
#include "util.h"
#include "linux/string.h"

Go to the source code of this file.


#define K   1024LL


s64 perf_atoll (const char *str)
void argv_free (char **argv)
char ** argv_split (const char *str, int *argcp)
bool strglobmatch (const char *str, const char *pat)
bool strlazymatch (const char *str, const char *pat)
int strtailcmp (const char *s1, const char *s2)
charrtrim (char *s)
voidmemdup (const void *src, size_t len)

Macro Definition Documentation

#define K   1024LL

Definition at line 4 of file string.c.

Function Documentation

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 127 of file string.c.

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 148 of file string.c.

void* memdup ( const void src,
size_t  len 

memdup - duplicate region of memory : memory region to duplicate : memory region length

Definition at line 344 of file string.c.

s64 perf_atoll ( const char str)

Definition at line 10 of file string.c.

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 323 of file string.c.

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 280 of file string.c.

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 293 of file string.c.

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 305 of file string.c.