[PATCH v6 12/15] nxt_conf_set_string_dup(): Use 'const' for read-only parameter

Alejandro Colomar alx.manpages at gmail.com
Tue Feb 15 14:57:52 UTC 2022

That parameter is not being modified in the function.  Make it
'const' to allow passing 'static const' variables.

Signed-off-by: Alejandro Colomar <alx.manpages at gmail.com>
Cc: Nginx Unit <unit at nginx.org>
Cc: "Valentin V. Bartenev" <vbart at nginx.com>
Cc: Zhidao HONG <z.hong at f5.com>
Cc: Igor Sysoev <igor at sysoev.ru>
Cc: Oisin Canty <o.canty at f5.com>
Cc: Andrei Zeliankou <zelenkov at nginx.com>
Cc: Maxim Romanov <m.romanov at f5.com>
 src/nxt_conf.c | 3 ++-
 src/nxt_conf.h | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/nxt_conf.c b/src/nxt_conf.c
index 3f0cfa8..967c455 100644
--- a/src/nxt_conf.c
+++ b/src/nxt_conf.c
@@ -192,7 +192,8 @@ nxt_conf_set_string(nxt_conf_value_t *value, nxt_str_t *str)
-nxt_conf_set_string_dup(nxt_conf_value_t *value, nxt_mp_t *mp, nxt_str_t *str)
+nxt_conf_set_string_dup(nxt_conf_value_t *value, nxt_mp_t *mp,
+    const nxt_str_t *str)
     nxt_str_t  tmp, *ptr;
diff --git a/src/nxt_conf.h b/src/nxt_conf.h
index 8b3565f..09f2175 100644
--- a/src/nxt_conf.h
+++ b/src/nxt_conf.h
@@ -115,7 +115,7 @@ nxt_int_t nxt_conf_validate(nxt_conf_validation_t *vldt);
 NXT_EXPORT void nxt_conf_get_string(nxt_conf_value_t *value, nxt_str_t *str);
 NXT_EXPORT void nxt_conf_set_string(nxt_conf_value_t *value, nxt_str_t *str);
 NXT_EXPORT nxt_int_t nxt_conf_set_string_dup(nxt_conf_value_t *value,
-    nxt_mp_t *mp, nxt_str_t *str);
+    nxt_mp_t *mp, const nxt_str_t *str);
 NXT_EXPORT double nxt_conf_get_number(nxt_conf_value_t *value);
 NXT_EXPORT uint8_t nxt_conf_get_boolean(nxt_conf_value_t *value);

More information about the unit mailing list