commit 4fe34b1: [Minor] Const-ify trim function as it does not change anything in fact

Vsevolod Stakhov vsevolod at highsecure.ru
Sat May 22 12:28:04 UTC 2021


Author: Vsevolod Stakhov
Date: 2021-05-22 13:23:13 +0100
URL: https://github.com/rspamd/rspamd/commit/4fe34b16f2f1d29359d93458ac5f8d9cf6ff38c3 (HEAD -> master)

[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,


More information about the Commits mailing list