Linux Perf
strfilter.c File Reference
#include "util.h"
#include "string2.h"
#include "strfilter.h"
#include <errno.h>
#include "sane_ctype.h"
Include dependency graph for strfilter.c:

Go to the source code of this file.

Macros

#define is_operator(c)   ((c) == '|' || (c) == '&' || (c) == '!')
 
#define is_separator(c)   (is_operator(c) || (c) == '(' || (c) == ')')
 

Functions

static void strfilter_node__delete (struct strfilter_node *node)
 
void strfilter__delete (struct strfilter *filter)
 
static const char * get_token (const char *s, const char **e)
 
static struct strfilter_nodestrfilter_node__alloc (const char *op, struct strfilter_node *l, struct strfilter_node *r)
 
static struct strfilter_nodestrfilter_node__new (const char *s, const char **ep)
 
struct strfilterstrfilter__new (const char *rules, const char **err)
 
static int strfilter__append (struct strfilter *filter, bool _or, const char *rules, const char **err)
 
int strfilter__or (struct strfilter *filter, const char *rules, const char **err)
 
int strfilter__and (struct strfilter *filter, const char *rules, const char **err)
 
static bool strfilter_node__compare (struct strfilter_node *node, const char *str)
 
bool strfilter__compare (struct strfilter *filter, const char *str)
 
static int strfilter_node__sprint (struct strfilter_node *node, char *buf)
 
static int strfilter_node__sprint_pt (struct strfilter_node *node, char *buf)
 
char * strfilter__string (struct strfilter *filter)
 

Variables

static const char * OP_and = "&"
 
static const char * OP_or = "|"
 
static const char * OP_not = "!"
 

Macro Definition Documentation

◆ is_operator

#define is_operator (   c)    ((c) == '|' || (c) == '&' || (c) == '!')

Definition at line 14 of file strfilter.c.

◆ is_separator

#define is_separator (   c)    (is_operator(c) || (c) == '(' || (c) == ')')

Definition at line 15 of file strfilter.c.

Function Documentation

◆ get_token()

static const char* get_token ( const char *  s,
const char **  e 
)
static

Definition at line 36 of file strfilter.c.

◆ strfilter__and()

int strfilter__and ( struct strfilter filter,
const char *  rules,
const char **  err 
)

strfilter__add - Append an additional rule by logical-and : Original string filter : Filter rule to be appended at left of the root of by using logical-and. : Pointer which points an error detected on

Parse and join it to the by using logical-and. Return 0 if success, or return the error code.

Definition at line 211 of file strfilter.c.

Here is the call graph for this function:

◆ strfilter__append()

static int strfilter__append ( struct strfilter filter,
bool  _or,
const char *  rules,
const char **  err 
)
static

Definition at line 177 of file strfilter.c.

Here is the call graph for this function:

◆ strfilter__compare()

bool strfilter__compare ( struct strfilter filter,
const char *  str 
)

strfilter__compare - compare given string and a string filter : String filter : target string

Compare and . Return true if the str match the rule

Definition at line 238 of file strfilter.c.

Here is the call graph for this function:

◆ strfilter__delete()

void strfilter__delete ( struct strfilter filter)

strfilter__delete - delete a string filter : String filter to delete

Delete .

Definition at line 28 of file strfilter.c.

Here is the call graph for this function:

◆ strfilter__new()

struct strfilter* strfilter__new ( const char *  rules,
const char **  err 
)

strfilter__new - Create a new string filter : Filter rule, which is a combination of glob expressions. : Pointer which points an error detected on

Parse and return new strfilter. Return NULL if an error detected. In that case, * will indicate where it is detected, and * is NULL if a memory allocation is failed.

Definition at line 159 of file strfilter.c.

Here is the call graph for this function:

◆ strfilter__or()

int strfilter__or ( struct strfilter filter,
const char *  rules,
const char **  err 
)

strfilter__or - Append an additional rule by logical-or : Original string filter : Filter rule to be appended at left of the root of by using logical-or. : Pointer which points an error detected on

Parse and join it to the by using logical-or. Return 0 if success, or return the error code.

Definition at line 206 of file strfilter.c.

Here is the call graph for this function:

◆ strfilter__string()

char* strfilter__string ( struct strfilter filter)

strfilter__string - Reconstruct a rule string from filter : String filter to reconstruct

Reconstruct a rule string from . This will be good for debug messages. Note that returning string must be freed afterward.

Definition at line 297 of file strfilter.c.

Here is the call graph for this function:

◆ strfilter_node__alloc()

static struct strfilter_node* strfilter_node__alloc ( const char *  op,
struct strfilter_node l,
struct strfilter_node r 
)
static

Definition at line 65 of file strfilter.c.

Here is the call graph for this function:

◆ strfilter_node__compare()

static bool strfilter_node__compare ( struct strfilter_node node,
const char *  str 
)
static

Definition at line 217 of file strfilter.c.

Here is the call graph for this function:

◆ strfilter_node__delete()

static void strfilter_node__delete ( struct strfilter_node node)
static

Definition at line 17 of file strfilter.c.

Here is the call graph for this function:

◆ strfilter_node__new()

static struct strfilter_node* strfilter_node__new ( const char *  s,
const char **  ep 
)
static

Definition at line 80 of file strfilter.c.

Here is the call graph for this function:

◆ strfilter_node__sprint()

static int strfilter_node__sprint ( struct strfilter_node node,
char *  buf 
)
static

Definition at line 263 of file strfilter.c.

Here is the call graph for this function:

◆ strfilter_node__sprint_pt()

static int strfilter_node__sprint_pt ( struct strfilter_node node,
char *  buf 
)
static

Definition at line 248 of file strfilter.c.

Here is the call graph for this function:

Variable Documentation

◆ OP_and

const char* OP_and = "&"
static

Definition at line 10 of file strfilter.c.

◆ OP_not

const char* OP_not = "!"
static

Definition at line 12 of file strfilter.c.

◆ OP_or

const char* OP_or = "|"
static

Definition at line 11 of file strfilter.c.