73 struct Regex *rx = *ptr;
87 struct Regex **r = var;
143 const char *value,
struct Buffer *err)
146 if (value && (value[0] ==
'\0'))
149 struct Regex *r = NULL;
155 struct Regex *curval = *(
struct Regex **) var;
171 rc = cdef->
validator(cs, cdef, (intptr_t) r, err);
182 *(
struct Regex **) var = r;
205 const char *str = NULL;
241 rc = cdef->
validator(cs, cdef, value, err);
249 struct Regex *r = NULL;
266 *(
struct Regex **) var = r;
289 struct Regex *r = NULL;
290 const char *initial = (
const char *) cdef->
initial;
293 const char *curval = currx ? currx->
pattern : NULL;
314 rc = cdef->
validator(cs, cdef, (intptr_t) r, err);
328 *(
struct Regex **) var = r;
size_t buf_addstr(struct Buffer *buf, const char *s)
Add a string to a Buffer.
struct Regex * regex_new(const char *str, uint32_t flags, struct Buffer *err)
Create an Regex from a string.
bool regex_equal(const struct Regex *a, const struct Regex *b)
Compare two regexes.
const struct ConfigSetType CstRegex
Config type representing a regular expression.
void regex_free(struct Regex **ptr)
Free a Regex object.
static bool startup_only(const struct ConfigDef *cdef, struct Buffer *err)
Validator function for D_ON_STARTUP.
#define CSR_ERR_INVALID
Value hasn't been set.
#define CSR_INV_VALIDATOR
Value was rejected by the validator.
#define CSR_SUC_NO_CHANGE
The value hasn't changed.
#define CSR_ERR_CODE
Problem with the code.
#define CSR_SUC_EMPTY
Value is empty/unset.
#define CSR_SUCCESS
Action completed successfully.
static void regex_destroy(const struct ConfigSet *cs, void *var, const struct ConfigDef *cdef)
Destroy a Regex object - Implements ConfigSetType::destroy() -.
static intptr_t regex_native_get(const struct ConfigSet *cs, void *var, const struct ConfigDef *cdef, struct Buffer *err)
Get a Regex object from a Regex config item - Implements ConfigSetType::native_get() -.
static int regex_native_set(const struct ConfigSet *cs, void *var, const struct ConfigDef *cdef, intptr_t value, struct Buffer *err)
Set a Regex config item by Regex object - Implements ConfigSetType::native_set() -.
static int regex_reset(const struct ConfigSet *cs, void *var, const struct ConfigDef *cdef, struct Buffer *err)
Reset a Regex to its initial value - Implements ConfigSetType::reset() -.
static int regex_string_get(const struct ConfigSet *cs, void *var, const struct ConfigDef *cdef, struct Buffer *result)
Get a Regex as a string - Implements ConfigSetType::string_get() -.
static int regex_string_set(const struct ConfigSet *cs, void *var, struct ConfigDef *cdef, const char *value, struct Buffer *err)
Set a Regex by string - Implements ConfigSetType::string_set() -.
bool mutt_mb_is_lower(const char *s)
Does a multi-byte string contain only lowercase characters?
void * mutt_mem_calloc(size_t nmemb, size_t size)
Allocate zeroed memory on the heap.
Convenience wrapper for the library headers.
char * mutt_str_dup(const char *str)
Copy a string, safely.
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
Type representing a regular expression.
#define REG_COMP(preg, regex, cflags)
Compile a regular expression.
String manipulation buffer.
size_t dsize
Length of data.
char * data
Pointer to data.
int(* validator)(const struct ConfigSet *cs, const struct ConfigDef *cdef, intptr_t value, struct Buffer *err)
intptr_t initial
Initial value.
uint32_t type
Variable type, e.g. DT_STRING.
Container for lots of config items.
Cached regular expression.
char * pattern
printable version
regex_t * regex
compiled expression
Constants for all the config types.
#define D_REGEX_ALLOW_NOT
Regex can begin with '!'.
#define D_REGEX_MATCH_CASE
Case-sensitive matching.
#define D_INTERNAL_INITIAL_SET
Config item must have its initial value freed.
@ DT_REGEX
regular expressions
#define D_REGEX_NOSUB
Do not report what was matched (REG_NOSUB)