diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-06-21 14:20:13 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-06-21 14:20:13 +0100 |
commit | 424bf837f936bb2d02c06c839d08139a871f36d6 (patch) | |
tree | dd7ed137d5455a917f2c10f153ba11abd640355e /src/libutil/str_util.h | |
parent | cf88a6243a093b71340c17920b0ce8d225cd9466 (diff) | |
download | rspamd-424bf837f936bb2d02c06c839d08139a871f36d6.tar.gz rspamd-424bf837f936bb2d02c06c839d08139a871f36d6.zip |
[Minor] Add rspamd_memspn function
Diffstat (limited to 'src/libutil/str_util.h')
-rw-r--r-- | src/libutil/str_util.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/libutil/str_util.h b/src/libutil/str_util.h index 45507e2be..9fa914292 100644 --- a/src/libutil/str_util.h +++ b/src/libutil/str_util.h @@ -334,6 +334,14 @@ const void *rspamd_memrchr (const void *m, gint c, gsize len); */ gsize rspamd_memcspn (const gchar *s, const gchar *e, gsize len); +/** + * Return length of memory segment starting in `s` that contains only chars from `e` + * @param s any input + * @param e zero terminated string of inclusions + * @param len length of `s` + * @return segment size + */ +gsize rspamd_memspn (const gchar *s, const gchar *e, gsize len); /* https://graphics.stanford.edu/~seander/bithacks.html#HasMoreInWord */ #define rspamd_str_hasmore(x,n) ((((x)+~0UL/255*(127-(n)))|(x))&~0UL/255*128) |