case RSPAMD_HTML_COMPONENT_CLASS:
fstr.begin = (gchar *) comp->start;
fstr.len = comp->len;
- bl->class = rspamd_mempool_ftokdup (pool, &fstr);
- msg_debug_html ("got class: %s", bl->class);
+ bl->html_class = rspamd_mempool_ftokdup (pool, &fstr);
+ msg_debug_html ("got class: %s", bl->html_class);
break;
case RSPAMD_HTML_COMPONENT_SIZE:
/* Not supported by html5 */
struct html_tag_component style;
guint font_size;
gboolean visible;
- gchar *class;
+ gchar *html_class;
};
/* Public tags flags */
typedef struct _entity entity;
struct _entity {
- gchar *name;
+ const gchar *name;
uint code;
- gchar *replacement;
+ const gchar *replacement;
};
static entity entities_defs[] = {
#define is_urlsafe(x) ((url_scanner_table[(guchar)(x)] & (IS_URLSAFE)) != 0)
const gchar *
-rspamd_url_strerror (enum uri_errno err)
+rspamd_url_strerror (int err)
{
switch (err) {
case URI_ERRNO_OK:
/*
* Return text representation of url parsing error
*/
-const gchar * rspamd_url_strerror (enum uri_errno err);
+const gchar * rspamd_url_strerror (int err);
/**
{
struct rspamd_worker_signal_handler *sigh =
(struct rspamd_worker_signal_handler *)w->data;
- struct rspamd_worker_signal_cb *cb, *cbtmp;
+ struct rspamd_worker_signal_handler_elt *cb, *cbtmp;
/* Call all signal handlers registered */
DL_FOREACH_SAFE (sigh->cb, cb, cbtmp) {
rspamd_sigh_free (void *p)
{
struct rspamd_worker_signal_handler *sigh = p;
- struct rspamd_worker_signal_cb *cb, *tmp;
+ struct rspamd_worker_signal_handler_elt *cb, *tmp;
DL_FOREACH_SAFE (sigh->cb, cb, tmp) {
DL_DELETE (sigh->cb, cb);
void
rspamd_worker_set_signal_handler (int signo, struct rspamd_worker *worker,
struct ev_loop *event_loop,
- rspamd_worker_signal_handler handler,
+ rspamd_worker_signal_cb_t handler,
void *handler_data)
{
struct rspamd_worker_signal_handler *sigh;
- struct rspamd_worker_signal_cb *cb;
+ struct rspamd_worker_signal_handler_elt *cb;
sigh = g_hash_table_lookup (worker->signal_events, GINT_TO_POINTER (signo));
void rspamd_worker_set_signal_handler (int signo,
struct rspamd_worker *worker,
struct ev_loop *event_loop,
- rspamd_worker_signal_handler handler,
+ rspamd_worker_signal_cb_t handler,
void *handler_data);
/**
}
gboolean
-rspamd_constant_memcmp (const guchar *a, const guchar *b, gsize len)
+rspamd_constant_memcmp (const void *a, const void *b, gsize len)
{
gsize lena, lenb, i;
guint16 d, r = 0, m;
guint16 v;
+ const guint8 *aa = (const guint8 *)a,
+ *bb = (const guint8 *)b;
if (len == 0) {
- lena = strlen (a);
- lenb = strlen (b);
+ lena = strlen ((const char*)a);
+ lenb = strlen ((const char*)b);
if (lena != lenb) {
return FALSE;
for (i = 0; i < len; i++) {
v = ((guint16)(guint8)r) + 255;
m = v / 256 - 1;
- d = (guint16)((int)a[i] - (int)b[i]);
+ d = (guint16)((int)aa[i] - (int)bb[i]);
r |= (d & m);
}
/**
* Constant time version of memcmp
*/
-gboolean rspamd_constant_memcmp (const guchar *a, const guchar *b, gsize len);
+gboolean rspamd_constant_memcmp (const void *a, const void *b, gsize len);
/**
* Open file without following symlinks or special stuff
*/
void rspamd_localtime (gint64 ts, struct tm *dest);
-#define PTR_ARRAY_FOREACH(ar, i, cur) for ((i) = 0; (ar) != NULL && (i) < (ar)->len && (((cur) = g_ptr_array_index((ar), (i))) || 1); ++(i))
+#define PTR_ARRAY_FOREACH(ar, i, cur) for ((i) = 0; (ar) != NULL && (i) < (ar)->len && (((cur) = (__typeof__(cur))g_ptr_array_index((ar), (i))) || 1); ++(i))
/**
* Compresses the input string using gzip+zlib. Old string is replaced and freed
};
struct rspamd_worker_signal_handler;
-typedef gboolean (*rspamd_worker_signal_handler) (
+typedef gboolean (*rspamd_worker_signal_cb_t) (
struct rspamd_worker_signal_handler *, void *ud);
-struct rspamd_worker_signal_cb {
- rspamd_worker_signal_handler handler;
+struct rspamd_worker_signal_handler_elt {
+ rspamd_worker_signal_cb_t handler;
void *handler_data;
- struct rspamd_worker_signal_cb *next, *prev;
+ struct rspamd_worker_signal_handler_elt *next, *prev;
};
struct rspamd_worker_signal_handler {
ev_signal ev_sig;
struct ev_loop *event_loop;
struct rspamd_worker *worker;
- struct rspamd_worker_signal_cb *cb;
+ struct rspamd_worker_signal_handler_elt *cb;
};
struct rspamd_controller_pbkdf {
const gchar *name;
gpointer (*worker_init_func)(struct rspamd_config *cfg);
void (*worker_start_func)(struct rspamd_worker *worker);
- enum rspamd_worker_flags flags;
- enum rspamd_worker_socket_type listen_type;
+ int flags;
+ int listen_type;
guint worker_version;
guint64 rspamd_version;
const gchar *rspamd_features;