Fix uninitialized local causing rtc failures (#11136)

* Fix uninitialized local causing rtc failures

* Moved initialization per review

* Moved local per review

* Cleaned up json separator local
This commit is contained in:
Rafael Rivera 2018-08-19 00:11:23 -07:00 committed by Anton Kochkov
parent 374a4800e8
commit 8128b0acb3

View File

@ -2348,9 +2348,9 @@ static int cmd_print_blocks(RCore *core, const char *input) {
bool use_color = r_config_get_i (core->config, "scr.color");
int len = 0;
int i;
int l;
RCoreAnalStatsItem total = {0};
for (i = 0; i < ((to-from)/piece); i++) {
bool insert_separator = false;
ut64 at = from + (piece * i);
ut64 ate = at + piece;
ut64 p = (at - from) / piece;
@ -2363,14 +2363,13 @@ static int cmd_print_blocks(RCore *core, const char *input) {
|| (as->block[p].symbols)
|| (as->block[p].rwx)
|| (as->block[p].strings)) {
r_cons_printf ("\"offset\":%"PFMT64d ",", at), l++;
r_cons_printf ("\"size\":%"PFMT64d ",", piece), l++;
r_cons_printf ("\"offset\":%"PFMT64d ",", at);
r_cons_printf ("\"size\":%"PFMT64d ",", piece);
}
l = 0;
#define PRINT_VALUE(name, cond, v) { \
if (cond) { \
r_cons_printf ("%s\"" name "\":%d", l? ",": "", (v)); \
l++; \
r_cons_printf ("%s\"" name "\":%d", insert_separator? ",": "", (v)); \
insert_separator = true; \
}}
#define PRINT_VALUE2(name, v) PRINT_VALUE(name, v, v)
PRINT_VALUE2 ("flags", as->block[p].flags);