From 4fe34b16f2f1d29359d93458ac5f8d9cf6ff38c3 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Sat, 22 May 2021 13:23:13 +0100 Subject: [PATCH] [Minor] Const-ify trim function as it does not change anything in fact --- src/libutil/cxx/utf8_util.cxx | 6 +++--- src/libutil/cxx/utf8_util.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libutil/cxx/utf8_util.cxx b/src/libutil/cxx/utf8_util.cxx index cf71ae2ae..e42ef917f 100644 --- a/src/libutil/cxx/utf8_util.cxx +++ b/src/libutil/cxx/utf8_util.cxx @@ -30,10 +30,10 @@ #define DOCTEST_CONFIG_IMPLEMENTATION_IN_DLL #include "doctest/doctest.h" -char * -rspamd_string_unicode_trim_inplace (char *str, size_t *len) +const char * +rspamd_string_unicode_trim_inplace (const char *str, size_t *len) { - auto *p = str, *end = str + *len; + const auto *p = str, *end = str + *len; auto i = 0; while (i < *len) { diff --git a/src/libutil/cxx/utf8_util.h b/src/libutil/cxx/utf8_util.h index 21add9bae..242e03f00 100644 --- a/src/libutil/cxx/utf8_util.h +++ b/src/libutil/cxx/utf8_util.h @@ -32,7 +32,7 @@ extern "C" { * @param len length * @return new length of the string trimmed */ -char* rspamd_string_unicode_trim_inplace (char *str, size_t *len); +const char* rspamd_string_unicode_trim_inplace (const char *str, size_t *len); enum rspamd_normalise_result { RSPAMD_UNICODE_NORM_NORMAL = 0, -- 2.39.5