regexp_id_t id;
ref_entry_t ref;
gpointer ud;
+ guint64 cache_id;
gint flags;
gint ncaptures;
gint nbackref;
REF_INIT_RETAIN (res, rspamd_regexp_dtor);
res->flags = rspamd_flags;
res->pattern = real_pattern;
+ res->cache_id = RSPAMD_INVALID_ID;
if (rspamd_flags & RSPAMD_REGEXP_FLAG_RAW) {
res->raw_re = r;
return re->ncaptures;
}
+guint64
+rspamd_regexp_get_cache_id (rspamd_regexp_t *re)
+{
+ g_assert (re != NULL);
+
+ return re->cache_id;
+}
+
+guint64
+rspamd_regexp_set_cache_id (rspamd_regexp_t *re, guint64 id)
+{
+ guint64 old;
+
+ g_assert (re != NULL);
+ old = re->cache_id;
+ re->cache_id = id;
+
+ return old;
+}
+
gboolean
rspamd_regexp_match (rspamd_regexp_t *re, const gchar *text, gsize len,
gboolean raw)
#include "config.h"
+#define RSPAMD_INVALID_ID ((guint64)-1LL)
+
typedef struct rspamd_regexp_s rspamd_regexp_t;
struct rspamd_regexp_cache;
struct rspamd_re_capture {
*/
gint rspamd_regexp_get_ncaptures (rspamd_regexp_t *re);
+/**
+ * Returns cache id for a regexp
+ */
+guint64 rspamd_regexp_get_cache_id (rspamd_regexp_t *re);
+
+/**
+ * Sets cache id for a regexp
+ */
+guint64 rspamd_regexp_set_cache_id (rspamd_regexp_t *re, guint64 id);
+
/**
* Create new regexp cache
* @return