rpm
5.4.14
|
#include "system.h"
#include <rpmiotypes.h>
#include <rpmio.h>
#include <rpmlog.h>
#include <mire.h>
#include "debug.h"
Go to the source code of this file.
Macros | |
#define | _MIRE_INTERNAL |
Functions | |
int | mireClean (miRE mire) |
Deallocate pattern match memory. More... | |
static void | mireFini (void *_mire) |
miRE | mireGetPool (rpmioPool pool) |
Allocate a miRE container from the pool. More... | |
void * | mireFreeAll (miRE mire, int nmire) |
Destroy compiled patterns. More... | |
miRE | mireNew (rpmMireMode mode, int tag) |
Create pattern container. More... | |
int | mireSetCOptions (miRE mire, rpmMireMode mode, int tag, int options, const unsigned char *table) |
Initialize pattern compile options. More... | |
int | mireSetEOptions (miRE mire, int *offsets, int noffsets) |
Initialize pattern execute options (PCRE only). More... | |
int | mireSetGOptions (const char *newline, int caseless, int multiline, int utf8) |
Initialize pattern global options (PCRE only). More... | |
int | mireSetLocale (miRE mire, const char *locale) |
Compile locale-specific PCRE tables. More... | |
int | mireRegcomp (miRE mire, const char *pattern) |
Compile pattern match. More... | |
int | mireRegexec (miRE mire, const char *val, size_t vallen) |
Execute pattern match. More... | |
int | mireAppend (rpmMireMode mode, int tag, const char *pattern, const unsigned char *table, miRE *mirep, int *nmirep) |
Append pattern to array. More... | |
int | mireLoadPatterns (rpmMireMode mode, int tag, const char **patterns, const unsigned char *table, miRE *mirep, int *nmirep) |
Load patterns from string array. More... | |
int | mireApply (miRE mire, int nmire, const char *s, size_t slen, int rc) |
Apply array of patterns to a string. More... | |
int | mireStudy (miRE mire, int nmires) |
Study PCRE patterns (if any). More... | |
Variables | |
int | _mire_debug = 0 |
const unsigned char * | _mirePCREtables = NULL |
mireEL_t | _mireEL = EL_LF |
int | _mireSTRINGoptions = 0 |
STRING default: 0. More... | |
int | _mireGLOBoptions = FNM_EXTMATCH | FNM_PATHNAME | FNM_PERIOD |
GLOB default: FNM_PATHNAME | FNM_PERIOD. More... | |
int | _mireREGEXoptions = REG_EXTENDED | REG_NEWLINE |
REGEX default: REG_EXTENDED. More... | |
int | _mirePCREoptions = 0 |
PCRE default: 0. More... | |
rpmioPool | _mirePool |
int mireAppend | ( | rpmMireMode | mode, |
int | tag, | ||
const char * | pattern, | ||
const unsigned char * | table, | ||
miRE * | mirep, | ||
int * | nmirep | ||
) |
Append pattern to array.
mode | type of pattern match |
tag | identifier (like an rpmTag) |
pattern | pattern to compile |
table | (PCRE) locale table to use (NULL uses default table) |
*mirep | pattern array |
*nmirep | no. of patterns in array |
Definition at line 497 of file mire.c.
References memset(), mireGetPool(), mireRegcomp(), mireSetCOptions(), NULL, xrealloc, and xx.
Referenced by mireLoadPatterns(), rpmdbTriggerGlobs(), rpmfcExpandRegexps(), rpmPlatform(), and strsubFormat().
Apply array of patterns to a string.
mire | compiled pattern array |
nmire | no. of patterns in array |
s | string to apply against |
slen | length of string (0 will use strlen(s)) |
rc | -1 == excluding, +1 == including, 0 == single pattern |
Definition at line 551 of file mire.c.
References i, mireRegexec(), rc, and xx.
Referenced by rpmrepoGetFileList().
Deallocate pattern match memory.
mire | pattern container |
Definition at line 38 of file mire.c.
References _free(), _mire_debug, fprintf(), NULL, RPMMIRE_PCRE, and RPMMIRE_REGEX.
Referenced by handleOneTrigger(), mireFini(), mireFreeAll(), and mireRegcomp().
Definition at line 71 of file mire.c.
References mireClean(), and void.
Referenced by mireGetPool().
Destroy compiled patterns.
mire | pattern array |
nre | no of patterns in array |
Definition at line 96 of file mire.c.
References mireClean(), NULL, rpmioFreePoolItem(), and void.
Referenced by rpmdsFini(), rpmfcFreeRegexps(), rpmfiFini(), rpmFreeRpmrc(), rpmmiFini(), rpmPlatform(), rpmrepoFini(), runTriggers(), and strsubFormat().
Allocate a miRE container from the pool.
pool | mire pool |
Definition at line 81 of file mire.c.
References _mire_debug, _mirePool, memset(), mireFini(), NULL, rpmioGetPool(), and rpmioNewPool().
Referenced by mireAppend(), mireNew(), and rpmmiAddPattern().
int mireLoadPatterns | ( | rpmMireMode | mode, |
int | tag, | ||
const char ** | patterns, | ||
const unsigned char * | table, | ||
miRE * | mirep, | ||
int * | nmirep | ||
) |
Load patterns from string array.
mode | type of pattern match |
tag | identifier (like an rpmTag) |
patterns | patterns to compile |
table | (PCRE) locale table to use (NULL uses default table) |
*mirep | pattern array |
*nmirep | no. of patterns in array |
miRE mireNew | ( | rpmMireMode | mode, |
int | tag | ||
) |
Create pattern container.
mode | type of pattern match |
tag | identifier (e.g. an rpmTag) |
Definition at line 113 of file mire.c.
References mireGetPool(), mireLink(), mode, and tag.
Referenced by dbiMireKeys(), handleOneTrigger(), rpmcliInstallElementPath(), rpmEVRmire(), rpmfcApply(), rpmfcSCRIPT(), rpmmiAddPattern(), and tagValidate().
Compile pattern match.
mire | pattern container |
val | pattern to compile |
Definition at line 332 of file mire.c.
References _, _mire_debug, _mireGLOBoptions, _mireREGEXoptions, exit, fprintf(), mireClean(), msg, NULL, rc, rpmlog(), RPMLOG_ERR, RPMMIRE_DEFAULT, RPMMIRE_GLOB, RPMMIRE_PCRE, RPMMIRE_REGEX, RPMMIRE_STRCMP, void, xcalloc(), and xstrdup().
Referenced by dbiMireKeys(), handleOneTrigger(), mireAppend(), rpmcliInstallElementPath(), rpmEVRmire(), rpmfcApply(), rpmfcSCRIPT(), rpmmiAddPattern(), and tagValidate().
Execute pattern match.
mire | pattern container |
val | value to match |
vallen | length of value string (0 will use strlen) |
Definition at line 396 of file mire.c.
References _, _mire_debug, alloca(), FNM_NOMATCH, fnmatch(), fprintf(), msg, NULL, rc, rpmlog(), RPMLOG_ERR, RPMMIRE_DEFAULT, RPMMIRE_GLOB, RPMMIRE_PCRE, RPMMIRE_REGEX, RPMMIRE_STRCMP, strncpy(), t, and void.
Referenced by dbiMireKeys(), handleOneTrigger(), mireApply(), mireSkip(), rpmcliWalkFirst(), rpmEVRparse(), rpmfcApply(), rpmfcMatchRegexps(), rpmfcSCRIPT(), rpmGetMacroEntries(), rpmPlatformScore(), runTriggersLoop(), strsubFormat(), and tagValidate().
int mireSetCOptions | ( | miRE | mire, |
rpmMireMode | mode, | ||
int | tag, | ||
int | options, | ||
const unsigned char * | table | ||
) |
Initialize pattern compile options.
mire | pattern container |
mode | type of pattern match |
tag | identifier (e.g. an rpmTag) |
options | pattern options (0 uses default options) |
table | (PCRE only) locale tables |
Definition at line 121 of file mire.c.
References _mireGLOBoptions, _mirePCREoptions, _mireREGEXoptions, mode, options, rc, RPMMIRE_DEFAULT, RPMMIRE_GLOB, RPMMIRE_PCRE, RPMMIRE_REGEX, RPMMIRE_STRCMP, and tag.
Referenced by mireAppend(), rpmEVRmire(), and tagValidate().
Initialize pattern execute options (PCRE only).
mire | pattern container |
*offsets | (PCRE only) string offset(s) |
noffsets | (PCRE only) no. of string offsets |
Definition at line 156 of file mire.c.
References rc, RPMMIRE_PCRE, and RPMMIRE_REGEX.
Referenced by rpmEVRparse(), and strsubFormat().
Initialize pattern global options (PCRE only).
newline | newline ending identifier |
caseless | should case be ignored? |
multline | are multiline matches permitted? |
utf8 | assume utf8 matching? |
Definition at line 180 of file mire.c.
References _mireEL, _mireGLOBoptions, _mirePCREoptions, _mireREGEXoptions, EL_ANY, EL_ANYCRLF, EL_CR, EL_CRLF, EL_LF, FNM_CASEFOLD, NULL, rc, val, and void.
Study PCRE patterns (if any).
mire | pattern container |
nmires | no. of patterns in container |
Definition at line 574 of file mire.c.
References _, __progname, exit, j, NULL, rc, rpmlog(), RPMLOG_ERR, RPMMIRE_PCRE, s, and sprintf().
int _mire_debug = 0 |
Definition at line 18 of file mire.c.
Referenced by mireClean(), mireGetPool(), mireRegcomp(), mireRegexec(), and rpmmiAddPattern().
Definition at line 24 of file mire.c.
Referenced by mireSetGOptions().
int _mireGLOBoptions = FNM_EXTMATCH | FNM_PATHNAME | FNM_PERIOD |
GLOB default: FNM_PATHNAME | FNM_PERIOD.
Definition at line 30 of file mire.c.
Referenced by mireRegcomp(), mireSetCOptions(), and mireSetGOptions().
int _mirePCREoptions = 0 |
PCRE default: 0.
Definition at line 36 of file mire.c.
Referenced by mireSetCOptions(), and mireSetGOptions().
Definition at line 21 of file mire.c.
Referenced by mireSetLocale().
rpmioPool _mirePool |
Definition at line 79 of file mire.c.
Referenced by mireGetPool(), rpmioClean(), and rpmmiAddPattern().
int _mireREGEXoptions = REG_EXTENDED | REG_NEWLINE |
REGEX default: REG_EXTENDED.
Definition at line 33 of file mire.c.
Referenced by mireRegcomp(), mireSetCOptions(), and mireSetGOptions().