Skip to content

Commit

Permalink
fts: Optimize replacing NULs in header
Browse files Browse the repository at this point in the history
  • Loading branch information
sirainen committed Aug 30, 2018
1 parent a318cf4 commit 7057aa9
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/plugins/fts/fts-build-mail.c
Expand Up @@ -93,13 +93,11 @@ fts_build_unstructured_header(struct fts_mail_build_context *ctx,
for (i = 0; i < hdr->full_value_len; i++) {
if (hdr->full_value[i] == '\0') {
if (buf == NULL) {
buf = i_malloc(hdr->full_value_len);
memcpy(buf, hdr->full_value, i);
buf = i_memdup(hdr->full_value,
hdr->full_value_len);
data = buf;
}
buf[i] = ' ';
} else if (buf != NULL) {
buf[i] = hdr->full_value[i];
}
}
ret = fts_build_data(ctx, data, hdr->full_value_len, TRUE);
Expand Down

0 comments on commit 7057aa9

Please sign in to comment.