/* Copyright (c) 2007-2018 Dovecot authors, see the included COPYING file */
/* @UNSAFE: whole file */
#include "lib.h"
#include "str-find.h"
struct str_find_context {
unsigned char *key;
unsigned int key_len;
unsigned int *matches;
unsigned int match_count;
};
{
for (i = 0; i <= UCHAR_MAX; i++)
for (i = 0; i < len_1; i++)
}
{
int f = 0, g, i;
g = len_1;
else {
if (i < g)
g = i;
f = i;
g--;
suffixes[i] = f - g;
}
}
}
{
unsigned int *suffixes;
j = 0;
for (i = len_1; i >= -1; i--) {
if (i < 0 || suffixes[i] == (unsigned int)i + 1) {
for (; j < len_1 - i; j++) {
}
}
}
}
{
return ctx;
}
{
}
{
unsigned int i, j, a, b;
int bad_value;
for (i = j = 0; i < ctx->match_count; i++) {
/* we can fully determine this match now */
for (; a < key_len; a++) {
break;
}
if (a == key_len) {
return TRUE;
}
} else {
for (b = 0; b < size; b++) {
break;
}
if (b == size)
}
}
if (j > 0) {
ctx->match_count = j;
j = 0;
} else {
/* Boyer-Moore searching */
j = 0;
i = key_len - 1;
if (i == 0) {
return TRUE;
}
i--;
}
(int)key_len;
}
ctx->match_count = 0;
}
for (; j < size; j++) {
for (i = j; i < size; i++) {
break;
}
if (i == size)
}
return FALSE;
}
{
return ctx->match_end_pos;
}
{
ctx->match_count = 0;
}