aboutsummaryrefslogtreecommitdiffstats
path: root/src/libutil/fstring.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libutil/fstring.c')
-rw-r--r--src/libutil/fstring.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/src/libutil/fstring.c b/src/libutil/fstring.c
index 652d72d14..3f3af5357 100644
--- a/src/libutil/fstring.c
+++ b/src/libutil/fstring.c
@@ -272,25 +272,22 @@ rspamd_fstrhash_lc (const rspamd_ftok_t * str, gboolean is_utf)
p = str->begin;
hval = str->len;
+ end = p + str->len;
if (is_utf) {
- while (end < str->begin + str->len) {
- if (rspamd_fast_utf8_validate (p, str->len) != 0) {
- return rspamd_fstrhash_lc (str, FALSE);
- }
- while (p < end) {
- uc = g_unichar_tolower (g_utf8_get_char (p));
- for (j = 0; j < sizeof (gunichar); j++) {
- t = (uc >> (j * 8)) & 0xff;
- if (t != 0) {
- hval = fstrhash_c (t, hval);
- }
+ if (rspamd_fast_utf8_validate (p, str->len) != 0) {
+ return rspamd_fstrhash_lc (str, FALSE);
+ }
+ while (p < end) {
+ uc = g_unichar_tolower (g_utf8_get_char (p));
+ for (j = 0; j < sizeof (gunichar); j++) {
+ t = (uc >> (j * 8)) & 0xff;
+ if (t != 0) {
+ hval = fstrhash_c (t, hval);
}
- p = g_utf8_next_char (p);
}
- p = end + 1;
+ p = g_utf8_next_char (p);
}
-
}
else {
for (i = 0; i < str->len; i++, p++) {