Skip to content
Snippets Groups Projects
Commit 49e8c000 authored by Aleksei Voronin's avatar Aleksei Voronin
Browse files

[*] fixed unneeded trailing comma in node list

parent 449d6c54
No related branches found
No related tags found
1 merge request!66[*] fixed unneeded trailing comma in node list
...@@ -298,7 +298,7 @@ static void s_http_simple_proc(dap_http_simple_t *a_http_simple, void *a_arg) ...@@ -298,7 +298,7 @@ static void s_http_simple_proc(dap_http_simple_t *a_http_simple, void *a_arg)
l_count++; l_count++;
} }
} }
size_t l_num_print_nodes = 0;
for(size_t l_c = 0; l_c < l_continents_count; l_c++) { for(size_t l_c = 0; l_c < l_continents_count; l_c++) {
// print all nodes for continent // print all nodes for continent
for(size_t l_n = 0; l_n < l_continents_numbers[l_c]; l_n++) { for(size_t l_n = 0; l_n < l_continents_numbers[l_c]; l_n++) {
...@@ -308,12 +308,7 @@ static void s_http_simple_proc(dap_http_simple_t *a_http_simple, void *a_arg) ...@@ -308,12 +308,7 @@ static void s_http_simple_proc(dap_http_simple_t *a_http_simple, void *a_arg)
continue; continue;
dap_chain_net_srv_order_t *l_order = l_orders_pos[l_o]; dap_chain_net_srv_order_t *l_order = l_orders_pos[l_o];
if(!order_info_print(l_reply_str, l_net, l_order, NULL, l_n)) { if(!order_info_print(l_reply_str, l_net, l_order, NULL, l_n)) {
//if(l_o != l_orders_num - 1) dap_string_append_printf(l_reply_str, ",\n");
l_num_print_nodes++;
if(l_num_print_nodes < l_orders_used_num)
dap_string_append_printf(l_reply_str, ",\n");
else
dap_string_append_printf(l_reply_str, "\n");
} }
break; break;
} }
...@@ -322,6 +317,12 @@ static void s_http_simple_proc(dap_http_simple_t *a_http_simple, void *a_arg) ...@@ -322,6 +317,12 @@ static void s_http_simple_proc(dap_http_simple_t *a_http_simple, void *a_arg)
} }
} }
DAP_DELETE(l_geoip_info); DAP_DELETE(l_geoip_info);
//delete trailing comma if exists
if(l_reply_str->str[l_reply_str->len - 2] == ','){
dap_string_truncate(l_reply_str, l_reply_str->len - 2);
dap_string_append_printf(l_reply_str, "\n");
}
dap_string_append_printf( l_reply_str, "]\n\n"); dap_string_append_printf( l_reply_str, "]\n\n");
dap_http_simple_reply( a_http_simple, l_reply_str->str, l_reply_str->len ); dap_http_simple_reply( a_http_simple, l_reply_str->str, l_reply_str->len );
dap_string_free(l_reply_str, true); dap_string_free(l_reply_str, true);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment