]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Init utf8 library
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 15 Nov 2019 17:27:34 +0000 (17:27 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 15 Nov 2019 17:27:34 +0000 (17:27 +0000)
src/libutil/util.c

index 26410137675d0e97ec5d2d7131a0f1564a5904b7..9c788587a12fdb82b959267f5c89f688e28093df 100644 (file)
@@ -86,6 +86,7 @@
 #include "cryptobox.h"
 #include "zlib.h"
 #include "contrib/uthash/utlist.h"
+#include "contrib/fastutf8/fastutf8.h"
 
 /* Check log messages intensity once per minute */
 #define CHECK_TIME 60
@@ -2334,6 +2335,18 @@ rspamd_init_libs (void)
 #endif
        }
 
+       /* Configure utf8 library */
+       guint utf8_flags = 0;
+
+       if ((ctx->crypto_ctx->cpu_config & CPUID_SSE41)) {
+               utf8_flags |= RSPAMD_FAST_UTF8_FLAG_SSE41;
+       }
+       if ((ctx->crypto_ctx->cpu_config & CPUID_AVX2)) {
+               utf8_flags |= RSPAMD_FAST_UTF8_FLAG_AVX2;
+       }
+
+       rspamd_fast_utf8_library_init (utf8_flags);
+
        g_assert (ottery_init (ottery_cfg) == 0);
 
 #ifdef HAVE_LOCALE_H