aboutsummaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
Diffstat (limited to 'contrib')
-rw-r--r--contrib/libev/ev.c19
-rw-r--r--contrib/librdns/dns_private.h2
-rw-r--r--contrib/libucl/lua_ucl.c12
-rw-r--r--contrib/libucl/ucl.h20
-rw-r--r--contrib/libucl/ucl_parser.c10
-rw-r--r--contrib/libucl/ucl_util.c32
-rw-r--r--contrib/snowball/compiler/generator.c18
-rw-r--r--contrib/snowball/compiler/space.c335
-rw-r--r--contrib/xxhash/CMakeLists.txt4
9 files changed, 300 insertions, 152 deletions
diff --git a/contrib/libev/ev.c b/contrib/libev/ev.c
index 230445d2a..0dec50bcd 100644
--- a/contrib/libev/ev.c
+++ b/contrib/libev/ev.c
@@ -1,4 +1,20 @@
/*
+ * Copyright 2025 Vsevolod Stakhov
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
* libev event processing core, watcher management
*
* Copyright (c) 2007-2019 Marc Alexander Lehmann <libev@schmorp.de>
@@ -2148,7 +2164,10 @@ typedef struct
#include "ev_wrap.h"
static struct ev_loop default_loop_struct;
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wextern-initializer"
EV_API_DECL struct ev_loop *ev_default_loop_ptr = 0; /* needs to be initialised to make it a definition despite extern */
+#pragma clang diagnostic pop
#else
diff --git a/contrib/librdns/dns_private.h b/contrib/librdns/dns_private.h
index c240debea..4cf6468b1 100644
--- a/contrib/librdns/dns_private.h
+++ b/contrib/librdns/dns_private.h
@@ -41,7 +41,7 @@ static const int default_tcp_io_cnt = 1;
#define DNS_COMPRESSION_BITS 0xC0
#define DNS_D_MAXLABEL 63 /* + 1 '\0' */
-#define DNS_D_MAXNAME 255 /* + 1 '\0' */
+#define DNS_D_MAXNAME 253 /* + 1 '\0' */
#define RESOLV_CONF "/etc/resolv.conf"
diff --git a/contrib/libucl/lua_ucl.c b/contrib/libucl/lua_ucl.c
index 473aefe0c..13306b942 100644
--- a/contrib/libucl/lua_ucl.c
+++ b/contrib/libucl/lua_ucl.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2024 Vsevolod Stakhov
+ * Copyright 2025 Vsevolod Stakhov
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -694,7 +694,13 @@ static int
lua_ucl_parser_init(lua_State *L)
{
struct ucl_parser *parser, **pparser;
- int flags = UCL_PARSER_NO_FILEVARS;
+ /*
+ * We disable file variables and macros by default, as
+ * the most use cases are parsing of JSON and not of the real
+ * files. Macros in the parser are very dangerous and should be used
+ * for trusted data only.
+ */
+ int flags = UCL_PARSER_SAFE_FLAGS;
if (lua_gettop(L) >= 1) {
flags = lua_tonumber(L, 1);
@@ -1091,7 +1097,7 @@ lua_ucl_parser_validate(lua_State *L)
}
}
else if (lua_type(L, 2) == LUA_TSTRING) {
- schema_parser = ucl_parser_new(0);
+ schema_parser = ucl_parser_new(UCL_PARSER_SAFE_FLAGS);
schema_file = luaL_checkstring(L, 2);
if (!ucl_parser_add_file(schema_parser, schema_file)) {
diff --git a/contrib/libucl/ucl.h b/contrib/libucl/ucl.h
index b6b9f44c0..8c2ac59a4 100644
--- a/contrib/libucl/ucl.h
+++ b/contrib/libucl/ucl.h
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2025 Vsevolod Stakhov
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
/* Copyright (c) 2013-2015, Vsevolod Stakhov
* All rights reserved.
*
@@ -159,6 +175,10 @@ typedef enum ucl_parser_flags {
UCL_PARSER_NO_FILEVARS = (1 << 6) /** Do not set file vars */
} ucl_parser_flags_t;
+#define UCL_PARSER_SAFE_FLAGS (UCL_PARSER_NO_TIME | \
+ UCL_PARSER_NO_IMPLICIT_ARRAYS | \
+ UCL_PARSER_DISABLE_MACRO | \
+ UCL_PARSER_NO_FILEVARS)
/**
* String conversion flags, that are used in #ucl_object_fromstring_common function.
*/
diff --git a/contrib/libucl/ucl_parser.c b/contrib/libucl/ucl_parser.c
index 6be16d121..e56a010ff 100644
--- a/contrib/libucl/ucl_parser.c
+++ b/contrib/libucl/ucl_parser.c
@@ -1246,10 +1246,12 @@ ucl_parser_process_object_element (struct ucl_parser *parser, ucl_object_t *nobj
container = parser->stack->obj->value.ov;
DL_FOREACH (parser->stack->obj, cur) {
- tobj = __DECONST (ucl_object_t *, ucl_hash_search_obj (cur->value.ov, nobj));
+ if (cur->type == UCL_OBJECT) {
+ tobj = __DECONST (ucl_object_t *, ucl_hash_search_obj (cur->value.ov, nobj));
- if (tobj != NULL) {
- break;
+ if (tobj != NULL) {
+ break;
+ }
}
}
@@ -3165,7 +3167,7 @@ ucl_parser_add_string (struct ucl_parser *parser, const char *data,
bool
ucl_set_include_path (struct ucl_parser *parser, ucl_object_t *paths)
{
- if (parser == NULL || paths == NULL) {
+ if (parser == NULL || paths == NULL || paths->type != UCL_ARRAY) {
return false;
}
diff --git a/contrib/libucl/ucl_util.c b/contrib/libucl/ucl_util.c
index b00f2779e..d5b84f6a5 100644
--- a/contrib/libucl/ucl_util.c
+++ b/contrib/libucl/ucl_util.c
@@ -3148,6 +3148,10 @@ ucl_object_frombool (bool bv)
bool
ucl_array_append (ucl_object_t *top, ucl_object_t *elt)
{
+ if (top->type != UCL_ARRAY) {
+ return false;
+ }
+
UCL_ARRAY_GET (vec, top);
if (elt == NULL || top == NULL) {
@@ -3177,6 +3181,10 @@ e0:
bool
ucl_array_prepend (ucl_object_t *top, ucl_object_t *elt)
{
+ if (top->type != UCL_ARRAY) {
+ return false;
+ }
+
UCL_ARRAY_GET (vec, top);
if (elt == NULL || top == NULL) {
@@ -3242,6 +3250,10 @@ e0:
ucl_object_t *
ucl_array_delete (ucl_object_t *top, ucl_object_t *elt)
{
+ if (top->type != UCL_ARRAY) {
+ return NULL;
+ }
+
UCL_ARRAY_GET (vec, top);
ucl_object_t *ret = NULL;
unsigned i;
@@ -3290,6 +3302,10 @@ ucl_array_tail (const ucl_object_t *top)
ucl_object_t *
ucl_array_pop_last (ucl_object_t *top)
{
+ if (top->type != UCL_ARRAY) {
+ return NULL;
+ }
+
UCL_ARRAY_GET (vec, top);
ucl_object_t **obj, *ret = NULL;
@@ -3306,6 +3322,10 @@ ucl_array_pop_last (ucl_object_t *top)
ucl_object_t *
ucl_array_pop_first (ucl_object_t *top)
{
+ if (top->type != UCL_ARRAY) {
+ return NULL;
+ }
+
UCL_ARRAY_GET (vec, top);
ucl_object_t **obj, *ret = NULL;
@@ -3338,6 +3358,10 @@ ucl_array_size (const ucl_object_t *top)
const ucl_object_t *
ucl_array_find_index (const ucl_object_t *top, unsigned int index)
{
+ if (top->type != UCL_ARRAY) {
+ return NULL;
+ }
+
UCL_ARRAY_GET (vec, top);
if (vec != NULL && vec->n > 0 && index < vec->n) {
@@ -3350,6 +3374,10 @@ ucl_array_find_index (const ucl_object_t *top, unsigned int index)
unsigned int
ucl_array_index_of (ucl_object_t *top, ucl_object_t *elt)
{
+ if (top->type != UCL_ARRAY) {
+ return (unsigned int)(-1);
+ }
+
UCL_ARRAY_GET (vec, top);
unsigned i;
@@ -3370,6 +3398,10 @@ ucl_object_t *
ucl_array_replace_index (ucl_object_t *top, ucl_object_t *elt,
unsigned int index)
{
+ if (top->type != UCL_ARRAY) {
+ return NULL;
+ }
+
UCL_ARRAY_GET (vec, top);
ucl_object_t *ret = NULL;
diff --git a/contrib/snowball/compiler/generator.c b/contrib/snowball/compiler/generator.c
index eed86c117..44fbdcea4 100644
--- a/contrib/snowball/compiler/generator.c
+++ b/contrib/snowball/compiler/generator.c
@@ -1,4 +1,20 @@
+/*
+ * Copyright 2025 Vsevolod Stakhov
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#include <limits.h> /* for INT_MAX */
#include <stdio.h> /* for fprintf etc */
#include <stdlib.h> /* for free etc */
@@ -1241,7 +1257,7 @@ static void generate_substring(struct generator * g, struct node * p) {
g->I[3] = bitmap;
g->I[4] = shortest_size - 1;
if (p->mode == m_forward) {
- sprintf(buf, "z->p[z->c + %d]", shortest_size - 1);
+ snprintf(buf, sizeof(buf), "z->p[z->c + %d]", shortest_size - 1);
g->S[1] = buf;
if (shortest_size == 1) {
writef(g, "~Mif (z->c >= z->l", p);
diff --git a/contrib/snowball/compiler/space.c b/contrib/snowball/compiler/space.c
index 5b058763a..46c32e079 100644
--- a/contrib/snowball/compiler/space.c
+++ b/contrib/snowball/compiler/space.c
@@ -1,11 +1,27 @@
-#include <stdio.h> /* for printf */
-#include <stdlib.h> /* malloc, free */
-#include <string.h> /* memmove */
+/*
+ * Copyright 2025 Vsevolod Stakhov
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h> /* for printf */
+#include <stdlib.h> /* malloc, free */
+#include <string.h> /* memmove */
#include "header.h"
-#define HEAD 2*sizeof(int)
+#define HEAD 2 * sizeof(int)
#define EXTENDER 40
@@ -50,108 +66,125 @@
overwriting.
*/
-extern symbol * create_b(int n) {
- symbol * p = (symbol *) (HEAD + (char *) MALLOC(HEAD + (n + 1) * sizeof(symbol)));
- CAPACITY(p) = n;
- SIZE(p) = 0;
- return p;
+extern symbol *create_b(int n)
+{
+ symbol *p = (symbol *) (HEAD + (char *) MALLOC(HEAD + (n + 1) * sizeof(symbol)));
+ CAPACITY(p) = n;
+ SIZE(p) = 0;
+ return p;
}
-extern void report_b(FILE * out, const symbol * p) {
- int i;
- for (i = 0; i < SIZE(p); i++) {
- if (p[i] > 255) {
- printf("In report_b, can't convert p[%d] to char because it's 0x%02x\n", i, (int)p[i]);
- exit(1);
- }
- putc(p[i], out);
- }
+extern void report_b(FILE *out, const symbol *p)
+{
+ int i;
+ for (i = 0; i < SIZE(p); i++) {
+ if (p[i] > 255) {
+ printf("In report_b, can't convert p[%d] to char because it's 0x%02x\n", i, (int) p[i]);
+ exit(1);
+ }
+ putc(p[i], out);
+ }
}
-extern void output_str(FILE * outfile, struct str * str) {
- report_b(outfile, str_data(str));
+extern void output_str(FILE *outfile, struct str *str)
+{
+ report_b(outfile, str_data(str));
}
-extern void lose_b(symbol * p) {
- if (p == 0) return;
- FREE((char *) p - HEAD);
+extern void lose_b(symbol *p)
+{
+ if (p == 0) return;
+ FREE((char *) p - HEAD);
}
-extern symbol * increase_capacity(symbol * p, int n) {
- symbol * q = create_b(CAPACITY(p) + n + EXTENDER);
- memmove(q, p, CAPACITY(p) * sizeof(symbol));
- SIZE(q) = SIZE(p);
- lose_b(p); return q;
+extern symbol *increase_capacity(symbol *p, int n)
+{
+ symbol *q = create_b(CAPACITY(p) + n + EXTENDER);
+ memmove(q, p, CAPACITY(p) * sizeof(symbol));
+ SIZE(q) = SIZE(p);
+ lose_b(p);
+ return q;
}
-extern symbol * move_to_b(symbol * p, int n, const symbol * q) {
- int x = n - CAPACITY(p);
- if (x > 0) p = increase_capacity(p, x);
- memmove(p, q, n * sizeof(symbol)); SIZE(p) = n; return p;
+extern symbol *move_to_b(symbol *p, int n, const symbol *q)
+{
+ int x = n - CAPACITY(p);
+ if (x > 0) p = increase_capacity(p, x);
+ memmove(p, q, n * sizeof(symbol));
+ SIZE(p) = n;
+ return p;
}
-extern symbol * add_to_b(symbol * p, int n, const symbol * q) {
- int x = SIZE(p) + n - CAPACITY(p);
- if (x > 0) p = increase_capacity(p, x);
- memmove(p + SIZE(p), q, n * sizeof(symbol)); SIZE(p) += n; return p;
+extern symbol *add_to_b(symbol *p, int n, const symbol *q)
+{
+ int x = SIZE(p) + n - CAPACITY(p);
+ if (x > 0) p = increase_capacity(p, x);
+ memmove(p + SIZE(p), q, n * sizeof(symbol));
+ SIZE(p) += n;
+ return p;
}
-extern symbol * copy_b(const symbol * p) {
- int n = SIZE(p);
- symbol * q = create_b(n);
- move_to_b(q, n, p);
- return q;
+extern symbol *copy_b(const symbol *p)
+{
+ int n = SIZE(p);
+ symbol *q = create_b(n);
+ move_to_b(q, n, p);
+ return q;
}
int space_count = 0;
-extern void * check_malloc(int n) {
- space_count++;
- return malloc(n);
+extern void *check_malloc(int n)
+{
+ space_count++;
+ return malloc(n);
}
-extern void check_free(void * p) {
- space_count--;
- free(p);
+extern void check_free(void *p)
+{
+ space_count--;
+ free(p);
}
/* To convert a block to a zero terminated string: */
-extern char * b_to_s(const symbol * p) {
- int n = SIZE(p);
- char * s = (char *)malloc(n + 1);
- {
- int i;
- for (i = 0; i < n; i++) {
- if (p[i] > 255) {
- printf("In b_to_s, can't convert p[%d] to char because it's 0x%02x\n", i, (int)p[i]);
- exit(1);
- }
- s[i] = (char)p[i];
- }
- }
- s[n] = 0;
- return s;
+extern char *b_to_s(const symbol *p)
+{
+ int n = SIZE(p);
+ char *s = (char *) malloc(n + 1);
+ {
+ int i;
+ for (i = 0; i < n; i++) {
+ if (p[i] > 255) {
+ printf("In b_to_s, can't convert p[%d] to char because it's 0x%02x\n", i, (int) p[i]);
+ exit(1);
+ }
+ s[i] = (char) p[i];
+ }
+ }
+ s[n] = 0;
+ return s;
}
/* To add a zero terminated string to a block. If p = 0 the
block is created. */
-extern symbol * add_s_to_b(symbol * p, const char * s) {
- int n = strlen(s);
- int k;
- if (p == 0) p = create_b(n);
- k = SIZE(p);
- {
- int x = k + n - CAPACITY(p);
- if (x > 0) p = increase_capacity(p, x);
- }
- {
- int i;
- for (i = 0; i < n; i++) p[i + k] = s[i];
- }
- SIZE(p) += n;
- return p;
+extern symbol *add_s_to_b(symbol *p, const char *s)
+{
+ int n = strlen(s);
+ int k;
+ if (p == 0) p = create_b(n);
+ k = SIZE(p);
+ {
+ int x = k + n - CAPACITY(p);
+ if (x > 0) p = increase_capacity(p, x);
+ }
+ {
+ int i;
+ for (i = 0; i < n; i++) p[i + k] = s[i];
+ }
+ SIZE(p) += n;
+ return p;
}
/* The next section defines string handling capabilities in terms
@@ -159,129 +192,151 @@ extern symbol * add_s_to_b(symbol * p, const char * s) {
/* -------------------------------------------------------------*/
struct str {
- symbol * data;
+ symbol *data;
};
/* Create a new string. */
-extern struct str * str_new(void) {
+extern struct str *str_new(void)
+{
- struct str * output = (struct str *) malloc(sizeof(struct str));
- output->data = create_b(0);
- return output;
+ struct str *output = (struct str *) malloc(sizeof(struct str));
+ output->data = create_b(0);
+ return output;
}
/* Delete a string. */
-extern void str_delete(struct str * str) {
+extern void str_delete(struct str *str)
+{
- lose_b(str->data);
- free(str);
+ lose_b(str->data);
+ free(str);
}
/* Append a str to this str. */
-extern void str_append(struct str * str, const struct str * add) {
+extern void str_append(struct str *str, const struct str *add)
+{
- symbol * q = add->data;
- str->data = add_to_b(str->data, SIZE(q), q);
+ symbol *q = add->data;
+ str->data = add_to_b(str->data, SIZE(q), q);
}
/* Append a character to this str. */
-extern void str_append_ch(struct str * str, char add) {
+extern void str_append_ch(struct str *str, char add)
+{
- symbol q[1];
- q[0] = add;
- str->data = add_to_b(str->data, 1, q);
+ symbol q[1];
+ q[0] = add;
+ str->data = add_to_b(str->data, 1, q);
}
/* Append a low level block to a str. */
-extern void str_append_b(struct str * str, const symbol * q) {
+extern void str_append_b(struct str *str, const symbol *q)
+{
- str->data = add_to_b(str->data, SIZE(q), q);
+ str->data = add_to_b(str->data, SIZE(q), q);
}
/* Append the tail of a low level block to a str. */
-extern void str_append_b_tail(struct str * str, const symbol * q, int skip) {
- if (skip < 0 || skip >= SIZE(q)) return;
+extern void str_append_b_tail(struct str *str, const symbol *q, int skip)
+{
+ if (skip < 0 || skip >= SIZE(q)) return;
- str->data = add_to_b(str->data, SIZE(q) - skip, q + skip);
+ str->data = add_to_b(str->data, SIZE(q) - skip, q + skip);
}
/* Append a (char *, null terminated) string to a str. */
-extern void str_append_string(struct str * str, const char * s) {
+extern void str_append_string(struct str *str, const char *s)
+{
- str->data = add_s_to_b(str->data, s);
+ str->data = add_s_to_b(str->data, s);
}
/* Append an integer to a str. */
-extern void str_append_int(struct str * str, int i) {
+extern void str_append_int(struct str *str, int i)
+{
- char s[30];
- sprintf(s, "%d", i);
- str_append_string(str, s);
+ char s[30];
+ snprintf(s, sizeof(s), "%d", i);
+ str_append_string(str, s);
}
/* Clear a string */
-extern void str_clear(struct str * str) {
+extern void str_clear(struct str *str)
+{
- SIZE(str->data) = 0;
+ SIZE(str->data) = 0;
}
/* Set a string */
-extern void str_assign(struct str * str, const char * s) {
+extern void str_assign(struct str *str, const char *s)
+{
- str_clear(str);
- str_append_string(str, s);
+ str_clear(str);
+ str_append_string(str, s);
}
/* Copy a string. */
-extern struct str * str_copy(const struct str * old) {
+extern struct str *str_copy(const struct str *old)
+{
- struct str * newstr = str_new();
- str_append(newstr, old);
- return newstr;
+ struct str *newstr = str_new();
+ str_append(newstr, old);
+ return newstr;
}
/* Get the data stored in this str. */
-extern symbol * str_data(const struct str * str) {
+extern symbol *str_data(const struct str *str)
+{
- return str->data;
+ return str->data;
}
/* Get the length of the str. */
-extern int str_len(const struct str * str) {
+extern int str_len(const struct str *str)
+{
- return SIZE(str->data);
+ return SIZE(str->data);
}
/* Get the last character of the str.
*
* Or -1 if the string is empty.
*/
-extern int str_back(const struct str *str) {
- return SIZE(str->data) ? str->data[SIZE(str->data) - 1] : -1;
+extern int str_back(const struct str *str)
+{
+ return SIZE(str->data) ? str->data[SIZE(str->data) - 1] : -1;
}
-extern int get_utf8(const symbol * p, int * slot) {
- int b0, b1;
- b0 = *p++;
- if (b0 < 0xC0) { /* 1100 0000 */
- * slot = b0; return 1;
- }
- b1 = *p++;
- if (b0 < 0xE0) { /* 1110 0000 */
- * slot = (b0 & 0x1F) << 6 | (b1 & 0x3F); return 2;
- }
- * slot = (b0 & 0xF) << 12 | (b1 & 0x3F) << 6 | (*p & 0x3F); return 3;
+extern int get_utf8(const symbol *p, int *slot)
+{
+ int b0, b1;
+ b0 = *p++;
+ if (b0 < 0xC0) { /* 1100 0000 */
+ *slot = b0;
+ return 1;
+ }
+ b1 = *p++;
+ if (b0 < 0xE0) { /* 1110 0000 */
+ *slot = (b0 & 0x1F) << 6 | (b1 & 0x3F);
+ return 2;
+ }
+ *slot = (b0 & 0xF) << 12 | (b1 & 0x3F) << 6 | (*p & 0x3F);
+ return 3;
}
-extern int put_utf8(int ch, symbol * p) {
- if (ch < 0x80) {
- p[0] = ch; return 1;
- }
- if (ch < 0x800) {
- p[0] = (ch >> 6) | 0xC0;
- p[1] = (ch & 0x3F) | 0x80; return 2;
- }
- p[0] = (ch >> 12) | 0xE0;
- p[1] = ((ch >> 6) & 0x3F) | 0x80;
- p[2] = (ch & 0x3F) | 0x80; return 3;
+extern int put_utf8(int ch, symbol *p)
+{
+ if (ch < 0x80) {
+ p[0] = ch;
+ return 1;
+ }
+ if (ch < 0x800) {
+ p[0] = (ch >> 6) | 0xC0;
+ p[1] = (ch & 0x3F) | 0x80;
+ return 2;
+ }
+ p[0] = (ch >> 12) | 0xE0;
+ p[1] = ((ch >> 6) & 0x3F) | 0x80;
+ p[2] = (ch & 0x3F) | 0x80;
+ return 3;
}
diff --git a/contrib/xxhash/CMakeLists.txt b/contrib/xxhash/CMakeLists.txt
index 5091d261d..41985724f 100644
--- a/contrib/xxhash/CMakeLists.txt
+++ b/contrib/xxhash/CMakeLists.txt
@@ -6,8 +6,6 @@ IF (ENABLE_FULL_DEBUG MATCHES "OFF")
if ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
SET_TARGET_PROPERTIES(rspamd-xxhash PROPERTIES COMPILE_FLAGS "-O3")
endif ()
-else ()
- ADD_DEFINITIONS(-DXXH_NO_INLINE_HINTS=1)
ENDIF ()
-
+ADD_DEFINITIONS(-DXXH_NO_INLINE_HINTS=1)
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DXXH_NO_INLINE_HINTS=1" PARENT_SCOPE)