diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-07-24 13:34:10 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-07-24 20:33:33 +0100 |
commit | 1a634c3d5103c9deb6f5fe1c236b5719995f8d11 (patch) | |
tree | fa2b665bc2bc8a88880d3c00c516d4645a5f5cff /src/libutil/str_util.c | |
parent | 9dbae7439d0c01c29566fc0df2cf59c5e5e1aed7 (diff) | |
download | rspamd-1a634c3d5103c9deb6f5fe1c236b5719995f8d11.tar.gz rspamd-1a634c3d5103c9deb6f5fe1c236b5719995f8d11.zip |
[Project] Detect memrchr in systems that supports it
Diffstat (limited to 'src/libutil/str_util.c')
-rw-r--r-- | src/libutil/str_util.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/libutil/str_util.c b/src/libutil/str_util.c index c503396a2..88f757659 100644 --- a/src/libutil/str_util.c +++ b/src/libutil/str_util.c @@ -2898,20 +2898,21 @@ rspamd_ucl_emit_fstring_comments (const ucl_object_t *obj, ucl_object_emit_full (obj, emit_type, &func, comments); } -const void * +#ifndef HAVE_MEMRCHR +void * rspamd_memrchr (const void *m, gint c, gsize len) { const guint8 *p = m; - gsize i; - for (i = len; i > 0; i --) { + for (gsize i = len; i > 0; i --) { if (p[i - 1] == c) { - return p + i - 1; + return (void *)(p + i - 1); } } return NULL; } +#endif struct UConverter * rspamd_get_utf8_converter (void) |