Cross Reference: fts-filter-common.c
xref
: /
dovecot
/
src
/
lib-fts
/
fts-filter-common.c
Home
History
Annotate
Line#
Navigate
Download
Search
only in
./
bcb4e51a409d94ae670de96afb8483a4f7855294
Stephan Bosch
/* Copyright (c) 2016-2018 Dovecot authors, see the included COPYING file */
5fcd30add8dcf4d883978cce3e39f3a89184f1e5
Teemu Huovila
5fcd30add8dcf4d883978cce3e39f3a89184f1e5
Teemu Huovila
#
include
"
lib.h
"
5fcd30add8dcf4d883978cce3e39f3a89184f1e5
Teemu Huovila
#
include
"
str.h
"
16161da6716cb679e315d59146fa3d5a93b4f031
Aki Tuomi
#
include
"
buffer.h
"
5fcd30add8dcf4d883978cce3e39f3a89184f1e5
Teemu Huovila
#
include
"
unichar.h
"
5fcd30add8dcf4d883978cce3e39f3a89184f1e5
Teemu Huovila
#
include
"
fts-filter-private.h
"
5fcd30add8dcf4d883978cce3e39f3a89184f1e5
Teemu Huovila
#
include
"
fts-filter-common.h
"
5fcd30add8dcf4d883978cce3e39f3a89184f1e5
Teemu Huovila
#
include
"
fts-tokenizer-common.h
"
5fcd30add8dcf4d883978cce3e39f3a89184f1e5
Teemu Huovila
5fcd30add8dcf4d883978cce3e39f3a89184f1e5
Teemu Huovila
void
fts_filter_truncate_token
(
string_t
*
token
,
size_t
max_length
)
5fcd30add8dcf4d883978cce3e39f3a89184f1e5
Teemu Huovila
{
5fcd30add8dcf4d883978cce3e39f3a89184f1e5
Teemu Huovila
if
(
str_len
(
token
) <=
max_length
)
5fcd30add8dcf4d883978cce3e39f3a89184f1e5
Teemu Huovila
return
;
5fcd30add8dcf4d883978cce3e39f3a89184f1e5
Teemu Huovila
5fcd30add8dcf4d883978cce3e39f3a89184f1e5
Teemu Huovila
size_t
len
=
max_length
;
5fcd30add8dcf4d883978cce3e39f3a89184f1e5
Teemu Huovila
fts_tokenizer_delete_trailing_partial_char
(
token
->
data
, &
len
);
5fcd30add8dcf4d883978cce3e39f3a89184f1e5
Teemu Huovila
str_truncate
(
token
,
len
);
5fcd30add8dcf4d883978cce3e39f3a89184f1e5
Teemu Huovila
i_assert
(
len
<=
max_length
);
5fcd30add8dcf4d883978cce3e39f3a89184f1e5
Teemu Huovila
}