summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_controller.c
diff options
context:
space:
mode:
authorAndrew Clayton <a.clayton@nginx.com>2024-04-16 20:30:48 +0100
committerAndrew Clayton <a.clayton@nginx.com>2024-04-25 15:15:09 +0100
commit8f861cf4d15e8befca6edcee4b04b5304f082f05 (patch)
treed1f4bfd3386e6d5a149deb1e164bc2b68b6f3bda /src/nxt_controller.c
parente5bc299d7a55a66e1ecf54d35dcdd9448c49f3d4 (diff)
downloadunit-8f861cf4d15e8befca6edcee4b04b5304f082f05.tar.gz
unit-8f861cf4d15e8befca6edcee4b04b5304f082f05.tar.bz2
Constify a bunch of static local variables
A common pattern was to declare variables in functions like static nxt_str_t ... Not sure why static, as they were being treated more like string literals (and of course they are _not_ thread safe), let's actually make them constants (qualifier wise). This handles core code conversion. Reviewed-by: Zhidao HONG <z.hong@f5.com> Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
Diffstat (limited to '')
-rw-r--r--src/nxt_controller.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/nxt_controller.c b/src/nxt_controller.c
index eb814321..230a4d5d 100644
--- a/src/nxt_controller.c
+++ b/src/nxt_controller.c
@@ -1912,8 +1912,8 @@ nxt_controller_cert_in_use(nxt_str_t *name)
nxt_str_t str;
nxt_conf_value_t *listeners, *listener, *value;
- static nxt_str_t listeners_path = nxt_string("/listeners");
- static nxt_str_t certificate_path = nxt_string("/tls/certificate");
+ static const nxt_str_t listeners_path = nxt_string("/listeners");
+ static const nxt_str_t certificate_path = nxt_string("/tls/certificate");
listeners = nxt_conf_get_path(nxt_controller_conf.root, &listeners_path);
@@ -2178,7 +2178,7 @@ nxt_controller_script_in_use(nxt_str_t *name)
nxt_str_t str;
nxt_conf_value_t *js_module, *element;
- static nxt_str_t js_module_path = nxt_string("/settings/js_module");
+ static const nxt_str_t js_module_path = nxt_string("/settings/js_module");
js_module = nxt_conf_get_path(nxt_controller_conf.root,
&js_module_path);
@@ -2486,13 +2486,13 @@ nxt_controller_response(nxt_task_t *task, nxt_controller_request_t *req,
nxt_conf_value_t *value, *location;
nxt_conf_json_pretty_t pretty;
- static nxt_str_t success_str = nxt_string("success");
- static nxt_str_t error_str = nxt_string("error");
- static nxt_str_t detail_str = nxt_string("detail");
- static nxt_str_t location_str = nxt_string("location");
- static nxt_str_t offset_str = nxt_string("offset");
- static nxt_str_t line_str = nxt_string("line");
- static nxt_str_t column_str = nxt_string("column");
+ static const nxt_str_t success_str = nxt_string("success");
+ static const nxt_str_t error_str = nxt_string("error");
+ static const nxt_str_t detail_str = nxt_string("detail");
+ static const nxt_str_t location_str = nxt_string("location");
+ static const nxt_str_t offset_str = nxt_string("offset");
+ static const nxt_str_t line_str = nxt_string("line");
+ static const nxt_str_t column_str = nxt_string("column");
static nxt_time_string_t date_cache = {
(nxt_atomic_uint_t) -1,