From a9d1a8ea3deffdd1d07c8b096e652a1f2b70c09f Mon Sep 17 00:00:00 2001 From: Aleksandr Golubev Date: Mon, 17 Jun 2024 17:18:10 +0300 Subject: [PATCH] tests: mark string constants as constants Three constants were declared as variables. Signed-off-by: Aleksandr Golubev --- tests/test_utils.h | 4 ++-- tests/vhost_user_blk_test_server.c | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/test_utils.h b/tests/test_utils.h index 444a82c..5dba62e 100644 --- a/tests/test_utils.h +++ b/tests/test_utils.h @@ -12,11 +12,11 @@ #endif /* Log function for tests */ -static const char *log_level_str[] = { +static const char *const log_level_str[] = { "ERROR", "WARNING", "INFO", - "DEBUG" + "DEBUG", }; __attribute__((format(printf, 2, 3))) diff --git a/tests/vhost_user_blk_test_server.c b/tests/vhost_user_blk_test_server.c index d0b8b57..7af6d15 100644 --- a/tests/vhost_user_blk_test_server.c +++ b/tests/vhost_user_blk_test_server.c @@ -854,11 +854,11 @@ static int resize(struct disk *d, uint64_t new_size) static bool monitor_serve_fd(FILE *f_in, FILE *f_out, struct disks_context *ctx) { - const char *help = "Commands:\n" - " help - print this message\n" - " stop - stop the server and quit\n" - " stat - print statistics\n" - " resize - resize the disk\n"; + const char *const help = "Commands:\n" + " help - print this message\n" + " stop - stop the server and quit\n" + " stat - print statistics\n" + " resize - resize the disk\n"; bool interactive = (f_in == stdin && f_out == stdout); @@ -1035,7 +1035,7 @@ static void monitor_serve_unix_socket(const char *path, static void interactive_sigint(int sig) { - const char *msg = "\nUse 'stop' command or Ctrl+D to exit\n"; + const char *const msg = "\nUse 'stop' command or Ctrl+D to exit\n"; write(2, msg, strlen(msg)); }