Skip to content
Snippets Groups Projects
Commit d69a9fa2 authored by dmitriy.gerasimov's avatar dmitriy.gerasimov
Browse files

Merge branch 'bugs-3874-alt' into 'master'

[*] fixed unneeded trailing comma in node list

See merge request !66
parents 83d28013 49e8c000
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)
l_count++;
}
}
size_t l_num_print_nodes = 0;
for(size_t l_c = 0; l_c < l_continents_count; l_c++) {
// print all nodes for continent
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)
continue;
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(l_o != l_orders_num - 1)
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");
dap_string_append_printf(l_reply_str, ",\n");
}
break;
}
......@@ -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);
//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_http_simple_reply( a_http_simple, l_reply_str->str, l_reply_str->len );
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