From: Vsevolod Stakhov Date: Tue, 2 Jun 2015 10:54:32 +0000 (+0100) Subject: Move bits compatibility function. X-Git-Tag: 1.0.0~578^2~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a891c5b85e3ada0f6180c4ec3cc53013d5a4994d;p=thirdparty%2Frspamd.git Move bits compatibility function. --- diff --git a/config.h.in b/config.h.in index 1ebac8fa00..ca03751cf2 100644 --- a/config.h.in +++ b/config.h.in @@ -488,6 +488,26 @@ typedef off_t goffset; #endif #endif +#ifndef PARAM_H_HAS_BITSET +/* Bit map related macros. */ +#define NBBY 8 /* number of bits in a byte */ +#define setbit(a, \ + i) (((unsigned char *)(a))[(i) / NBBY] |= 1 << ((i) % NBBY)) +#define clrbit(a, \ + i) (((unsigned char *)(a))[(i) / NBBY] &= ~(1 << ((i) % NBBY))) +#define isset(a,i) \ + (((const unsigned char *)(a))[(i) / NBBY] & (1 << ((i) % NBBY))) +#define isclr(a,i) \ + ((((const unsigned char *)(a))[(i) / NBBY] & (1 << ((i) % NBBY))) == 0) +#endif + +#ifndef BITSPERBYTE +# define BITSPERBYTE (NBBY * sizeof (char)) +#endif +#ifndef NBYTES +# define NBYTES(nbits) (((nbits) + BITSPERBYTE - 1) / BITSPERBYTE) +#endif + /* Forwarded declaration */ struct module_ctx; struct rspamd_config; diff --git a/src/libmime/filter.c b/src/libmime/filter.c index 1469cdfd7d..ddab0e81b6 100644 --- a/src/libmime/filter.c +++ b/src/libmime/filter.c @@ -40,21 +40,6 @@ #define COMMON_PART_FACTOR 95 -#ifndef PARAM_H_HAS_BITSET -/* Bit map related macros. */ -#define NBBY 8 /* number of bits in a byte */ -#define setbit(a, \ - i) (((unsigned char *)(a))[(i) / NBBY] |= 1 << ((i) % NBBY)) -#define clrbit(a, \ - i) (((unsigned char *)(a))[(i) / NBBY] &= ~(1 << ((i) % NBBY))) -#define isset(a,i) \ - (((const unsigned char *)(a))[(i) / NBBY] & (1 << ((i) % NBBY))) -#define isclr(a,i) \ - ((((const unsigned char *)(a))[(i) / NBBY] & (1 << ((i) % NBBY))) == 0) -#endif -#define BITSPERBYTE (8 * sizeof (gchar)) -#define NBYTES(nbits) (((nbits) + BITSPERBYTE - 1) / BITSPERBYTE) - static rspamd_expression_atom_t * rspamd_composite_expr_parse (const gchar *line, gsize len, rspamd_mempool_t *pool, gpointer ud, GError **err); static gint rspamd_composite_expr_process (gpointer input, rspamd_expression_atom_t *atom);