summaryrefslogtreecommitdiff
path: root/other/bootstrap_daemon/src/config.c
diff options
context:
space:
mode:
Diffstat (limited to 'other/bootstrap_daemon/src/config.c')
-rw-r--r--other/bootstrap_daemon/src/config.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/other/bootstrap_daemon/src/config.c b/other/bootstrap_daemon/src/config.c
index 64fc4d94..3f1592e6 100644
--- a/other/bootstrap_daemon/src/config.c
+++ b/other/bootstrap_daemon/src/config.c
@@ -49,7 +49,7 @@ static void parse_tcp_relay_ports_config(config_t *cfg, uint16_t **tcp_relay_por
49 49
50 config_setting_t *ports_array = config_lookup(cfg, NAME_TCP_RELAY_PORTS); 50 config_setting_t *ports_array = config_lookup(cfg, NAME_TCP_RELAY_PORTS);
51 51
52 if (ports_array == NULL) { 52 if (ports_array == nullptr) {
53 log_write(LOG_LEVEL_WARNING, "No '%s' setting in the configuration file.\n", NAME_TCP_RELAY_PORTS); 53 log_write(LOG_LEVEL_WARNING, "No '%s' setting in the configuration file.\n", NAME_TCP_RELAY_PORTS);
54 log_write(LOG_LEVEL_WARNING, "Using default '%s':\n", NAME_TCP_RELAY_PORTS); 54 log_write(LOG_LEVEL_WARNING, "Using default '%s':\n", NAME_TCP_RELAY_PORTS);
55 55
@@ -83,7 +83,7 @@ static void parse_tcp_relay_ports_config(config_t *cfg, uint16_t **tcp_relay_por
83 *tcp_relay_ports = (uint16_t *)realloc(*tcp_relay_ports, (*tcp_relay_port_count) * sizeof(uint16_t)); 83 *tcp_relay_ports = (uint16_t *)realloc(*tcp_relay_ports, (*tcp_relay_port_count) * sizeof(uint16_t));
84 } else { 84 } else {
85 free(*tcp_relay_ports); 85 free(*tcp_relay_ports);
86 *tcp_relay_ports = NULL; 86 *tcp_relay_ports = nullptr;
87 } 87 }
88 88
89 return; 89 return;
@@ -109,7 +109,7 @@ static void parse_tcp_relay_ports_config(config_t *cfg, uint16_t **tcp_relay_por
109 for (i = 0; i < config_port_count; i ++) { 109 for (i = 0; i < config_port_count; i ++) {
110 config_setting_t *elem = config_setting_get_elem(ports_array, i); 110 config_setting_t *elem = config_setting_get_elem(ports_array, i);
111 111
112 if (elem == NULL) { 112 if (elem == nullptr) {
113 // it's NULL if `ports_array` is not an array (we have that check earlier) or if `i` is out of range, which should not be 113 // it's NULL if `ports_array` is not an array (we have that check earlier) or if `i` is out of range, which should not be
114 log_write(LOG_LEVEL_WARNING, "Port #%d: Something went wrong while parsing the port. Stopping reading ports.\n", i); 114 log_write(LOG_LEVEL_WARNING, "Port #%d: Something went wrong while parsing the port. Stopping reading ports.\n", i);
115 break; 115 break;
@@ -137,7 +137,7 @@ static void parse_tcp_relay_ports_config(config_t *cfg, uint16_t **tcp_relay_por
137 *tcp_relay_ports = (uint16_t *)realloc(*tcp_relay_ports, (*tcp_relay_port_count) * sizeof(uint16_t)); 137 *tcp_relay_ports = (uint16_t *)realloc(*tcp_relay_ports, (*tcp_relay_port_count) * sizeof(uint16_t));
138 } else { 138 } else {
139 free(*tcp_relay_ports); 139 free(*tcp_relay_ports);
140 *tcp_relay_ports = NULL; 140 *tcp_relay_ports = nullptr;
141 } 141 }
142} 142}
143 143
@@ -306,7 +306,7 @@ int get_general_config(const char *cfg_file_path, char **pid_file_path, char **k
306static uint8_t *hex_string_to_bin(const char *hex_string) 306static uint8_t *hex_string_to_bin(const char *hex_string)
307{ 307{
308 if (strlen(hex_string) % 2 != 0) { 308 if (strlen(hex_string) % 2 != 0) {
309 return NULL; 309 return nullptr;
310 } 310 }
311 311
312 size_t len = strlen(hex_string) / 2; 312 size_t len = strlen(hex_string) / 2;
@@ -342,7 +342,7 @@ int bootstrap_from_config(const char *cfg_file_path, DHT *dht, int enable_ipv6)
342 342
343 config_setting_t *node_list = config_lookup(&cfg, NAME_BOOTSTRAP_NODES); 343 config_setting_t *node_list = config_lookup(&cfg, NAME_BOOTSTRAP_NODES);
344 344
345 if (node_list == NULL) { 345 if (node_list == nullptr) {
346 log_write(LOG_LEVEL_WARNING, "No '%s' setting in the configuration file. Skipping bootstrapping.\n", 346 log_write(LOG_LEVEL_WARNING, "No '%s' setting in the configuration file. Skipping bootstrapping.\n",
347 NAME_BOOTSTRAP_NODES); 347 NAME_BOOTSTRAP_NODES);
348 config_destroy(&cfg); 348 config_destroy(&cfg);
@@ -369,7 +369,7 @@ int bootstrap_from_config(const char *cfg_file_path, DHT *dht, int enable_ipv6)
369 369
370 node = config_setting_get_elem(node_list, 0); 370 node = config_setting_get_elem(node_list, 0);
371 371
372 if (node == NULL) { 372 if (node == nullptr) {
373 config_destroy(&cfg); 373 config_destroy(&cfg);
374 return 0; 374 return 0;
375 } 375 }