Details
struct GnomeRegexCache
typedef struct {
int size; /* Total number of cache slots. */
int next; /* Next available slot. */
char **regexs; /* Regular expression strings. */
regex_t *patterns; /* Compiled expressions. */
/* FIXME: probably should cache compilation flags along with
regex and use those to determine caching. For now we
assume that the flags never change. Another option would
be to put the flag info into this structure and just not
let the user ever change it. */
} GnomeRegexCache; |
gnome_regex_cache_new ()
Creates a new regular expression cache object.
gnome_regex_cache_destroy ()
Destroys a regular expression cache object.
gnome_regex_cache_set_size ()
Sets the maxiumum number of regular expressions the cache can
hold. If this is less than the number of currently cached
expressions, then the oldest expressions are deleted.
gnome_regex_cache_compile ()
regex_t* gnome_regex_cache_compile (GnomeRegexCache *rxc,
const char *pattern,
int flags); |
This compiles a regular expression. If the expression is cached,
the previously computed value is returned. Otherwise, the
expression is compiled, cached, and then returned.