@@ -44,7 +44,7 @@ static void parse_tcp_relay_ports_config(config_t *cfg, uint16_t **tcp_relay_por
4444 log_write (LOG_LEVEL_WARNING , "No '%s' setting in the configuration file.\n" , NAME_TCP_RELAY_PORTS );
4545 log_write (LOG_LEVEL_WARNING , "Using default '%s':\n" , NAME_TCP_RELAY_PORTS );
4646
47- uint16_t default_ports [] = {DEFAULT_TCP_RELAY_PORTS };
47+ const uint16_t default_ports [] = {DEFAULT_TCP_RELAY_PORTS };
4848
4949 // Check to avoid calling malloc(0) later on
5050 // NOLINTNEXTLINE, clang-tidy: error: suspicious comparison of 'sizeof(expr)' to a constant [bugprone-sizeof-expression,-warnings-as-errors]
@@ -90,7 +90,7 @@ static void parse_tcp_relay_ports_config(config_t *cfg, uint16_t **tcp_relay_por
9090 return ;
9191 }
9292
93- int config_port_count = config_setting_length (ports_array );
93+ const int config_port_count = config_setting_length (ports_array );
9494
9595 if (config_port_count == 0 ) {
9696 log_write (LOG_LEVEL_ERROR , "'%s' is empty.\n" , NAME_TCP_RELAY_PORTS );
@@ -247,8 +247,8 @@ int get_general_config(const char *cfg_file_path, char **pid_file_path, char **k
247247 tmp_motd = DEFAULT_MOTD ;
248248 }
249249
250- size_t tmp_motd_length = strlen (tmp_motd ) + 1 ;
251- size_t motd_length = tmp_motd_length > MAX_MOTD_LENGTH ? MAX_MOTD_LENGTH : tmp_motd_length ;
250+ const size_t tmp_motd_length = strlen (tmp_motd ) + 1 ;
251+ const size_t motd_length = tmp_motd_length > MAX_MOTD_LENGTH ? MAX_MOTD_LENGTH : tmp_motd_length ;
252252 * motd = (char * )malloc (motd_length );
253253 snprintf (* motd , motd_length , "%s" , tmp_motd );
254254 }
@@ -302,7 +302,7 @@ static uint8_t *bootstrap_hex_string_to_bin(const char *hex_string)
302302 return nullptr ;
303303 }
304304
305- size_t len = strlen (hex_string ) / 2 ;
305+ const size_t len = strlen (hex_string ) / 2 ;
306306 uint8_t * ret = (uint8_t * )malloc (len );
307307
308308 const char * pos = hex_string ;
0 commit comments