]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Make rspamd_memcspn public
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 15 Dec 2016 11:58:42 +0000 (11:58 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 15 Dec 2016 14:46:01 +0000 (14:46 +0000)
src/libutil/str_util.c
src/libutil/str_util.h

index 63e22e6410c7c59474f9337f1c9696f4a9820f2c..c5df324b754c2d0aa9cb3b4f11c4d4359cf90ee7 100644 (file)
@@ -1828,13 +1828,13 @@ decode:
 
 #define BITOP(a,b,op) \
                ((a)[(gsize)(b)/(8*sizeof *(a))] op (gsize)1<<((gsize)(b)%(8*sizeof *(a))))
-static gsize
+gsize
 rspamd_memcspn (const gchar *s, const gchar *e, gsize len)
 {
-       gsize byteset[32/sizeof(gsize)];
+       gsize byteset[32 / sizeof(gsize)];
        const gchar *p = s, *end = s + len;
 
-       memset(byteset, 0, sizeof byteset);
+       memset (byteset, 0, sizeof byteset);
 
        for (; *e && BITOP (byteset, *(guchar *)e, |=); e++);
        for (; p < end && !BITOP (byteset, *(guchar *)p, &); p++);
index 1fdb1a85786536d9bcfbd9518d3af9c36d30503d..2c9905e139ffa2152e5ebc1aef7cc37eb68e764c 100644 (file)
@@ -350,4 +350,13 @@ extern const guchar lc_map[256];
  */
 const void *rspamd_memrchr (const void *m, gint c, gsize len);
 
+/**
+ * Return length of memory segment starting in `s` that contains no chars from `e`
+ * @param s any input
+ * @param e zero terminated string of exceptions
+ * @param len length of `s`
+ * @return segment size
+ */
+gsize rspamd_memcspn (const gchar *s, const gchar *e, gsize len);
+
 #endif /* SRC_LIBUTIL_STR_UTIL_H_ */