Browse Source

Add method to set re class for any rspamd regexp

tags/1.1.0
Vsevolod Stakhov 8 years ago
parent
commit
958cbf047b
2 changed files with 33 additions and 0 deletions
  1. 22
    0
      src/libutil/regexp.c
  2. 11
    0
      src/libutil/regexp.h

+ 22
- 0
src/libutil/regexp.c View File

regexp_id_t id; regexp_id_t id;
ref_entry_t ref; ref_entry_t ref;
gpointer ud; gpointer ud;
gpointer re_class;
guint64 cache_id; guint64 cache_id;
gint flags; gint flags;
gint ncaptures; gint ncaptures;


return re->id; return re->id;
} }

gpointer
rspamd_regexp_get_class (rspamd_regexp_t *re)
{
g_assert (re != NULL);

return re->re_class;
}

gpointer
rspamd_regexp_set_class (rspamd_regexp_t *re, gpointer re_class)
{
gpointer old_class;

g_assert (re != NULL);

old_class = re->re_class;
re->re_class = re_class;

return old_class;
}

+ 11
- 0
src/libutil/regexp.h View File

*/ */
guint64 rspamd_regexp_set_cache_id (rspamd_regexp_t *re, guint64 id); guint64 rspamd_regexp_set_cache_id (rspamd_regexp_t *re, guint64 id);


/**
* Get regexp class for the re object
*/
gpointer rspamd_regexp_get_class (rspamd_regexp_t *re);

/**
* Set regexp class for the re object
* @return old re class value
*/
gpointer rspamd_regexp_set_class (rspamd_regexp_t *re, gpointer re_class);

/** /**
* Create new regexp cache * Create new regexp cache
* @return * @return

Loading…
Cancel
Save