From 0ae4a5c3e8da054e27c0917a8857ba979fa432e0 Mon Sep 17 00:00:00 2001
From: pancake <pancake@nopcode.org>
Date: Mon, 20 Feb 2017 02:54:16 +0100
Subject: [PATCH] More r2-indent fixes. and reindent a bunch of files

---
 binr/rax2/rax2.c        |   2 +-
 doc/uncrustify.cfg      |  24 +-
 libr/core/blaze.c       |  44 +-
 libr/core/cmd_info.c    | 191 ++++----
 libr/core/cmd_project.c | 222 +++++-----
 libr/core/file.c        | 288 ++++++------
 libr/core/graph.c       | 958 +++++++++++++++++++++++-----------------
 libr/core/yank.c        |  52 +--
 sys/indent.sh           |   6 +
 9 files changed, 1002 insertions(+), 785 deletions(-)
 mode change 100755 => 100644 libr/core/file.c

diff --git a/binr/rax2/rax2.c b/binr/rax2/rax2.c
index 72a64520b2..7cd70b3c63 100644
--- a/binr/rax2/rax2.c
+++ b/binr/rax2/rax2.c
@@ -477,7 +477,7 @@ static int use_stdin() {
 	return 0;
 }
 
-int main (int argc, char **argv) {
+int main (int argc, char** argv) {
 	int i;
 	num = r_num_new (NULL, NULL, NULL);
 	if (argc == 1) {
diff --git a/doc/uncrustify.cfg b/doc/uncrustify.cfg
index 8174f654fb..df31ff1f09 100644
--- a/doc/uncrustify.cfg
+++ b/doc/uncrustify.cfg
@@ -9,9 +9,9 @@ input_tab_size                  = 8
 output_tab_size                 = 8
 sp_arith                        = Force
 sp_assign                       = Force
-sp_after_ptr_star               = Force
-sp_after_ptr_star_func          = Force
-sp_before_ptr_star_func         = Remove
+sp_after_ptr_star               = Remove
+sp_after_ptr_star_func          = Remove
+sp_before_ptr_star_func         = Force
 sp_before_ptr_star              = Remove
 sp_after_cast                   = Force
 sp_func_call_user_paren         = Remove
@@ -75,7 +75,7 @@ indent_switch_case              = 0
 indent_case_shift               = 0
 indent_case_brace               = 0
 indent_col1_comment             = false
-indent_label                    = 1
+indent_label                    = 1 
 indent_access_spec              = 1
 indent_access_spec_body         = false
 indent_paren_nl                 = false
@@ -119,11 +119,11 @@ sp_paren_paren                  = remove
 sp_cparen_oparen                = ignore
 sp_balance_nested_parens        = false
 sp_paren_brace                  = ignore
-#sp_before_ptr_star              = ignore
-#sp_before_unnamed_ptr_star      = ignore
-#sp_between_ptr_star             = remove
-#sp_after_ptr_star_qualifier     = ignore
-#sp_ptr_star_paren               = ignore
+sp_before_ptr_star              = add
+sp_before_unnamed_ptr_star      = ignore
+sp_between_ptr_star             = remove
+sp_after_ptr_star_qualifier     = ignore
+sp_ptr_star_paren               = ignore
 sp_before_byref                 = ignore
 sp_before_unnamed_byref         = ignore
 sp_after_byref                  = ignore
@@ -253,7 +253,7 @@ sp_cond_question                = ignore
 sp_cond_question_before         = ignore
 sp_cond_question_after          = ignore
 sp_cond_ternary_short           = ignore
-sp_case_label                   = ignore
+sp_case_label                   = remove
 sp_range                        = ignore
 sp_after_for_colon              = ignore
 sp_before_for_colon             = ignore
@@ -274,7 +274,7 @@ align_on_tabstop                = false
 align_number_left               = false
 align_keep_extra_space          = false
 align_func_params               = false
-align_same_func_call_params     = true
+align_same_func_call_params     = false
 align_var_def_span              = 0
 align_var_def_star_style        = 0
 align_var_def_amp_style         = 0
@@ -483,7 +483,7 @@ nl_before_block_comment         = 0
 nl_before_c_comment             = 0
 nl_before_cpp_comment           = 0
 nl_after_multiline_comment      = false
-nl_after_label_colon            = false
+nl_after_label_colon            = force
 nl_after_struct                 = 0
 nl_before_class                 = 0
 nl_after_class                  = 0
diff --git a/libr/core/blaze.c b/libr/core/blaze.c
index 77e4720621..d3fa7f6317 100644
--- a/libr/core/blaze.c
+++ b/libr/core/blaze.c
@@ -31,7 +31,7 @@ static int bbExist(AbbState *abb, ut64 addr) {
 	RAnalBlock *bb;
 	RListIter *iter;
 	if (abb->bbdb) {
-		return (int)sdb_num_get (abb->bbdb, sdb_fmt (0, "0x%08" PFMT64x, addr), NULL);
+		return (int) sdb_num_get (abb->bbdb, sdb_fmt (0, "0x%08" PFMT64x, addr), NULL);
 	}
 	r_list_foreach (abb->bbs, iter, bb) {
 		if (bb->addr == addr) {
@@ -42,11 +42,11 @@ static int bbExist(AbbState *abb, ut64 addr) {
 }
 
 static int fcnExist(AbbState *abb, ut64 addr) {
-	AbbAddr* a;
+	AbbAddr *a;
 	RListIter *iter;
 #if 0
 	if (abb->bbdb) {
-		return (int)sdb_num_get (abb->bbdb, sdb_fmt (0, "fcn.0x%08" PFMT64x, addr), NULL);
+		return (int) sdb_num_get (abb->bbdb, sdb_fmt (0, "fcn.0x%08" PFMT64x, addr), NULL);
 	}
 #endif
 	r_list_foreach (abb->fcnents, iter, a) {
@@ -113,7 +113,7 @@ static bool appendNextBB(AbbState *abb, ut64 addr, int bits, int type) {
 
 static RAnalBlock *parseOpcode(AbbState *abb, RAnalOp *aop) {
 	RFlagItem *fi = r_flag_get_i (abb->core->flags, aop->addr + aop->size);
-	bool eob = fi ? true:false; //strncmp (fi->name, "sym.", 4): false;
+	bool eob = fi? true: false; //strncmp (fi->name, "sym.", 4): false;
 	if (eob) {
 		aop->fail = UT64_MAX;
 	}
@@ -139,7 +139,7 @@ static RAnalBlock *parseOpcode(AbbState *abb, RAnalOp *aop) {
 			RFlagItem *fi = r_flag_get_i (abb->core->flags, aop->jump);
 			if (fi) {
 				if (r_anal_noreturn_at_name (abb->core->anal, fi->name)) {
-					//if (r_anal_noreturn_at_addr (abb->core->anal, aop->jump)) 
+					//if (r_anal_noreturn_at_addr (abb->core->anal, aop->jump))
 					eob = true;
 				}
 			}
@@ -150,8 +150,8 @@ static RAnalBlock *parseOpcode(AbbState *abb, RAnalOp *aop) {
 		if (aop->fail != UT64_MAX && !eob) {
 			appendNextBB (abb, aop->fail, 0, 0);
 		}
-aop->jump = aop->fail; //UT64_MAX;
-aop->fail = UT64_MAX;
+		aop->jump = aop->fail; //UT64_MAX;
+		aop->fail = UT64_MAX;
 #endif
 		break;
 	case R_ANAL_OP_TYPE_CJMP:
@@ -184,7 +184,7 @@ aop->fail = UT64_MAX;
 		bb->addr = abb->bb_addr;
 		bb->size = aop->addr - abb->bb_addr + aop->size;
 		if (bb->size < 1) {
-			eprintf ("Invalid block size at 0x%08"PFMT64x"\n", bb->addr);
+			eprintf ("Invalid block size at 0x%08"PFMT64x "\n", bb->addr);
 			// XXX
 			bb->size = aop->size;
 		}
@@ -215,10 +215,10 @@ static void printBasicBlocks(AbbState *abb, ut64 fcnaddr, ut64 addr) {
 	sdb_bool_set (abb->bbdb, sdb_fmt (0, "bb.0x%08" PFMT64x ".0x%08" PFMT64x, fcnaddr, addr), true, 0);
 	r_cons_printf ("afb+ 0x%08" PFMT64x " 0x%08" PFMT64x " %d", fcnaddr, bb->addr, bb->size);
 	if (bb->jump != UT64_MAX) {
-			r_cons_printf (" 0x%08" PFMT64x, bb->jump);
-			if (bb->fail != UT64_MAX) {
-				r_cons_printf (" 0x%08" PFMT64x, bb->fail);
-			}
+		r_cons_printf (" 0x%08" PFMT64x, bb->jump);
+		if (bb->fail != UT64_MAX) {
+			r_cons_printf (" 0x%08" PFMT64x, bb->fail);
+		}
 	}
 	r_cons_newline ();
 	if (bb->jump != UT64_MAX) {
@@ -230,7 +230,7 @@ static void printBasicBlocks(AbbState *abb, ut64 fcnaddr, ut64 addr) {
 }
 
 static void printFunction(ut64 addr, const char *name) {
-	char *_name = name? (char *)name: r_str_newf ("fcn.%" PFMT64x, addr);
+	char *_name = name? (char *) name: r_str_newf ("fcn.%" PFMT64x, addr);
 	r_cons_printf ("af+ 0x%08" PFMT64x " %s\n", addr, _name);
 	if (!name) {
 		free (_name);
@@ -253,13 +253,13 @@ static void findFunctions(RCore *core, AbbState *abb) {
 // if there's a flag, consider it a function
 		RFlagItem *fi = r_flag_get_i (core->flags, bb->addr);
 		if (fi) {
-			printFunction(bb->addr, fi->name);
+			printFunction (bb->addr, fi->name);
 		} else {
 			// eprintf ("# orphan bb 0x%08"PFMT64x"\n", bb->addr);
 			printFunction (bb->addr, NULL);
 		}
 		printBasicBlocks (abb, bb->addr, bb->addr);
-	//	printFunction (a->addr, a->name);
+		//	printFunction (a->addr, a->name);
 		// printBasicBlocks (abb, ->addr, a->addr);
 	}
 #if 0
@@ -288,7 +288,7 @@ R_API bool core_anal_bbs(RCore *core, ut64 len) {
 	//RListIter *iter;
 	ut64 at = core->offset;
 	abb->addr = at;
-	(void)r_io_read_at (core->io, abb->addr, abb->buf, len);
+	(void) r_io_read_at (core->io, abb->addr, abb->buf, len);
 	int ti = -1;
 	int oi = 0;
 	abb->last = at;
@@ -303,8 +303,8 @@ R_API bool core_anal_bbs(RCore *core, ut64 len) {
 		}
 		oi = i;
 		ut64 obb_addr = abb->bb_addr;
-	mountain:
-		if (!r_anal_op (core->anal, &aop, abb->addr + i, abb->buf + i, R_MIN (R_MAX(0, len - i), 16))) {
+mountain:
+		if (!r_anal_op (core->anal, &aop, abb->addr + i, abb->buf + i, R_MIN (R_MAX (0, len - i), 16))) {
 			continue;
 		}
 		int next = bbExist (abb, at + i);
@@ -352,7 +352,7 @@ R_API bool core_anal_bbs(RCore *core, ut64 len) {
 								i = nat->addr - at;
 								abb->bb_addr = nat->addr;
 								if (nat->type == 'c') {
-						//			r_list_append (abb->fcnents, nat);
+									//			r_list_append (abb->fcnents, nat);
 								} else {
 									free (nat);
 								}
@@ -394,15 +394,15 @@ R_API bool core_anal_bbs(RCore *core, ut64 len) {
 		} else {
 			name = r_str_newf ("bb.%"PFMT64x, bb->addr);
 		}
-		r_cons_printf ("agn 0x%08"PFMT64x" \"%s\"\n", bb->addr, name);
+		r_cons_printf ("agn 0x%08"PFMT64x " \"%s\"\n", bb->addr, name);
 		free (name);
 	}
 	r_list_foreach (abb->bbs, iter, bb) {
 		if (bb->jump != UT64_MAX) {
-			r_cons_printf ("age 0x%08"PFMT64x" 0x%08"PFMT64x"\n", bb->addr, bb->jump);
+			r_cons_printf ("age 0x%08"PFMT64x " 0x%08"PFMT64x "\n", bb->addr, bb->jump);
 		}
 		if (bb->fail != UT64_MAX) {
-			r_cons_printf ("age 0x%08"PFMT64x" 0x%08"PFMT64x"\n", bb->addr, bb->fail);
+			r_cons_printf ("age 0x%08"PFMT64x " 0x%08"PFMT64x "\n", bb->addr, bb->fail);
 		}
 	}
 #endif
diff --git a/libr/core/cmd_info.c b/libr/core/cmd_info.c
index 8e9ecce671..db2c8c61e5 100644
--- a/libr/core/cmd_info.c
+++ b/libr/core/cmd_info.c
@@ -37,7 +37,9 @@ static bool demangle_internal(RCore *core, const char *lang, const char *s) {
 		return true;
 	}
 	if (res) {
-		if (*res) printf ("%s\n", res);
+		if (*res) {
+			printf ("%s\n", res);
+		}
 		free (res);
 		return false;
 	}
@@ -47,7 +49,9 @@ static bool demangle_internal(RCore *core, const char *lang, const char *s) {
 static int demangle(RCore *core, const char *s) {
 	char *p, *q;
 	const char *ss = strchr (s, ' ');
-	if (!*s) return 0;
+	if (!*s) {
+		return 0;
+	}
 	if (!ss) {
 		const char *lang = r_config_get (core->config, "bin.lang");
 		demangle_internal (core, lang, s);
@@ -61,8 +65,8 @@ static int demangle(RCore *core, const char *s) {
 	return 1;
 }
 
-#define STR(x) (x)?(x):""
-static void r_core_file_info (RCore *core, int mode) {
+#define STR(x) (x)? (x): ""
+static void r_core_file_info(RCore *core, int mode) {
 	const char *fn = NULL;
 	int dbg = r_config_get_i (core->config, "cfg.debug");
 	bool io_cache = r_config_get_i (core->config, "io.cache");
@@ -70,24 +74,27 @@ static void r_core_file_info (RCore *core, int mode) {
 	RBinFile *binfile = r_core_bin_cur (core);
 	RCoreFile *cf = core->file;
 	RBinPlugin *plugin = r_bin_file_cur_plugin (binfile);
-	if (mode == R_CORE_BIN_JSON)
+	if (mode == R_CORE_BIN_JSON) {
 		r_cons_printf ("{");
-	if (mode == R_CORE_BIN_RADARE)
+	}
+	if (mode == R_CORE_BIN_RADARE) {
 		return;
-	if (mode == R_CORE_BIN_SIMPLE)
+	}
+	if (mode == R_CORE_BIN_SIMPLE) {
 		return;
+	}
 	if (info) {
 		fn = info->file;
 		switch (mode) {
 		case R_CORE_BIN_JSON:
-			r_cons_printf ("\"type\":\"%s\"", STR(info->type));
+			r_cons_printf ("\"type\":\"%s\"", STR (info->type));
 			break;
 		default:
 			pair ("type", info->type);
 			break;
 		}
 	} else {
-		fn = (cf && cf->desc) ? cf->desc->name : NULL;
+		fn = (cf && cf->desc)? cf->desc->name: NULL;
 	}
 	if (cf && mode == R_CORE_BIN_JSON) {
 		const char *uri = fn;
@@ -99,67 +106,78 @@ static void r_core_file_info (RCore *core, int mode) {
 			}
 		}
 		r_cons_printf (",\"file\":\"%s\"", uri);
-		if (dbg) dbg = R_IO_WRITE | R_IO_EXEC;
+		if (dbg) {
+			dbg = R_IO_WRITE | R_IO_EXEC;
+		}
 		if (cf->desc) {
 			ut64 fsz = r_io_desc_size (core->io, cf->desc);
 			r_cons_printf (",\"fd\":%d", cf->desc->fd);
 			if (fsz != UT64_MAX) {
 				r_cons_printf (",\"size\":%"PFMT64d, fsz);
 			}
-			r_cons_printf (",\"iorw\":%s", r_str_bool ( io_cache || \
-				cf->desc->flags & R_IO_WRITE ));
+			r_cons_printf (",\"iorw\":%s", r_str_bool ( io_cache ||\
+					cf->desc->flags & R_IO_WRITE ));
 			r_cons_printf (",\"mode\":\"%s\"", r_str_rwx_i (
-				cf->desc->flags & 7 ));
-			r_cons_printf (",\"obsz\":%"PFMT64d, (ut64)core->io->desc->obsz);
-			if (cf->desc->referer && *cf->desc->referer)
+					cf->desc->flags & 7 ));
+			r_cons_printf (",\"obsz\":%"PFMT64d, (ut64) core->io->desc->obsz);
+			if (cf->desc->referer && *cf->desc->referer) {
 				r_cons_printf (",\"referer\":\"%s\"", cf->desc->referer);
+			}
 		}
 		r_cons_printf (",\"block\":%d", core->blocksize);
 		if (binfile) {
-			if (binfile->curxtr)
+			if (binfile->curxtr) {
 				r_cons_printf (",\"packet\":\"%s\"",
 					binfile->curxtr->name);
-			if (plugin)
+			}
+			if (plugin) {
 				r_cons_printf (",\"format\":\"%s\"",
 					plugin->name);
+			}
 		}
 		r_cons_printf ("}");
 	} else if (cf && mode != R_CORE_BIN_SIMPLE) {
 		//r_cons_printf ("# Core file info\n");
-		pair ("file", fn ? fn : cf->desc->uri);
-		if (dbg) dbg = R_IO_WRITE | R_IO_EXEC;
+		pair ("file", fn? fn: cf->desc->uri);
+		if (dbg) {
+			dbg = R_IO_WRITE | R_IO_EXEC;
+		}
 		if (cf->desc) {
 			ut64 fsz = r_io_desc_size (core->io, cf->desc);
-			if (cf->desc->referer && *cf->desc->referer)
+			if (cf->desc->referer && *cf->desc->referer) {
 				pair ("referer", cf->desc->referer);
+			}
 			pair ("fd", sdb_fmt (0, "%d", cf->desc->fd));
 			if (fsz != UT64_MAX) {
 				pair ("size", sdb_fmt (0,"0x%"PFMT64x, fsz));
 			}
-			pair ("iorw", r_str_bool ( io_cache || \
-				cf->desc->flags & R_IO_WRITE ));
+			pair ("iorw", r_str_bool ( io_cache ||\
+					cf->desc->flags & R_IO_WRITE ));
 			pair ("blksz", sdb_fmt (0, "0x%"PFMT64x,
-				(ut64)core->io->desc->obsz));
+					(ut64) core->io->desc->obsz));
 			pair ("mode", r_str_rwx_i (cf->desc->flags & 7));
 		}
 		pair ("block", sdb_fmt (0, "0x%x", core->blocksize));
-		if (binfile && binfile->curxtr)
+		if (binfile && binfile->curxtr) {
 			pair ("packet", binfile->curxtr->name);
-		if (plugin)
+		}
+		if (plugin) {
 			pair ("format", plugin->name);
+		}
 	}
 }
 
-static int bin_is_executable (RBinObject *obj){
+static int bin_is_executable(RBinObject *obj){
 	RListIter *it;
-	RBinSection* sec;
+	RBinSection *sec;
 	if (obj) {
 		if (obj->info && obj->info->arch) {
 			return true;
 		}
 		r_list_foreach (obj->sections, it, sec){
-			if (R_BIN_SCN_EXECUTABLE & sec->srwx)
+			if (R_BIN_SCN_EXECUTABLE & sec->srwx) {
 				return true;
+			}
 		}
 	}
 	return false;
@@ -209,7 +227,7 @@ static void playMsg(RCore *core, const char *n, int len) {
 }
 
 static int cmd_info(void *data, const char *input) {
-	RCore *core = (RCore *)data;
+	RCore *core = (RCore *) data;
 	bool newline = r_config_get_i (core->config, "scr.interactive");
 	RBinObject *o = r_bin_cur_object (core->bin);
 	RCoreFile *cf = core->file;
@@ -218,7 +236,7 @@ static int cmd_info(void *data, const char *input) {
 	int is_array = 0;
 	Sdb *db;
 
-	for (i = 0; input[i] && i<2; i++) {
+	for (i = 0; input[i] && i < 2; i++) {
 		switch (input[i]) {
 		case '*': mode = R_CORE_BIN_RADARE; break;
 		case 'j': mode = R_CORE_BIN_JSON; break;
@@ -227,8 +245,9 @@ static int cmd_info(void *data, const char *input) {
 	}
 
 	if (mode == R_CORE_BIN_JSON) {
-		if (strlen (input+1)>1)
+		if (strlen (input + 1) > 1) {
 			is_array = 1;
+		}
 	}
 	if (is_array) {
 		r_cons_printf ("{");
@@ -244,10 +263,10 @@ static int cmd_info(void *data, const char *input) {
 	while (*input) {
 		switch (*input) {
 		case 'b': // "ib"
-			{
+		{
 			ut64 baddr = r_config_get_i (core->config, "bin.baddr");
 			if (input[1] == ' ') {
-				baddr = r_num_math (core->num, input+1);
+				baddr = r_num_math (core->num, input + 1);
 			}
 			// XXX: this will reload the bin using the buffer.
 			// An assumption is made that assumes there is an underlying
@@ -256,16 +275,18 @@ static int cmd_info(void *data, const char *input) {
 			r_core_bin_reload (core, NULL, baddr);
 			r_core_block_read (core);
 			newline = false;
-			}
-			break;
+		}
+		break;
 		case 'k':
-			db = o ? o->kv : NULL;
+			db = o? o->kv: NULL;
 			//:eprintf ("db = %p\n", db);
 			switch (input[1]) {
 			case 'v':
 				if (db) {
-					char *o = sdb_querys (db, NULL, 0, input+3);
-					if (o && *o) r_cons_print (o);
+					char *o = sdb_querys (db, NULL, 0, input + 3);
+					if (o && *o) {
+						r_cons_print (o);
+					}
 					free (o);
 				}
 				break;
@@ -285,7 +306,9 @@ static int cmd_info(void *data, const char *input) {
 			case '\0':
 				if (db) {
 					char *o = sdb_querys (db, NULL, 0, "*");
-					if (o && *o) r_cons_print (o);
+					if (o && *o) {
+						r_cons_print (o);
+					}
 					free (o);
 				}
 				break;
@@ -297,26 +320,27 @@ static int cmd_info(void *data, const char *input) {
 			goto done;
 			break;
 		case 'o':
-			{
-				if (!cf) {
-					eprintf ("Core file not open\n");
-					return 0;
-				}
-				const char *fn = input[1]==' '? input+2: cf->desc->name;
-				ut64 baddr = r_config_get_i (core->config, "bin.baddr");
-				r_core_bin_load (core, fn, baddr);
+		{
+			if (!cf) {
+				eprintf ("Core file not open\n");
+				return 0;
 			}
-			break;
-	#define RBININFO(n,x,y,z) \
-	if (is_array) { \
-		if (is_array == 1) is_array++; else r_cons_printf (","); \
-		r_cons_printf ("\"%s\":",n); \
-	}\
-	if (z) playMsg(core, n, z);\
-	r_core_bin_info (core, x, mode, va, NULL, y);
+			const char *fn = input[1] == ' '? input + 2: cf->desc->name;
+			ut64 baddr = r_config_get_i (core->config, "bin.baddr");
+			r_core_bin_load (core, fn, baddr);
+		}
+		break;
+			#define RBININFO(n,x,y,z)\
+				if (is_array) {\
+					if (is_array == 1) { is_array++;\
+					} else { r_cons_printf (",");}\
+					r_cons_printf ("\"%s\":",n);\
+				}\
+				if (z) { playMsg (core, n, z);}\
+				r_core_bin_info (core, x, mode, va, NULL, y);
 		case 'A':
 			newline = false;
-			if (input[1]=='j') {
+			if (input[1] == 'j') {
 				r_cons_printf ("{");
 				r_bin_list_archs (core->bin, 'j');
 				r_cons_printf ("}\n");
@@ -330,17 +354,17 @@ static int cmd_info(void *data, const char *input) {
 			//we comes from ia or iS
 			if ((input[1] == 'm' && input[2] == 'z') || !input[1]) {
 				RBININFO ("sections", R_CORE_BIN_ACC_SECTIONS, NULL, 0);
-			} else  { //iS entropy,sha1
+			} else {  //iS entropy,sha1
 				RBinObject *obj = r_bin_cur_object (core->bin);
 				if (mode == R_CORE_BIN_RADARE || mode == R_CORE_BIN_JSON || mode == R_CORE_BIN_SIMPLE) {
-					RBININFO ("sections", R_CORE_BIN_ACC_SECTIONS, input + 2, 
-					  	obj ? r_list_length (obj->sections) : 0);
+					RBININFO ("sections", R_CORE_BIN_ACC_SECTIONS, input + 2,
+						obj? r_list_length (obj->sections): 0);
 				} else {
-					RBININFO ("sections", R_CORE_BIN_ACC_SECTIONS, input + 1, 
-					  	obj ? r_list_length (obj->sections) : 0);
+					RBININFO ("sections", R_CORE_BIN_ACC_SECTIONS, input + 1,
+						obj? r_list_length (obj->sections): 0);
 				}
 				//we move input until get '\0'
-				while (*(++input));
+				while (*(++input)) ;
 				//input-- because we are inside a while that does input++
 				// oob read if not input--
 				input--;
@@ -352,7 +376,7 @@ static int cmd_info(void *data, const char *input) {
 				break;
 			}
 		case 'h': RBININFO ("fields", R_CORE_BIN_ACC_FIELDS, NULL, 0); break;
-		case 'l': RBININFO ("libs", R_CORE_BIN_ACC_LIBS, NULL, obj? r_list_length (obj->libs):0); break;
+		case 'l': RBININFO ("libs", R_CORE_BIN_ACC_LIBS, NULL, obj? r_list_length (obj->libs): 0); break;
 		case 'L':
 			r_bin_list (core->bin, input[1] == 'j');
 			break;
@@ -364,7 +388,7 @@ static int cmd_info(void *data, const char *input) {
 					if (f->offset == addr || !f->offset) {
 						r_cons_printf ("%s", f->name);
 					} else {
-						r_cons_printf ("%s+%d", f->name, (int)(addr-f->offset));
+						r_cons_printf ("%s+%d", f->name, (int) (addr - f->offset));
 					}
 				}
 				input++;
@@ -401,7 +425,7 @@ static int cmd_info(void *data, const char *input) {
 						mode = R_CORE_BIN_SIMPLE;
 					}
 					break;
-				default: 
+				default:
 					mode = R_CORE_BIN_PRINT;
 					break;
 				}
@@ -416,20 +440,20 @@ static int cmd_info(void *data, const char *input) {
 					input++;
 				}
 				if (obj) {
-					RBININFO ("strings", R_CORE_BIN_ACC_STRINGS, NULL, 
+					RBININFO ("strings", R_CORE_BIN_ACC_STRINGS, NULL,
 						obj? r_list_length (obj->strings): 0);
 				}
 			}
 			break;
 		case 'c': // for r2 `ic`
-			if (input[1]== '?') {
+			if (input[1] == '?') {
 				eprintf ("Usage: ic[ljq*] [class-index]\n");
-			} else if (input[1]== ' ' || input[1] == 'q' || input[1] == 'j' || input[1] == 'l') {
+			} else if (input[1] == ' ' || input[1] == 'q' || input[1] == 'j' || input[1] == 'l') {
 				RBinClass *cls;
 				RBinSymbol *sym;
 				RListIter *iter, *iter2;
 				RBinObject *obj = r_bin_cur_object (core->bin);
-				int idx = r_num_math (core->num, input +2);
+				int idx = r_num_math (core->num, input + 2);
 				int count = 0;
 				if (obj) {
 					if (input[2]) {
@@ -440,8 +464,8 @@ static int cmd_info(void *data, const char *input) {
 							switch (input[1]) {
 							case '*':
 								r_list_foreach (cls->methods, iter2, sym) {
-									r_cons_printf ("f sym.%s @ 0x%"PFMT64x"\n",
-											sym->name, sym->vaddr);
+									r_cons_printf ("f sym.%s @ 0x%"PFMT64x "\n",
+										sym->name, sym->vaddr);
 								}
 								input++;
 								break;
@@ -459,16 +483,16 @@ static int cmd_info(void *data, const char *input) {
 								r_cons_printf (",\"methods\":[");
 								r_list_foreach (cls->methods, iter2, sym) {
 									const char *comma = iter2->p? ",": "";
-									r_cons_printf ("%s{\"name\":\"%s\",\"vaddr\":%"PFMT64d"}",
-											comma, sym->name, sym->vaddr);
+									r_cons_printf ("%s{\"name\":\"%s\",\"vaddr\":%"PFMT64d "}",
+										comma, sym->name, sym->vaddr);
 								}
 								r_cons_printf ("]");
 								break;
 							default:
 								r_cons_printf ("class %s\n", cls->name);
 								r_list_foreach (cls->methods, iter2, sym) {
-									r_cons_printf ("0x%08"PFMT64x" method %s %s\n",
-											sym->vaddr, cls->name, sym->name);
+									r_cons_printf ("0x%08"PFMT64x " method %s %s\n",
+										sym->vaddr, cls->name, sym->name);
 								}
 								break;
 							}
@@ -498,7 +522,7 @@ static int cmd_info(void *data, const char *input) {
 			}
 			break;
 		case 'D':
-			if (input[1]!=' ' || !demangle (core, input + 2)) {
+			if (input[1] != ' ' || !demangle (core, input + 2)) {
 				eprintf ("|Usage: iD lang symbolname\n");
 			}
 			return 0;
@@ -511,7 +535,7 @@ static int cmd_info(void *data, const char *input) {
 			}
 			break;
 		case '?': {
-			const char * help_message[] = {
+			const char *help_message[] = {
 				"Usage: i", "", "Get info from opened file (see rabin2's manpage)",
 				"Output mode:", "", "",
 				"'*'", "", "Output in radare commands",
@@ -546,9 +570,9 @@ static int cmd_info(void *data, const char *input) {
 				"izz", "", "Search for Strings in the whole binary",
 				"iZ", "", "Guess size of binary program",
 				NULL
-				};
-				r_core_cmd_help (core, help_message);
-			}
+			};
+			r_core_cmd_help (core, help_message);
+		}
 			goto done;
 		case '*':
 			mode = R_CORE_BIN_RADARE;
@@ -574,8 +598,11 @@ static int cmd_info(void *data, const char *input) {
 		}
 	}
 done:
-	if (is_array)
+	if (is_array) {
 		r_cons_printf ("}\n");
-	if (newline) r_cons_newline();
+	}
+	if (newline) {
+		r_cons_newline ();
+	}
 	return 0;
 }
diff --git a/libr/core/cmd_project.c b/libr/core/cmd_project.c
index 385be1c13e..19be9c85ba 100644
--- a/libr/core/cmd_project.c
+++ b/libr/core/cmd_project.c
@@ -5,8 +5,8 @@
 #include "r_print.h"
 
 static int cmd_project(void *data, const char *input) {
-	RCore *core = (RCore *)data;
-	const char *file, *arg = (input && *input)? input+1: NULL;
+	RCore *core = (RCore *) data;
+	const char *file, *arg = (input && *input)? input + 1: NULL;
 	const char *fileproject = r_config_get (core->config, "prj.name");
 	char *str = NULL;
 
@@ -28,14 +28,14 @@ static int cmd_project(void *data, const char *input) {
 	file = arg;
 	switch (input[0]) {
 	case 'c':
-		if (input[1]==' ') {
-			r_core_project_cat (core, input+2);
+		if (input[1] == ' ') {
+			r_core_project_cat (core, input + 2);
 		} else {
 			eprintf ("Usage: Pc [prjname]\n");
 		}
 		break;
 	case 'o':
-	//	if (r_file_is_regular (file))
+		//	if (r_file_is_regular (file))
 		if (input[1] == '&') {
 			r_core_project_open (core, file, true);
 		} else if (input[1]) {
@@ -63,7 +63,7 @@ static int cmd_project(void *data, const char *input) {
 		break;
 	case 'S':
 		if (input[1] == ' ') {
-			r_core_project_save_rdb (core, input+2, R_CORE_PRJ_ALL);
+			r_core_project_save_rdb (core, input + 2, R_CORE_PRJ_ALL);
 		} else {
 			eprintf ("Usage: PS [file]\n");
 		}
@@ -71,110 +71,113 @@ static int cmd_project(void *data, const char *input) {
 	case 'n':
 		if (!fileproject || !*fileproject) {
 			eprintf ("No project\n");
-		} else
-		switch (input[1]) {
-		case '-':
-			/* remove lines containing specific words */
+		} else {
+			switch (input[1]) {
+			case '-':
+				/* remove lines containing specific words */
 			{
-			FILE *fd = r_sandbox_fopen (str, "w");
-			if (!fd) {
-				eprintf ("Cannot open %s\n", str);
-			} else {
-				char *str = r_core_project_notes_file (core, fileproject);
-				char *data = r_file_slurp (str, NULL);
-				int del = 0;
-				if (data) {
-					char *ptr, *nl;
-					for (ptr = data; ptr; ptr = nl)  {
-						nl = strchr (ptr, '\n');
-						if (nl) {
-							*nl++ = 0;
-							if (strstr (ptr, input+2))
-								del++;
-							else
-								fprintf (fd, "%s\n", ptr);
+				FILE *fd = r_sandbox_fopen (str, "w");
+				if (!fd) {
+					eprintf ("Cannot open %s\n", str);
+				} else {
+					char *str = r_core_project_notes_file (core, fileproject);
+					char *data = r_file_slurp (str, NULL);
+					int del = 0;
+					if (data) {
+						char *ptr, *nl;
+						for (ptr = data; ptr; ptr = nl)  {
+							nl = strchr (ptr, '\n');
+							if (nl) {
+								*nl++ = 0;
+								if (strstr (ptr, input + 2)) {
+									del++;
+								} else {
+									fprintf (fd, "%s\n", ptr);
+								}
+							}
 						}
+						free (data);
 					}
-					free (data);
-				}
-				if (del>0) {
-					eprintf ("Deleted %d lines\n", del);
-				}
-				free (str);
-				fclose (fd);
-			}
-			}
-			break;
-		case ' ':
-			if (input[2]=='-') {
-				char *str = r_core_project_notes_file (core, fileproject);
-				// edit with cfg.editor
-				const char *editor = r_config_get (core->config, "cfg.editor");
-				if (str && *str && editor && *editor)
-					r_sys_cmdf ("%s %s", editor, str);
-				else eprintf ("No cfg.editor configured\n");
-				free (str);
-			} else {
-				//char *str = r_core_project_notes_file (core, fileproject);
-				// append line to project notes
-				char *str = r_core_project_notes_file (core, fileproject);
-				char *data = r_file_slurp (str, NULL);
-				FILE *fd = r_sandbox_fopen (str, "a");
-				if (fd) {
-					fprintf (fd, "%s\n", input+2);
+					if (del > 0) {
+						eprintf ("Deleted %d lines\n", del);
+					}
+					free (str);
 					fclose (fd);
 				}
-				free (str);
-				free (data);
 			}
 			break;
-		case 'j':
-			if (!input[2]) {
-				int len = 0;
-				/* get base64 string */
-				char *str = r_core_project_notes_file (core, fileproject);
-				if (str) {
-					char *data = r_file_slurp (str, &len);
-					char *res = r_base64_encode_dyn (data, len);
-					if (res) {
-						r_cons_println (res);
-						free (res);
+			case ' ':
+				if (input[2] == '-') {
+					char *str = r_core_project_notes_file (core, fileproject);
+					// edit with cfg.editor
+					const char *editor = r_config_get (core->config, "cfg.editor");
+					if (str && *str && editor && *editor) {
+						r_sys_cmdf ("%s %s", editor, str);
+					} else {
+						eprintf ("No cfg.editor configured\n");
 					}
-					free (data);
 					free (str);
+				} else {
+					//char *str = r_core_project_notes_file (core, fileproject);
+					// append line to project notes
+					char *str = r_core_project_notes_file (core, fileproject);
+					char *data = r_file_slurp (str, NULL);
+					FILE *fd = r_sandbox_fopen (str, "a");
+					if (fd) {
+						fprintf (fd, "%s\n", input + 2);
+						fclose (fd);
+					}
+					free (str);
+					free (data);
 				}
-			} else if (input[2] == ' ') {
-				/* set base64 string */
-				ut8 *data = r_base64_decode_dyn (input+3, -1);
-				if (data) {
+				break;
+			case 'j':
+				if (!input[2]) {
+					int len = 0;
+					/* get base64 string */
 					char *str = r_core_project_notes_file (core, fileproject);
 					if (str) {
-						r_file_dump (str, data, strlen ((const char*)data), 0);
+						char *data = r_file_slurp (str, &len);
+						char *res = r_base64_encode_dyn (data, len);
+						if (res) {
+							r_cons_println (res);
+							free (res);
+						}
+						free (data);
 						free (str);
 					}
+				} else if (input[2] == ' ') {
+					/* set base64 string */
+					ut8 *data = r_base64_decode_dyn (input + 3, -1);
+					if (data) {
+						char *str = r_core_project_notes_file (core, fileproject);
+						if (str) {
+							r_file_dump (str, data, strlen ((const char *) data), 0);
+							free (str);
+						}
+						free (data);
+					}
+				} else {
+					eprintf ("Usage: `Pnj` or `Pnj ...`\n");
+				}
+				break;
+			case 'x':
+				r_core_project_execute_cmds (core, fileproject);
+				break;
+			case 0:
+			{
+				char *str = r_core_project_notes_file (core, fileproject);
+				char *data = r_file_slurp (str, NULL);
+				if (data) {
+					r_cons_println (data);
 					free (data);
 				}
-			} else {
-				eprintf ("Usage: `Pnj` or `Pnj ...`\n");
+				free (str);
 			}
 			break;
-		case 'x':
-			r_core_project_execute_cmds (core, fileproject);
-			break;
-		case 0:
+			case '?':
 			{
-			char *str = r_core_project_notes_file (core, fileproject);
-			char *data = r_file_slurp (str, NULL);
-			if (data) {
-				r_cons_println (data);
-				free (data);
-			}
-			free (str);
-			}
-			break;
-		case '?':
-			{
-				const char* help_msg[] = {
+				const char *help_msg[] = {
 					"Usage:", "Pn[j-?] [...]", "Project Notes",
 					"Pn", "", "show project notes",
 					"Pn", " -", "edit notes with cfg.editor",
@@ -183,10 +186,12 @@ static int cmd_project(void *data, const char *input) {
 					"Pnx", "", "run project note commands",
 					"Pnj", "", "show notes in base64",
 					"Pnj", " [base64]", "set notes in base64",
-					NULL};
+					NULL
+				};
 				r_core_cmd_help (core, help_msg);
 			}
 			break;
+			}
 		}
 		break;
 	case 'i':
@@ -197,23 +202,24 @@ static int cmd_project(void *data, const char *input) {
 		}
 		break;
 	default: {
-		const char* help_msg[] = {
-		"Usage:", "P[?osi] [file]", "Project management",
-		"Pc", " [file]", "show project script to console",
-		"Pd", " [file]", "delete project",
-		"Pi", " [file]", "show project information",
-		"Pl", "", "list all projects",
-		"Pn", "[j]", "show project notes (Pnj for json)",
-		"Pn", " [base64]", "set notes text",
-		"Pn", " -", "edit notes with cfg.editor",
-		"Po", " [file]", "open project",
-		"Ps", " [file]", "save project",
-		"PS", " [file]", "save script file",
-		"NOTE:", "", "See 'e??prj.'",
-		"NOTE:", "", "project are stored in ~/.config/radare2/projects",
-		NULL};
+		const char *help_msg[] = {
+			"Usage:", "P[?osi] [file]", "Project management",
+			"Pc", " [file]", "show project script to console",
+			"Pd", " [file]", "delete project",
+			"Pi", " [file]", "show project information",
+			"Pl", "", "list all projects",
+			"Pn", "[j]", "show project notes (Pnj for json)",
+			"Pn", " [base64]", "set notes text",
+			"Pn", " -", "edit notes with cfg.editor",
+			"Po", " [file]", "open project",
+			"Ps", " [file]", "save project",
+			"PS", " [file]", "save script file",
+			"NOTE:", "", "See 'e??prj.'",
+			"NOTE:", "", "project are stored in ~/.config/radare2/projects",
+			NULL
+		};
 		r_core_cmd_help (core, help_msg);
-		}
+	}
 		break;
 	}
 	free (str);
diff --git a/libr/core/file.c b/libr/core/file.c
old mode 100755
new mode 100644
index 02a401cd42..586a83d899
--- a/libr/core/file.c
+++ b/libr/core/file.c
@@ -4,10 +4,10 @@
 #include <stdlib.h>
 #include <string.h>
 
-#define UPDATE_TIME(a) r->times->file_open_time = r_sys_now() - a
+#define UPDATE_TIME(a) r->times->file_open_time = r_sys_now () - a
 
-static int r_core_file_do_load_for_debug (RCore *r, ut64 loadaddr, const char *filenameuri);
-static int r_core_file_do_load_for_io_plugin (RCore *r, ut64 baseaddr, ut64 loadaddr);
+static int r_core_file_do_load_for_debug(RCore *r, ut64 loadaddr, const char *filenameuri);
+static int r_core_file_do_load_for_io_plugin(RCore *r, ut64 baseaddr, ut64 loadaddr);
 
 R_API int r_core_file_reopen(RCore *core, const char *args, int perm, int loadbin) {
 	int isdebug = r_config_get_i (core->config, "cfg.debug");
@@ -15,11 +15,11 @@ R_API int r_core_file_reopen(RCore *core, const char *args, int perm, int loadbi
 	ut64 ofrom = 0, laddr = r_config_get_i (core->config, "bin.laddr");
 	RCoreFile *file = NULL;
 	RCoreFile *ofile = core->file;
-	RBinFile *bf = (ofile && ofile->desc) 
-			? r_bin_file_find_by_fd (core->bin, ofile->desc->fd) 
-			: NULL;
-	RIODesc *odesc = ofile ? ofile->desc : NULL;
-	char *ofilepath = NULL, *obinfilepath = bf ? strdup (bf->file) : NULL;
+	RBinFile *bf = (ofile && ofile->desc)
+	? r_bin_file_find_by_fd (core->bin, ofile->desc->fd)
+		: NULL;
+	RIODesc *odesc = ofile? ofile->desc: NULL;
+	char *ofilepath = NULL, *obinfilepath = bf? strdup (bf->file): NULL;
 	int newpid, ret = false;
 	ut64 origoff = core->offset;
 	if (odesc) {
@@ -41,7 +41,7 @@ R_API int r_core_file_reopen(RCore *core, const char *args, int perm, int loadbi
 		free (obinfilepath);
 		return false;
 	}
-	newpid = odesc ? odesc->fd : -1;
+	newpid = odesc? odesc->fd: -1;
 
 	if (isdebug) {
 		r_debug_kill (core->dbg, core->dbg->pid, core->dbg->tid, 9); // KILL
@@ -88,7 +88,7 @@ R_API int r_core_file_reopen(RCore *core, const char *args, int perm, int loadbi
 		}
 		ofile = NULL;
 		odesc = NULL;
-	//	core->file = file;
+		//	core->file = file;
 		eprintf ("File %s reopened in %s mode\n", path,
 			(perm & R_IO_WRITE)? "read-write": "read-only");
 
@@ -101,13 +101,13 @@ R_API int r_core_file_reopen(RCore *core, const char *args, int perm, int loadbi
 		}
 
 		if (core->bin->cur && file->desc && !loadbin) {
-		    	//force here NULL because is causing uaf look this better in future XXX @alvarofe
+			//force here NULL because is causing uaf look this better in future XXX @alvarofe
 			core->bin->cur = NULL;
 		}
 		// close old file
 	} else if (ofile) {
 		eprintf ("r_core_file_reopen: Cannot reopen file: %s with perms 0x%04x,"
-			     " attempting to open read-only.\n", path, perm);
+			" attempting to open read-only.\n", path, perm);
 		// lower it down back
 		//ofile = r_core_file_open (core, path, R_IO_READ, addr);
 		r_core_file_set_by_file (core, ofile);
@@ -137,8 +137,8 @@ R_API int r_core_file_reopen(RCore *core, const char *args, int perm, int loadbi
 		r_debug_select (core->dbg, newpid, newtid);
 	}
 	if (core->file) {
-		RCoreFile * cf = core->file;
-		RIODesc *desc = cf ? cf->desc : NULL;
+		RCoreFile *cf = core->file;
+		RIODesc *desc = cf? cf->desc: NULL;
 		if (desc) {
 #if 0
 			r_io_raise (core->io, desc->fd);
@@ -146,7 +146,7 @@ R_API int r_core_file_reopen(RCore *core, const char *args, int perm, int loadbi
 #endif
 			r_core_block_read (core);
 		} else {
-			const char *name = (cf && cf->desc) ? cf->desc->name : "ERROR";
+			const char *name = (cf && cf->desc)? cf->desc->name: "ERROR";
 			eprintf ("Error: Unable to switch the view to file: %s\n", name);
 		}
 	}
@@ -175,34 +175,34 @@ R_API int r_core_file_reopen(RCore *core, const char *args, int perm, int loadbi
 // because they can be replaced by commands in the given
 // command.. we should only expose the most essential and
 // unidirectional ones.
-R_API void r_core_sysenv_help(const RCore* core) {
-	const char* help_msg[] = {
-	"Usage:", "!<cmd>", "  Run given command as in system(3)",
-	"!", "", "list all historic commands",
-	"!", "ls", "execute 'ls' in shell",
-	"!!", "", "save command history to hist file",
-	"!!", "ls~txt", "print output of 'ls' and grep for 'txt'",
-	".!", "rabin2 -rpsei ${FILE}", "run each output line as a r2 cmd",
-	"!", "echo $SIZE", "display file size",
-	"!=!", "", "enable remotecmd mode",
-	"=!=", "", "disable remotecmd mode",
-	"\nEnvironment:", "", "",
-	"R2_FILE", "", "file name",
-	"R2_OFFSET", "", "10base offset 64bit value",
-	"R2_BYTES", "", "TODO: variable with bytes in curblock",
-	"R2_XOFFSET", "", "same as above, but in 16 base",
-	"R2_BSIZE", "", "block size",
-	"R2_ENDIAN", "", "'big' or 'little'",
-	"R2_IOVA", "", "is io.va true? virtual addressing (1,0)",
-	"R2_DEBUG", "", "debug mode enabled? (1,0)",
-	"R2_BLOCK", "", "TODO: dump current block to tmp file",
-	"R2_SIZE", "","file size",
-	"R2_ARCH", "", "value of asm.arch",
-	"R2_BITS", "", "arch reg size (8, 16, 32, 64)",
-	"RABIN2_LANG", "", "assume this lang to demangle",
-	"RABIN2_DEMANGLE", "", "demangle or not",
-	"PDB_SERVER", "", "e pdb.server",
-	NULL
+R_API void r_core_sysenv_help(const RCore *core) {
+	const char *help_msg[] = {
+		"Usage:", "!<cmd>", "  Run given command as in system(3)",
+		"!", "", "list all historic commands",
+		"!", "ls", "execute 'ls' in shell",
+		"!!", "", "save command history to hist file",
+		"!!", "ls~txt", "print output of 'ls' and grep for 'txt'",
+		".!", "rabin2 -rpsei ${FILE}", "run each output line as a r2 cmd",
+		"!", "echo $SIZE", "display file size",
+		"!=!", "", "enable remotecmd mode",
+		"=!=", "", "disable remotecmd mode",
+		"\nEnvironment:", "", "",
+		"R2_FILE", "", "file name",
+		"R2_OFFSET", "", "10base offset 64bit value",
+		"R2_BYTES", "", "TODO: variable with bytes in curblock",
+		"R2_XOFFSET", "", "same as above, but in 16 base",
+		"R2_BSIZE", "", "block size",
+		"R2_ENDIAN", "", "'big' or 'little'",
+		"R2_IOVA", "", "is io.va true? virtual addressing (1,0)",
+		"R2_DEBUG", "", "debug mode enabled? (1,0)",
+		"R2_BLOCK", "", "TODO: dump current block to tmp file",
+		"R2_SIZE", "","file size",
+		"R2_ARCH", "", "value of asm.arch",
+		"R2_BITS", "", "arch reg size (8, 16, 32, 64)",
+		"RABIN2_LANG", "", "assume this lang to demangle",
+		"RABIN2_DEMANGLE", "", "demangle or not",
+		"PDB_SERVER", "", "e pdb.server",
+		NULL
 	};
 	r_core_cmd_help (core, help_msg);
 }
@@ -224,11 +224,11 @@ R_API void r_core_sysenv_end(RCore *core, const char *cmd) {
 }
 
 #if DISCUSS
-	EDITOR   r_sys_setenv ("EDITOR", r_config_get (core->config, "cfg.editor"));
-	CURSOR   cursor position (offset from curseek)
-	VERBOSE  cfg.verbose
+EDITOR   r_sys_setenv ("EDITOR", r_config_get (core->config, "cfg.editor"));
+CURSOR cursor position (offset from curseek)
+VERBOSE cfg.verbose
 #endif
-R_API char *r_core_sysenv_begin(RCore *core, const char *cmd) {
+R_API char *r_core_sysenv_begin(RCore * core, const char *cmd) {
 	char *f, *ret = strdup (cmd);
 	if (strstr (cmd, "R2_BYTES")) {
 		char *s = r_hex_bin2strdup (core->block, core->blocksize);
@@ -239,7 +239,7 @@ R_API char *r_core_sysenv_begin(RCore *core, const char *cmd) {
 	if (core->file && core->file->desc && core->file->desc->name) {
 		r_sys_setenv ("R2_FILE", core->file->desc->name);
 		r_sys_setenv ("R2_SIZE", sdb_fmt (0, "%"PFMT64d,
-			r_io_desc_size (core->io, core->file->desc)));
+				r_io_desc_size (core->io, core->file->desc)));
 		if (strstr (cmd, "R2_BLOCK")) {
 			// replace BLOCK in RET string
 			if ((f = r_file_temp ("r2block"))) {
@@ -257,10 +257,10 @@ R_API char *r_core_sysenv_begin(RCore *core, const char *cmd) {
 	r_sys_setenv ("R2_ENDIAN", core->assembler->big_endian? "big": "little");
 	r_sys_setenv ("R2_BSIZE", sdb_fmt (0, "%d", core->blocksize));
 	r_sys_setenv ("R2_ARCH", r_config_get (core->config, "asm.arch"));
-	r_sys_setenv ("R2_BITS", sdb_fmt(0, "%d", r_config_get_i (core->config, "asm.bits")));
+	r_sys_setenv ("R2_BITS", sdb_fmt (0, "%d", r_config_get_i (core->config, "asm.bits")));
 	r_sys_setenv ("R2_COLOR", r_config_get_i (core->config, "scr.color")? "1": "0");
-	r_sys_setenv ("R2_DEBUG", r_config_get_i (core->config, "cfg.debug")?"1":"0");
-	r_sys_setenv ("R2_IOVA", r_config_get_i (core->config, "io.va")?"1":"0");
+	r_sys_setenv ("R2_DEBUG", r_config_get_i (core->config, "cfg.debug")? "1": "0");
+	r_sys_setenv ("R2_IOVA", r_config_get_i (core->config, "io.va")? "1": "0");
 	return ret;
 }
 
@@ -275,9 +275,15 @@ static ut64 get_base_from_maps(RCore *core, const char *file) {
 		if ((map->perm & 5) == 5) {
 			// TODO: make this more flexible
 			// XXX - why "copy/" here?
-			if (map->name && strstr (map->name, "copy/")) return map->addr;
-			if (map->file && !strcmp (map->file, file)) return map->addr;
-			if (map->name && !strcmp (map->name, file)) return map->addr;
+			if (map->name && strstr (map->name, "copy/")) {
+				return map->addr;
+			}
+			if (map->file && !strcmp (map->file, file)) {
+				return map->addr;
+			}
+			if (map->name && !strcmp (map->name, file)) {
+				return map->addr;
+			}
 			// XXX - Commented out, as this could unexpected results
 			//b = map->addr;
 		}
@@ -296,7 +302,7 @@ static ut64 get_base_from_maps(RCore *core, const char *file) {
 R_API int r_core_bin_reload(RCore *r, const char *file, ut64 baseaddr) {
 	int result = 0;
 	RCoreFile *cf = r_core_file_cur (r);
-	RIODesc *desc = cf ? cf->desc : NULL;
+	RIODesc *desc = cf? cf->desc: NULL;
 	RBinFile *bf = NULL;
 	if (desc) {
 		result = r_bin_reload (r->bin, desc, baseaddr);
@@ -309,7 +315,9 @@ R_API int r_core_bin_reload(RCore *r, const char *file, ut64 baseaddr) {
 static bool setbpint(RCore *r, const char *mode, const char *sym) {
 	RBreakpointItem *bp;
 	RFlagItem *fi = r_flag_get (r->flags, sym);
-	if (!fi) return false;
+	if (!fi) {
+		return false;
+	}
 	bp = r_bp_add_sw (r->dbg->bp, fi->offset, 1, R_BP_PROT_EXEC);
 	if (bp) {
 		bp->internal = true;
@@ -325,9 +333,9 @@ static bool setbpint(RCore *r, const char *mode, const char *sym) {
 }
 
 // XXX - need to handle index selection during debugging
-static int r_core_file_do_load_for_debug (RCore *r, ut64 baseaddr, const char *filenameuri) {
+static int r_core_file_do_load_for_debug(RCore *r, ut64 baseaddr, const char *filenameuri) {
 	RCoreFile *cf = r_core_file_cur (r);
-	RIODesc *desc = cf ? cf->desc : NULL;
+	RIODesc *desc = cf? cf->desc: NULL;
 	RBinFile *binfile = NULL;
 	RBinPlugin *plugin;
 	int xtr_idx = 0; // if 0, load all if xtr is used
@@ -394,7 +402,7 @@ static int r_core_file_do_load_for_debug (RCore *r, ut64 baseaddr, const char *f
 		r->bin->maxstrbuf = r_config_get_i (r->config, "bin.maxstrbuf");
 	} else if (binfile) {
 		RBinObject *obj = r_bin_get_object (r->bin);
-		RBinInfo * info = obj ? obj->info : NULL;
+		RBinInfo *info = obj? obj->info: NULL;
 		if (plugin && strcmp (plugin->name, "any") && info) {
 			r_core_bin_set_arch_bits (r, binfile->file, info->arch, info->bits);
 		}
@@ -408,10 +416,10 @@ static int r_core_file_do_load_for_debug (RCore *r, ut64 baseaddr, const char *f
 
 static int r_core_file_do_load_for_io_plugin(RCore *r, ut64 baseaddr, ut64 loadaddr) {
 	RCoreFile *cf = r_core_file_cur (r);
-	RIODesc *desc = cf ? cf->desc : NULL;
+	RIODesc *desc = cf? cf->desc: NULL;
 	RBinFile *binfile = NULL;
 	int xtr_idx = 0; // if 0, load all if xtr is used
-	RBinPlugin * plugin;
+	RBinPlugin *plugin;
 
 	if (!desc) {
 		return false;
@@ -425,9 +433,9 @@ static int r_core_file_do_load_for_io_plugin(RCore *r, ut64 baseaddr, ut64 loada
 	binfile = r_bin_cur (r->bin);
 	r_core_bin_set_env (r, binfile);
 	plugin = r_bin_file_cur_plugin (binfile);
-	if (plugin && !strcmp (plugin->name, "any") ) {
+	if (plugin && !strcmp (plugin->name, "any")) {
 		RBinObject *obj = r_bin_get_object (r->bin);
-		RBinInfo * info = obj ? obj->info : NULL;
+		RBinInfo *info = obj? obj->info: NULL;
 		if (!info) {
 			return false;
 		}
@@ -440,7 +448,7 @@ static int r_core_file_do_load_for_io_plugin(RCore *r, ut64 baseaddr, ut64 loada
 		r->bin->maxstrbuf = r_config_get_i (r->config, "bin.maxstrbuf");
 	} else if (binfile) {
 		RBinObject *obj = r_bin_get_object (r->bin);
-		RBinInfo * info = obj ? obj->info : NULL;
+		RBinInfo *info = obj? obj->info: NULL;
 		if (!info) {
 			return false;
 		}
@@ -474,7 +482,7 @@ R_API bool r_core_file_loadlib(RCore *core, const char *lib, ut64 libaddr) {
 		"./",
 		NULL
 	};
-	const char **libpath = (const char **)&ldlibrarypath;
+	const char * *libpath = (const char * *) &ldlibrarypath;
 
 	if (*lib == '/') {
 		if (try_loadlib (core, lib, libaddr)) {
@@ -501,7 +509,7 @@ R_API int r_core_bin_load(RCore *r, const char *filenameuri, ut64 baddr) {
 	const char *suppress_warning = r_config_get (r->config, "file.nowarn");
 	RCoreFile *cf = r_core_file_cur (r);
 	RBinFile *binfile = NULL;
-	RIODesc *desc = cf ? cf->desc : NULL;
+	RIODesc *desc = cf? cf->desc: NULL;
 	RBinPlugin *plugin = NULL;
 	int is_io_load;
 	// NULL deref guard
@@ -521,7 +529,7 @@ R_API int r_core_bin_load(RCore *r, const char *filenameuri, ut64 baddr) {
 			// new RCoreFile * should be opened.
 			if (!strcmp (suppress_warning, "false")) {
 				eprintf ("Error: The filenameuri '%s' is not the same as in RCoreFile: %s\n",
-				    filenameuri, cf->desc->name);
+					filenameuri, cf->desc->name);
 			}
 		}
 	}
@@ -568,12 +576,13 @@ R_API int r_core_bin_load(RCore *r, const char *filenameuri, ut64 baddr) {
 		r->bin->maxstrbuf = r_config_get_i (r->config, "bin.maxstrbuf");
 	} else if (binfile) {
 		RBinObject *obj = r_bin_get_object (r->bin);
-		RBinInfo * info = obj ? obj->info : NULL;
-		if (plugin && plugin->name && info)
+		RBinInfo *info = obj? obj->info: NULL;
+		if (plugin && plugin->name && info) {
 			if (strcmp (plugin->name, "any")) {
 				r_core_bin_set_arch_bits (r, binfile->file,
 					info->arch, info->bits);
 			}
+		}
 	}
 	if (plugin && plugin->name && !strcmp (plugin->name, "dex")) {
 		r_core_cmd0 (r, "\"(fix-dex,wx `#sha1 $s-32 @32` @12 ;"
@@ -587,9 +596,7 @@ R_API int r_core_bin_load(RCore *r, const char *filenameuri, ut64 baddr) {
 		}
 	}
 	if (r_config_get_i (r->config, "bin.libs")) {
-		ut64 libaddr = (r->assembler->bits == 64)
-			? 0x00007fff00000000LL
-			: 0x7f000000;
+		ut64 libaddr = (r->assembler->bits == 64)? 0x00007fff00000000LL: 0x7f000000;
 		const char *lib;
 		RListIter *iter;
 		RList *libs = r_bin_get_libs (r->bin);
@@ -602,26 +609,31 @@ R_API int r_core_bin_load(RCore *r, const char *filenameuri, ut64 baddr) {
 	return true;
 }
 
-R_API RIOMap *r_core_file_get_next_map (RCore *core, RCoreFile * fh, int mode, ut64 loadaddr) {
+R_API RIOMap *r_core_file_get_next_map(RCore *core, RCoreFile *fh, int mode, ut64 loadaddr) {
 	const char *loadmethod = r_config_get (core->config, "file.loadmethod");
 	const char *suppress_warning = r_config_get (core->config, "file.nowarn");
 	ut64 load_align = r_config_get_i (core->config, "file.loadalign");
-	if (!loadmethod || !suppress_warning) return NULL;
+	if (!loadmethod || !suppress_warning) {
+		return NULL;
+	}
 	RIOMap *map = NULL;
-	if (!strcmp (loadmethod, "overwrite"))
+	if (!strcmp (loadmethod, "overwrite")) {
 		map = r_io_map_new (core->io, fh->desc->fd, mode, 0, loadaddr, r_io_desc_size (core->io, fh->desc));
-	if (!strcmp (loadmethod, "fail"))
+	}
+	if (!strcmp (loadmethod, "fail")) {
 		map = r_io_map_add (core->io, fh->desc->fd, mode, 0, loadaddr, r_io_desc_size (core->io, fh->desc));
+	}
 	if (!strcmp (loadmethod, "append") && load_align) {
 		map = r_io_map_add_next_available (core->io, fh->desc->fd, mode, 0, loadaddr, r_io_desc_size (core->io, fh->desc), load_align);
 	}
 	if (!strcmp (suppress_warning, "false")) {
 		if (!map) {
-			eprintf ("r_core_file_get_next_map: Unable to load specified file to 0x%08"PFMT64x"\n", loadaddr);
+			eprintf ("r_core_file_get_next_map: Unable to load specified file to 0x%08"PFMT64x "\n", loadaddr);
 		} else {
-			if (map->from != loadaddr)
-				eprintf ("r_core_file_get_next_map: Unable to load specified file to 0x%08"PFMT64x",\n"
-					 "but loaded to 0x%08"PFMT64x"\n", loadaddr, map->from);
+			if (map->from != loadaddr) {
+				eprintf ("r_core_file_get_next_map: Unable to load specified file to 0x%08"PFMT64x ",\n"
+					"but loaded to 0x%08"PFMT64x "\n", loadaddr, map->from);
+			}
 		}
 	}
 	r_io_sort_maps (core->io); //necessary ???
@@ -642,13 +654,15 @@ R_API RCoreFile *r_core_file_open_many(RCore *r, const char *file, int flags, ut
 
 	list_fds = r_io_open_many (r->io, file, flags, 0644);
 
-	if (!list_fds || r_list_length (list_fds) == 0 ) {
+	if (!list_fds || r_list_length (list_fds) == 0) {
 		r_list_free (list_fds);
 		return NULL;
 	}
 
 	cp = r_config_get (r->config, "file.loadmethod");
-	if (cp) loadmethod = strdup (cp);
+	if (cp) {
+		loadmethod = strdup (cp);
+	}
 	r_config_set (r->config, "file.loadmethod", "append");
 
 	r_list_foreach_safe (list_fds, fd_iter, iter2, fd) {
@@ -686,7 +700,7 @@ R_API RCoreFile *r_core_file_open_many(RCore *r, const char *file, int flags, ut
 		if (!top_file) {
 			top_file = fh;
 			// check load addr to make sure its still valid
-			loadaddr =  top_file->map->from;
+			loadaddr = top_file->map->from;
 		}
 		r_bin_bind (r->bin, &(fh->binb));
 		r_list_append (r->files, fh);
@@ -703,7 +717,9 @@ R_API RCoreFile *r_core_file_open_many(RCore *r, const char *file, int flags, ut
 
 	r_config_set (r->config, "file.path", r_file_abspath (top_file->desc->name));
 	r_config_set_i (r->config, "zoom.to", top_file->map->from + r_io_desc_size (r->io, top_file->desc));
-	if (loadmethod) r_config_set (r->config, "file.loadmethod", loadmethod);
+	if (loadmethod) {
+		r_config_set (r->config, "file.loadmethod", loadmethod);
+	}
 	free (loadmethod);
 
 	return top_file;
@@ -711,7 +727,7 @@ R_API RCoreFile *r_core_file_open_many(RCore *r, const char *file, int flags, ut
 
 /* loadaddr is r2 -m (mapaddr) */
 R_API RCoreFile *r_core_file_open(RCore *r, const char *file, int flags, ut64 loadaddr) {
-	ut64 prev = r_sys_now();
+	ut64 prev = r_sys_now ();
 	const char *suppress_warning = r_config_get (r->config, "file.nowarn");
 	const int openmany = r_config_get_i (r->config, "file.openmany");
 	const char *cp;
@@ -794,7 +810,7 @@ R_API RCoreFile *r_core_file_open(RCore *r, const char *file, int flags, ut64 lo
 		r_config_set_i (r->config, "dbg.swstep", swstep);
 	}
 beach:
-	r->times->file_open_time = r_sys_now() - prev;
+	r->times->file_open_time = r_sys_now () - prev;
 	return fh;
 }
 
@@ -818,7 +834,7 @@ R_API void r_core_file_free(RCoreFile *cf) {
 		// double free libr/io/io.c:70 performs free
 		RIO *io = NULL;
 		if (cf) {
-			io = (RIO*)(cf->desc ? cf->desc->io : NULL);
+			io = (RIO *) (cf->desc? cf->desc->io: NULL);
 			if (cf->map) {
 				r_io_map_del (io, cf->map->fd);
 				cf->map = NULL;
@@ -833,8 +849,8 @@ R_API void r_core_file_free(RCoreFile *cf) {
 
 R_API int r_core_file_close(RCore *r, RCoreFile *fh) {
 	int ret;
-	RIODesc *desc = fh && fh->desc? fh->desc : NULL;
-	RCoreFile *prev_cf = r && r->file != fh ? r->file : NULL;
+	RIODesc *desc = fh && fh->desc? fh->desc: NULL;
+	RCoreFile *prev_cf = r && r->file != fh? r->file: NULL;
 
 	// TODO: This is not correclty done. because map and iodesc are
 	// still referenced // we need to fully clear all R_IO structs
@@ -846,10 +862,13 @@ R_API int r_core_file_close(RCore *r, RCoreFile *fh) {
 	// fh in the r->files list, we are hosed. (design flaw)
 	// TODO maybe using sdb to keep track of the allocated and
 	// deallocated files might be a good solutions
-	if (!r || !desc || r_list_empty (r->files))
+	if (!r || !desc || r_list_empty (r->files)) {
 		return false;
+	}
 
-	if (fh == r->file) r->file = NULL;
+	if (fh == r->file) {
+		r->file = NULL;
+	}
 
 	r_core_file_set_by_fd (r, fh->desc->fd);
 	r_core_bin_set_by_fd (r, fh->desc->fd);
@@ -862,13 +881,15 @@ R_API int r_core_file_close(RCore *r, RCoreFile *fh) {
 
 	ret = r_list_delete_data (r->files, fh);
 	if (ret) {
-		if (!prev_cf && r_list_length (r->files) > 0)
+		if (!prev_cf && r_list_length (r->files) > 0) {
 			prev_cf = (RCoreFile *) r_list_get_n (r->files, 0);
+		}
 
 		if (prev_cf) {
 			RIODesc *desc = prev_cf->desc;
-			if (!desc)
+			if (!desc) {
 				eprintf ("Error: RCoreFile's found with out a supporting RIODesc.\n");
+			}
 			ret = r_core_file_set_by_file (r, prev_cf);
 		}
 	}
@@ -918,56 +939,60 @@ R_API int r_core_file_list(RCore *core, int mode) {
 		switch (mode) {
 		case 'j':
 			r_cons_printf ("{\"raised\":%s,\"fd\":%d,\"uri\":\"%s\",\"from\":%"
-				PFMT64d",\"writable\":%s,\"size\":%d,\"overlaps\":%s}%s",
-				core->io->raised == f->desc->fd?"true":"false",
-				(int)f->desc->fd, f->desc->uri, (ut64)from,
+				PFMT64d ",\"writable\":%s,\"size\":%d,\"overlaps\":%s}%s",
+				core->io->raised == f->desc->fd? "true": "false",
+				(int) f->desc->fd, f->desc->uri, (ut64) from,
 				f->desc->flags & R_IO_WRITE? "true": "false",
-				(int)r_io_desc_size (core->io, f->desc),
-				overlapped?"true":"false",
-				iter->n? ",":"");
+				(int) r_io_desc_size (core->io, f->desc),
+				overlapped? "true": "false",
+				iter->n? ",": "");
 			break;
 		case '*':
 		case 'r':
-			r_cons_printf ("o %s 0x%"PFMT64x"\n", f->desc->uri, (ut64)from);
+			r_cons_printf ("o %s 0x%"PFMT64x "\n", f->desc->uri, (ut64) from);
 			break;
 		default:
-			{
+		{
 			ut64 sz = r_io_desc_size (core->io, f->desc);
 			const char *fmt;
 			if (sz == UT64_MAX) {
-				fmt = "%c %d %d %s @ 0x%"PFMT64x" ; %s size=%"PFMT64d" %s\n";
+				fmt = "%c %d %d %s @ 0x%"PFMT64x " ; %s size=%"PFMT64d " %s\n";
 			} else {
-				fmt = "%c %d %d %s @ 0x%"PFMT64x" ; %s size=%"PFMT64u" %s\n";
+				fmt = "%c %d %d %s @ 0x%"PFMT64x " ; %s size=%"PFMT64u " %s\n";
 			}
 			r_cons_printf (fmt,
-					core->io->raised == f->desc->fd?'*':'-',
-					count,
-					(int)f->desc->fd, f->desc->uri, (ut64)from,
-					f->desc->flags & R_IO_WRITE? "rw": "r",
-					r_io_desc_size (core->io, f->desc),
-					overlapped?"overlaps":"");
-			}
-			break;
+				core->io->raised == f->desc->fd? '*': '-',
+				count,
+				(int) f->desc->fd, f->desc->uri, (ut64) from,
+				f->desc->flags & R_IO_WRITE? "rw": "r",
+				r_io_desc_size (core->io, f->desc),
+				overlapped? "overlaps": "");
+		}
+		break;
 		}
 		count++;
 	}
-	if (mode=='j') {
+	if (mode == 'j') {
 		r_cons_printf ("]\n");
 	}
 	return count;
 }
 
 // XXX - needs to account for binfile index and bin object index
-R_API int r_core_file_bin_raise (RCore *core, ut32 binfile_idx) {
+R_API int r_core_file_bin_raise(RCore *core, ut32 binfile_idx) {
 	RBin *bin = core->bin;
-	int v = binfile_idx > 1 ? binfile_idx : 1;
+	int v = binfile_idx > 1? binfile_idx: 1;
 	RBinFile *bf = r_list_get_n (bin->binfiles, v);
 	int res = false;
 	if (bf) {
 		res = r_bin_file_set_cur_binfile (bin, bf);
-		if (res) r_io_raise (core->io, bf->fd);
-		res = res ? r_core_file_set_by_fd (core, bf->fd) : res;
-		if (res) core->switch_file_view = 1;
+		if (res) {
+			r_io_raise (core->io, bf->fd);
+		}
+		res = res? r_core_file_set_by_fd (core, bf->fd): res;
+		if (res) {
+			core->switch_file_view = 1;
+		}
 	}
 	return res;
 }
@@ -978,7 +1003,7 @@ R_API int r_core_file_binlist(RCore *core) {
 	RCoreFile *cur_cf = core->file, *cf = NULL;
 	RBinFile *binfile = NULL;
 	RBin *bin = core->bin;
-	const RList *binfiles = bin ? bin->binfiles: NULL;
+	const RList *binfiles = bin? bin->binfiles: NULL;
 
 	if (!binfiles) {
 		return false;
@@ -987,8 +1012,8 @@ R_API int r_core_file_binlist(RCore *core) {
 		int fd = binfile->fd;
 		cf = r_core_file_get_by_fd (core, fd);
 		if (cf && cf->map) {
-			r_cons_printf ("%c %d %s @ 0x%"PFMT64x" ; %s\n",
-				core->io->raised == cf->desc->fd?'*':'-',
+			r_cons_printf ("%c %d %s @ 0x%"PFMT64x " ; %s\n",
+				core->io->raised == cf->desc->fd? '*': '-',
 				fd, cf->desc->uri, cf->map->from,
 				cf->desc->flags & R_IO_WRITE? "rw": "r");
 		}
@@ -1008,8 +1033,9 @@ R_API int r_core_file_close_fd(RCore *core, int fd) {
 				core->file = NULL; // deref
 			}
 #if 0
-			if (r_list_empty (core->files))
+			if (r_list_empty (core->files)) {
 				core->file = NULL;
+			}
 #endif
 			return true;
 		}
@@ -1037,7 +1063,7 @@ R_API int r_core_hash_load(RCore *r, const char *file) {
 	if (cf && r_io_desc_size (r->io, cf->desc) > limit) {
 		return false;
 	}
-	buf = (ut8*)r_file_slurp (file, &buf_len);
+	buf = (ut8 *) r_file_slurp (file, &buf_len);
 	if (!buf) {
 		return false;
 	}
@@ -1065,7 +1091,7 @@ R_API int r_core_hash_load(RCore *r, const char *file) {
 	return true;
 }
 
-R_API RCoreFile * r_core_file_find_by_fd (RCore *core, ut64 fd) {
+R_API RCoreFile *r_core_file_find_by_fd(RCore *core, ut64 fd) {
 	RListIter *iter;
 	RCoreFile *cf = NULL;
 	r_list_foreach (core->files, iter, cf) {
@@ -1077,7 +1103,7 @@ R_API RCoreFile * r_core_file_find_by_fd (RCore *core, ut64 fd) {
 	return cf;
 }
 
-R_API RCoreFile * r_core_file_find_by_name (RCore * core, const char * name) {
+R_API RCoreFile *r_core_file_find_by_name(RCore *core, const char *name) {
 	RListIter *iter;
 	RCoreFile *cf = NULL;
 
@@ -1090,20 +1116,20 @@ R_API RCoreFile * r_core_file_find_by_name (RCore * core, const char * name) {
 	return cf;
 }
 
-R_API int r_core_file_set_by_fd (RCore * core, ut64 fd) {
+R_API int r_core_file_set_by_fd(RCore *core, ut64 fd) {
 	RCoreFile *cf = r_core_file_find_by_fd (core, fd);
 	return r_core_file_set_by_file (core, cf);
 }
 
-R_API int r_core_file_set_by_name (RCore * core, const char * name) {
+R_API int r_core_file_set_by_name(RCore *core, const char *name) {
 	RCoreFile *cf = r_core_file_find_by_name (core, name);
 	return r_core_file_set_by_file (core, cf);
 }
 
-R_API int r_core_file_set_by_file (RCore * core, RCoreFile *cf) {
+R_API int r_core_file_set_by_file(RCore *core, RCoreFile *cf) {
 	if (cf) {
 		RIODesc *desc = cf->desc;
-		core->offset = cf && cf->map ? cf->map->from : 0LL;
+		core->offset = cf && cf->map? cf->map->from: 0LL;
 		core->file = cf;
 		if (desc) {
 			r_io_use_desc (core->io, desc);
@@ -1114,15 +1140,15 @@ R_API int r_core_file_set_by_file (RCore * core, RCoreFile *cf) {
 	return false;
 }
 
-R_API ut32 r_core_file_cur_fd (RCore *core) {
-	RIODesc *desc = core->file ? core->file->desc : NULL;
+R_API ut32 r_core_file_cur_fd(RCore *core) {
+	RIODesc *desc = core->file? core->file->desc: NULL;
 	if (desc) {
 		return desc->fd;
 	}
 	return UT32_MAX;
 }
 
-R_API RCoreFile * r_core_file_cur (RCore *r) {
+R_API RCoreFile *r_core_file_cur(RCore *r) {
 	// Add any locks here
 	return r->file;
 }
diff --git a/libr/core/graph.c b/libr/core/graph.c
index 54b1fc24d6..7ea036434f 100644
--- a/libr/core/graph.c
+++ b/libr/core/graph.c
@@ -27,7 +27,7 @@ static const char *mousemodes[] = {
 #define MIN_NODE_HEIGHT BORDER_HEIGHT
 #define TITLE_LEN 128
 #define DEFAULT_SPEED 1
-#define PAGEKEY_SPEED (h/2)
+#define PAGEKEY_SPEED (h / 2)
 /* 15 */
 #define SMALLNODE_TEXT_CUR "<@@@@@@>"
 #define SMALLNODE_MIN_WIDTH 8
@@ -37,19 +37,19 @@ static const char *mousemodes[] = {
 #define ZOOM_STEP 10
 #define ZOOM_DEFAULT 100
 
-#define BODY_OFFSETS	0x1
-#define BODY_SUMMARY	0x2
+#define BODY_OFFSETS    0x1
+#define BODY_SUMMARY    0x2
 
-#define hash_set(sdb,k,v) (sdb_num_set (sdb, sdb_fmt (0, "%"PFMT64u, (ut64)(size_t)k), (ut64)(size_t)v, 0))
-#define hash_get(sdb,k) (sdb_num_get (sdb, sdb_fmt (0, "%"PFMT64u, (ut64)(size_t)k), NULL))
-#define hash_get_rnode(sdb,k) ((RGraphNode *)(size_t)hash_get (sdb, k))
-#define hash_get_rlist(sdb,k) ((RList *)(size_t)hash_get (sdb, k))
-#define hash_get_int(sdb,k) ((int)hash_get (sdb, k))
+#define hash_set(sdb,k,v) (sdb_num_set (sdb, sdb_fmt (0, "%"PFMT64u, (ut64) (size_t) k), (ut64) (size_t) v, 0))
+#define hash_get(sdb,k) (sdb_num_get (sdb, sdb_fmt (0, "%"PFMT64u, (ut64) (size_t) k), NULL))
+#define hash_get_rnode(sdb,k) ((RGraphNode *) (size_t) hash_get (sdb, k))
+#define hash_get_rlist(sdb,k) ((RList *) (size_t) hash_get (sdb, k))
+#define hash_get_int(sdb,k) ((int) hash_get (sdb, k))
 /* dont use macros for this */
-#define get_anode(gn) (gn ? (RANode *)gn->data : NULL)
+#define get_anode(gn) (gn? (RANode *) gn->data: NULL)
 
-#define graph_foreach_anode(list, it, pos, anode) \
-	if (list) for (it = list->head; it && (pos = it->data) && (pos) && (anode = (RANode *)pos->data); it = it->n)
+#define graph_foreach_anode(list, it, pos, anode)\
+	if (list) for (it = list->head; it && (pos = it->data) && (pos) && (anode = (RANode *) pos->data); it = it->n)
 
 struct len_pos_t {
 	int len;
@@ -78,7 +78,7 @@ typedef struct ascii_edge_t {
 
 struct layer_t {
 	int n_nodes;
-	RGraphNode **nodes;
+	RGraphNode * *nodes;
 	int position;
 	int height;
 	int width;
@@ -87,16 +87,16 @@ struct layer_t {
 struct agraph_refresh_data {
 	RCore *core;
 	RAGraph *g;
-	RAnalFunction **fcn;
+	RAnalFunction * *fcn;
 	int fs;
 };
 
 #define G(x,y) r_cons_canvas_gotoxy (g->can, x, y)
 #define W(x) r_cons_canvas_write (g->can, x)
-#define B(x,y,w,h) r_cons_canvas_box(g->can, x,y,w,h, g->color_box)
-#define B1(x,y,w,h) r_cons_canvas_box(g->can, x,y,w,h, g->color_box2)
-#define B2(x,y,w,h) r_cons_canvas_box(g->can, x,y,w,h, g->color_box3)
-#define F(x,y,x2,y2,c) r_cons_canvas_fill(g->can, x,y,x2,y2,c,0)
+#define B(x,y,w,h) r_cons_canvas_box (g->can, x,y,w,h, g->color_box)
+#define B1(x,y,w,h) r_cons_canvas_box (g->can, x,y,w,h, g->color_box2)
+#define B2(x,y,w,h) r_cons_canvas_box (g->can, x,y,w,h, g->color_box3)
+#define F(x,y,x2,y2,c) r_cons_canvas_fill (g->can, x,y,x2,y2,c,0)
 
 static bool is_offset(const RAGraph *g) {
 	return g->mode == R_AGRAPH_MODE_OFFSET;
@@ -122,23 +122,32 @@ static const char *mode2str(const RAGraph *g, const char *prefix) {
 	static char m[20];
 	const char *submode;
 
-	if (is_mini (g)) submode = "SMALL";
-	else if (is_offset (g)) submode = "OFF";
-	else if (is_summary (g)) submode = "SUMM";
-	else submode = "NORM";
+	if (is_mini (g)) {
+		submode = "SMALL";
+	} else if (is_offset (g)) {
+		submode = "OFF";
+	} else if (is_summary (g)) {
+		submode = "SUMM";
+	} else {
+		submode = "NORM";
+	}
 
-	snprintf(m, sizeof (m), "%s-%s", prefix, submode);
+	snprintf (m, sizeof (m), "%s-%s", prefix, submode);
 	return m;
 }
 
 static int mode2opts(const RAGraph *g) {
 	int opts = 0;
-	if (is_offset (g)) opts |= BODY_OFFSETS;
-	if (is_summary (g)) opts |= BODY_SUMMARY;
+	if (is_offset (g)) {
+		opts |= BODY_OFFSETS;
+	}
+	if (is_summary (g)) {
+		opts |= BODY_SUMMARY;
+	}
 	return opts;
 }
 
-static char *get_title (ut64 addr) {
+static char *get_title(ut64 addr) {
 	return r_str_newf ("0x%"PFMT64x, addr);
 }
 
@@ -156,7 +165,7 @@ static void update_node_dimension(const RGraph *g, int is_small, int zoom) {
 			n->w = SMALLNODE_MIN_WIDTH;
 		} else {
 			unsigned int len;
-			n->w = r_str_bounds (n->body, (int *)&n->h);
+			n->w = r_str_bounds (n->body, (int *) &n->h);
 			len = strlen (n->title) + MARGIN_TEXT_X;
 			if (len > INT_MAX) {
 				len = INT_MAX;
@@ -179,7 +188,9 @@ static void small_RANode_print(const RAGraph *g, const RANode *n, int cur) {
 	int x, delta_x = 0;
 
 	if (!G (n->x + SMALLNODE_CENTER_X, n->y) &&
-		!G (n->x + SMALLNODE_CENTER_X + n->w, n->y)) return;
+	!G (n->x + SMALLNODE_CENTER_X + n->w, n->y)) {
+		return;
+	}
 
 	x = n->x + SMALLNODE_CENTER_X + g->can->sx;
 	if (x < 0) {
@@ -188,12 +199,12 @@ static void small_RANode_print(const RAGraph *g, const RANode *n, int cur) {
 	G (n->x + SMALLNODE_CENTER_X + delta_x, n->y);
 
 	if (cur) {
-		W(&SMALLNODE_TEXT_CUR[delta_x]);
-		(void)G (-g->can->sx, -g->can->sy + 2);
+		W (&SMALLNODE_TEXT_CUR[delta_x]);
+		(void) G (-g->can->sx, -g->can->sy + 2);
 		snprintf (title, sizeof (title) - 1,
-				"%s:", n->title);
+			"%s:", n->title);
 		W (title);
-		(void)G (-g->can->sx, -g->can->sy + 3);
+		(void) G (-g->can->sx, -g->can->sy + 3);
 		W (n->body);
 	} else {
 		char *str = "____";
@@ -206,7 +217,7 @@ static void small_RANode_print(const RAGraph *g, const RANode *n, int cur) {
 			}
 		}
 		snprintf (title, sizeof (title) - 1, "[_%s_]", str);
-		W(title + delta_x);
+		W (title + delta_x);
 	}
 	return;
 }
@@ -216,23 +227,27 @@ static void mini_RANode_print(const RAGraph *g, const RANode *n, int cur) {
 	int x, delta_x = 0;
 
 	if (!G (n->x + SMALLNODE_CENTER_X, n->y) &&
-		!G (n->x + SMALLNODE_CENTER_X + n->w, n->y)) return;
+	!G (n->x + SMALLNODE_CENTER_X + n->w, n->y)) {
+		return;
+	}
 
 	x = n->x + SMALLNODE_CENTER_X + g->can->sx;
 	if (x < 0) {
 		delta_x = -x;
 	}
-	if (!G (n->x + SMALLNODE_CENTER_X + delta_x, n->y)) return;
+	if (!G (n->x + SMALLNODE_CENTER_X + delta_x, n->y)) {
+		return;
+	}
 
 	if (cur) {
-		W(&SMALLNODE_TEXT_CUR[delta_x]);
+		W (&SMALLNODE_TEXT_CUR[delta_x]);
 		snprintf (title, sizeof (title) - 1,
-				"[ %s ]", n->title);
+			"[ %s ]", n->title);
 		W (title);
 	} else {
-		W(&SMALLNODE_TEXT_CUR[delta_x]);
+		W (&SMALLNODE_TEXT_CUR[delta_x]);
 		snprintf (title, sizeof (title) - 1,
-				"  %s  ", n->title);
+			"  %s  ", n->title);
 		W (title);
 	}
 	return;
@@ -261,16 +276,16 @@ static void normal_RANode_print(const RAGraph *g, const RANode *n, int cur) {
 	shortcut = sdb_get (g->db, sdb_fmt (2, "agraph.nodes.%s.shortcut", n->title), 0);
 	/* print the title */
 	if (cur) {
-		snprintf (title, sizeof (title)-1, "[%s]", n->title);
+		snprintf (title, sizeof (title) - 1, "[%s]", n->title);
 	} else {
-		snprintf (title, sizeof (title)-1, " %s", n->title);
+		snprintf (title, sizeof (title) - 1, " %s", n->title);
 	}
 	if (shortcut) {
 		strncat (title, sdb_fmt (2, " ;[%s]", shortcut), sizeof (title) - strlen (title) - 1);
 		free (shortcut);
 	}
-	if ((delta_x < strlen (title)) && G(n->x + MARGIN_TEXT_X + delta_x, n->y + 1)) {
-		W(title + delta_x);
+	if ((delta_x < strlen (title)) && G (n->x + MARGIN_TEXT_X + delta_x, n->y + 1)) {
+		W (title + delta_x);
 	}
 
 	/* print the body */
@@ -281,18 +296,20 @@ static void normal_RANode_print(const RAGraph *g, const RANode *n, int cur) {
 		delta_txt_y = R_MIN (delta_y, center_y);
 	}
 
-	if (G(n->x + MARGIN_TEXT_X + delta_x + center_x - delta_txt_x,
-			n->y + MARGIN_TEXT_Y + delta_y + center_y - delta_txt_y)) {
-		unsigned int body_x = center_x >= delta_x ? 0 : delta_x - center_x;
-		unsigned int body_y = center_y >= delta_y ? 0 : delta_y - center_y;
-		unsigned int body_h = BORDER_HEIGHT >= n->h ? 1 : n->h - BORDER_HEIGHT;
+	if (G (n->x + MARGIN_TEXT_X + delta_x + center_x - delta_txt_x,
+		n->y + MARGIN_TEXT_Y + delta_y + center_y - delta_txt_y)) {
+		unsigned int body_x = center_x >= delta_x? 0: delta_x - center_x;
+		unsigned int body_y = center_y >= delta_y? 0: delta_y - center_y;
+		unsigned int body_h = BORDER_HEIGHT >= n->h? 1: n->h - BORDER_HEIGHT;
 
-		if (g->zoom < ZOOM_DEFAULT) body_h--;
+		if (g->zoom < ZOOM_DEFAULT) {
+			body_h--;
+		}
 		if (body_y + 1 <= body_h) {
 			body = r_str_ansi_crop (n->body,
-					body_x, body_y,
-					n->w - BORDER_WIDTH,
-					body_h);
+				body_x, body_y,
+				n->w - BORDER_WIDTH,
+				body_h);
 			if (body) {
 				W (body);
 				if (g->zoom < ZOOM_DEFAULT) {
@@ -322,11 +339,11 @@ static void normal_RANode_print(const RAGraph *g, const RANode *n, int cur) {
 	}
 }
 
-static int **get_crossing_matrix (const RGraph *g,
-		const struct layer_t layers[],
-		int maxlayer, int i, int from_up,
-		int *n_rows) {
-	int j, **m, len = layers[i].n_nodes;
+static int **get_crossing_matrix(const RGraph *g,
+                                  const struct layer_t layers[],
+                                  int maxlayer, int i, int from_up,
+                                  int *n_rows) {
+	int j, * *m, len = layers[i].n_nodes;
 
 	m = R_NEWS0 (int *, len);
 	if (!m) {
@@ -369,7 +386,7 @@ static int **get_crossing_matrix (const RGraph *g,
 						at = get_anode (gt);
 						if (ak->layer != i || at->layer != i) {
 							// this should never happen
-							eprintf("(WARNING) \"%s\" (%d) or \"%s\" (%d) are not on the right layer (%d)\n",
+							eprintf ("(WARNING) \"%s\" (%d) or \"%s\" (%d) are not on the right layer (%d)\n",
 								ak->title, ak->layer,
 								at->title, at->layer,
 								i);
@@ -400,11 +417,14 @@ static int **get_crossing_matrix (const RGraph *g,
 					RListIter *itt;
 					const RANode *at, *as = get_anode (gs);
 
-					if (gs == gj) continue;
+					if (gs == gj) {
+						continue;
+					}
 					neigh_s = r_graph_get_neighbours (g, gs);
 					graph_foreach_anode (neigh_s, itt, gt, at) {
-						if (at->pos_in_layer < ak->pos_in_layer)
+						if (at->pos_in_layer < ak->pos_in_layer) {
 							m[aj->pos_in_layer][as->pos_in_layer]++;
+						}
 					}
 				}
 			}
@@ -424,16 +444,18 @@ err_row:
 	return NULL;
 }
 
-static int layer_sweep (const RGraph *g, const struct layer_t layers[],
-						int maxlayer, int i, int from_up) {
-	int **cross_matrix;
+static int layer_sweep(const RGraph *g, const struct layer_t layers[],
+                        int maxlayer, int i, int from_up) {
+	int * *cross_matrix;
 	RGraphNode *u, *v;
 	const RANode *au, *av;
 	int n_rows, j, changed = false;
 	int len = layers[i].n_nodes;
 
 	cross_matrix = get_crossing_matrix (g, layers, maxlayer, i, from_up, &n_rows);
-	if (!cross_matrix) return false;
+	if (!cross_matrix) {
+		return false;
+	}
 
 	for (j = 0; j < len - 1; ++j) {
 		int auidx, avidx;
@@ -454,8 +476,8 @@ static int layer_sweep (const RGraph *g, const struct layer_t layers[],
 	}
 
 	/* update position in the layer of each node. During the swap of some
-	 * elements we didn't swap also the pos_in_layer because the cross_matrix
-	 * is indexed by it, so do it now! */
+	* elements we didn't swap also the pos_in_layer because the cross_matrix
+	* is indexed by it, so do it now! */
 	for (j = 0; j < layers[i].n_nodes; ++j) {
 		RANode *n = get_anode (layers[i].nodes[j]);
 		n->pos_in_layer = j;
@@ -467,27 +489,31 @@ static int layer_sweep (const RGraph *g, const struct layer_t layers[],
 	return changed;
 }
 
-static void view_cyclic_edge (const RGraphEdge *e, const RGraphVisitor *vis) {
-	const RAGraph *g = (RAGraph *)vis->data;
+static void view_cyclic_edge(const RGraphEdge *e, const RGraphVisitor *vis) {
+	const RAGraph *g = (RAGraph *) vis->data;
 	RGraphEdge *new_e = R_NEW0 (RGraphEdge);
-	if (!new_e) return;
+	if (!new_e) {
+		return;
+	}
 	new_e->from = e->from;
 	new_e->to = e->to;
 	new_e->nth = e->nth;
 	r_list_append (g->back_edges, new_e);
 }
 
-static void view_dummy (const RGraphEdge *e, const RGraphVisitor *vis) {
+static void view_dummy(const RGraphEdge *e, const RGraphVisitor *vis) {
 	const RANode *a = get_anode (e->from);
 	const RANode *b = get_anode (e->to);
-	RList *long_edges = (RList *)vis->data;
+	RList *long_edges = (RList *) vis->data;
 	if (!a || !b) {
 		return;
 	}
 
 	if (R_ABS (a->layer - b->layer) > 1) {
 		RGraphEdge *new_e = R_NEW0 (RGraphEdge);
-		if (!new_e) return;
+		if (!new_e) {
+			return;
+		}
 		new_e->from = e->from;
 		new_e->to = e->to;
 		new_e->nth = e->nth;
@@ -497,27 +523,29 @@ static void view_dummy (const RGraphEdge *e, const RGraphVisitor *vis) {
 
 /* find a set of edges that, removed, makes the graph acyclic */
 /* invert the edges identified in the previous step */
-static void remove_cycles (RAGraph *g) {
-	RGraphVisitor cyclic_vis = { NULL, NULL, NULL, NULL, NULL, NULL };
+static void remove_cycles(RAGraph *g) {
+	RGraphVisitor cyclic_vis = {
+		NULL, NULL, NULL, NULL, NULL, NULL
+	};
 	const RGraphEdge *e;
 	const RListIter *it;
 
-	g->back_edges = r_list_new();
-	cyclic_vis.back_edge = (RGraphEdgeCallback)view_cyclic_edge;
+	g->back_edges = r_list_new ();
+	cyclic_vis.back_edge = (RGraphEdgeCallback) view_cyclic_edge;
 	cyclic_vis.data = g;
 	r_graph_dfs (g->graph, &cyclic_vis);
 
 	r_list_foreach (g->back_edges, it, e) {
 		RANode *from, *to;
-		from = e->from ? get_anode (e->from) : NULL;
-		to = e->to ? get_anode (e->to) : NULL;
+		from = e->from? get_anode (e->from): NULL;
+		to = e->to? get_anode (e->to): NULL;
 		r_agraph_del_edge (g, from, to);
 		r_agraph_add_edge_at (g, to, from, e->nth);
 	}
 }
 
 static void add_sorted(RGraphNode *n, RGraphVisitor *vis) {
-	RList *l = (RList *)vis->data;
+	RList *l = (RList *) vis->data;
 	r_list_prepend (l, n);
 }
 
@@ -527,15 +555,17 @@ static void add_sorted(RGraphNode *n, RGraphVisitor *vis) {
  * you visit a node, you can be sure that you have already visited all nodes
  * that can lead to that node and thus you can easily compute the layer based
  * on the layer of these "parent" nodes. */
-static void assign_layers (const RAGraph *g) {
-	RGraphVisitor layer_vis = { NULL, NULL, NULL, NULL, NULL, NULL };
+static void assign_layers(const RAGraph *g) {
+	RGraphVisitor layer_vis = {
+		NULL, NULL, NULL, NULL, NULL, NULL
+	};
 	const RGraphNode *gn;
 	const RListIter *it;
 	RANode *n;
 	RList *topological_sort = r_list_new ();
 
 	layer_vis.data = topological_sort;
-	layer_vis.finish_node = (RGraphNodeCallback)add_sorted;
+	layer_vis.finish_node = (RGraphNodeCallback) add_sorted;
 	r_graph_dfs (g->graph, &layer_vis);
 
 	graph_foreach_anode (topological_sort, it, gn, n) {
@@ -555,37 +585,41 @@ static void assign_layers (const RAGraph *g) {
 	r_list_free (topological_sort);
 }
 
-static int find_edge (const RGraphEdge *a, const RGraphEdge *b) {
-	return a->from == b->to && a->to == b->from ? 0 : 1;
+static int find_edge(const RGraphEdge *a, const RGraphEdge *b) {
+	return a->from == b->to && a->to == b->from? 0: 1;
 }
 
-static int is_reversed (const RAGraph *g, const RGraphEdge *e) {
-	return r_list_find (g->back_edges, e, (RListComparator)find_edge) ? true : false;
+static int is_reversed(const RAGraph *g, const RGraphEdge *e) {
+	return r_list_find (g->back_edges, e, (RListComparator) find_edge)? true: false;
 }
 
 /* add dummy nodes when there are edges that span multiple layers */
-static void create_dummy_nodes (RAGraph *g) {
-	RGraphVisitor dummy_vis = { NULL, NULL, NULL, NULL, NULL, NULL };
+static void create_dummy_nodes(RAGraph *g) {
+	RGraphVisitor dummy_vis = {
+		NULL, NULL, NULL, NULL, NULL, NULL
+	};
 	const RListIter *it;
 	const RGraphEdge *e;
 
 	g->long_edges = r_list_new ();
 	dummy_vis.data = g->long_edges;
-	dummy_vis.tree_edge = (RGraphEdgeCallback)view_dummy;
-	dummy_vis.fcross_edge = (RGraphEdgeCallback)view_dummy;
+	dummy_vis.tree_edge = (RGraphEdgeCallback) view_dummy;
+	dummy_vis.fcross_edge = (RGraphEdgeCallback) view_dummy;
 	r_graph_dfs (g->graph, &dummy_vis);
 
 	r_list_foreach (g->long_edges, it, e) {
 		RANode *from = get_anode (e->from);
 		RANode *to = get_anode (e->to);
 		int diff_layer = R_ABS (from->layer - to->layer);
-		RANode *prev = get_anode(e->from);
+		RANode *prev = get_anode (e->from);
 		int i, nth = e->nth;
 
 		r_agraph_del_edge (g, from, to);
 		for (i = 1; i < diff_layer; ++i) {
 			RANode *dummy = r_agraph_add_node (g, NULL, NULL);
-			if (!dummy) return;
+			if (!dummy) {
+				return;
+			}
 			dummy->is_dummy = true;
 			dummy->layer = from->layer + i;
 			dummy->is_reversed = is_reversed (g, e);
@@ -600,7 +634,7 @@ static void create_dummy_nodes (RAGraph *g) {
 }
 
 /* create layers and assign an initial ordering of the nodes into them */
-static void create_layers (RAGraph *g) {
+static void create_layers(RAGraph *g) {
 	const RList *nodes = r_graph_get_nodes (g->graph);
 	RGraphNode *gn;
 	const RListIter *it;
@@ -617,7 +651,9 @@ static void create_layers (RAGraph *g) {
 
 	/* create a starting ordering of nodes for each layer */
 	g->n_layers++;
-	if (sizeof (struct layer_t) * g->n_layers < g->n_layers) return;
+	if (sizeof (struct layer_t) * g->n_layers < g->n_layers) {
+		return;
+	}
 	g->layers = R_NEWS0 (struct layer_t, g->n_layers);
 
 	graph_foreach_anode (nodes, it, gn, n) {
@@ -625,7 +661,7 @@ static void create_layers (RAGraph *g) {
 	}
 
 	for (i = 0; i < g->n_layers; ++i) {
-		if (sizeof(RGraphNode*) * g->layers[i].n_nodes < g->layers[i].n_nodes) {
+		if (sizeof(RGraphNode *) * g->layers[i].n_nodes < g->layers[i].n_nodes) {
 			continue;
 		}
 		g->layers[i].nodes = R_NEWS0 (RGraphNode *,
@@ -641,7 +677,7 @@ static void create_layers (RAGraph *g) {
 /* layer-by-layer sweep */
 /* it permutes each layer, trying to find the best ordering for each layer
  * to minimize the number of crossing edges */
-static void minimize_crossings (const RAGraph *g) {
+static void minimize_crossings(const RAGraph *g) {
 	int i, cross_changed, max_changes = 4096;
 
 	do {
@@ -663,14 +699,14 @@ static void minimize_crossings (const RAGraph *g) {
 	} while (cross_changed && max_changes);
 }
 
-static int find_dist (const struct dist_t *a, const struct dist_t *b) {
-	return a->from == b->from && a->to == b->to ? 0 : 1;
+static int find_dist(const struct dist_t *a, const struct dist_t *b) {
+	return a->from == b->from && a->to == b->to? 0: 1;
 }
 
 /* returns the distance between two nodes */
 /* if the distance between two nodes were explicitly set, returns that;
  * otherwise calculate the distance of two nodes on the same layer */
-static int dist_nodes (const RAGraph *g, const RGraphNode *a, const RGraphNode *b) {
+static int dist_nodes(const RAGraph *g, const RGraphNode *a, const RGraphNode *b) {
 	struct dist_t d;
 	const RANode *aa, *ab;
 	RListIter *it;
@@ -679,9 +715,9 @@ static int dist_nodes (const RAGraph *g, const RGraphNode *a, const RGraphNode *
 	if (g->dists) {
 		d.from = a;
 		d.to = b;
-		it = r_list_find (g->dists, &d, (RListComparator)find_dist);
+		it = r_list_find (g->dists, &d, (RListComparator) find_dist);
 		if (it) {
-			struct dist_t *old = (struct dist_t *)r_list_iter_get_data (it);
+			struct dist_t *old = (struct dist_t *) r_list_iter_get_data (it);
 			return old->dist;
 		}
 	}
@@ -691,7 +727,7 @@ static int dist_nodes (const RAGraph *g, const RGraphNode *a, const RGraphNode *
 	if (aa && ab && aa->layer == ab->layer) {
 		int i;
 
-		res = aa == ab && !aa->is_reversed ? HORIZONTAL_NODE_SPACING : 0;
+		res = aa == ab && !aa->is_reversed? HORIZONTAL_NODE_SPACING: 0;
 		for (i = aa->pos_in_layer; i < ab->pos_in_layer; ++i) {
 			const RGraphNode *cur = g->layers[aa->layer].nodes[i];
 			const RGraphNode *next = g->layers[aa->layer].nodes[i + 1];
@@ -702,9 +738,9 @@ static int dist_nodes (const RAGraph *g, const RGraphNode *a, const RGraphNode *
 			if (g->dists) {
 				d.from = cur;
 				d.to = next;
-				it = r_list_find (g->dists, &d, (RListComparator)find_dist);
+				it = r_list_find (g->dists, &d, (RListComparator) find_dist);
 				if (it) {
-					struct dist_t *old = (struct dist_t *)r_list_iter_get_data (it);
+					struct dist_t *old = (struct dist_t *) r_list_iter_get_data (it);
 					res += old->dist;
 					found = true;
 				}
@@ -713,10 +749,11 @@ static int dist_nodes (const RAGraph *g, const RGraphNode *a, const RGraphNode *
 			if (acur && !found) {
 				int space = HORIZONTAL_NODE_SPACING;
 				if (acur->is_reversed && anext->is_reversed) {
-					if (!acur->is_reversed)
+					if (!acur->is_reversed) {
 						res += acur->w / 2;
-					else if (!anext->is_reversed)
+					} else if (!anext->is_reversed) {
 						res += anext->w / 2;
+					}
 					res += 1;
 				} else {
 					res += acur->w / 2 + anext->w / 2 + space;
@@ -729,13 +766,15 @@ static int dist_nodes (const RAGraph *g, const RGraphNode *a, const RGraphNode *
 }
 
 /* explictly set the distance between two nodes on the same layer */
-static void set_dist_nodes (const RAGraph *g, int l, int cur, int next) {
+static void set_dist_nodes(const RAGraph *g, int l, int cur, int next) {
 	struct dist_t *d, find_el;
 	const RGraphNode *vi, *vip;
 	const RANode *avi, *avip;
 	RListIter *it;
 
-	if (!g->dists) return;
+	if (!g->dists) {
+		return;
+	}
 	vi = g->layers[l].nodes[cur];
 	vip = g->layers[l].nodes[next];
 	avi = get_anode (vi);
@@ -743,17 +782,18 @@ static void set_dist_nodes (const RAGraph *g, int l, int cur, int next) {
 
 	find_el.from = vi;
 	find_el.to = vip;
-	it = r_list_find (g->dists, &find_el, (RListComparator)find_dist);
-	d = it ? (struct dist_t *)r_list_iter_get_data (it) : R_NEW0 (struct dist_t);
+	it = r_list_find (g->dists, &find_el, (RListComparator) find_dist);
+	d = it? (struct dist_t *) r_list_iter_get_data (it): R_NEW0 (struct dist_t);
 
 	d->from = vi;
 	d->to = vip;
 	d->dist = (avip && avi)? avip->x - avi->x: 0;
-	if (!it)
+	if (!it) {
 		r_list_push (g->dists, d);
+	}
 }
 
-static int is_valid_pos (const RAGraph *g, int l, int pos) {
+static int is_valid_pos(const RAGraph *g, int l, int pos) {
 	return pos >= 0 && pos < g->layers[l].n_nodes;
 }
 
@@ -761,7 +801,7 @@ static int is_valid_pos (const RAGraph *g, int l, int pos) {
 /* if v is an original node, L(v) = { v }
  * if v is a dummy node, L(v) is the set of all the dummies node that belongs
  *      to the same long edge */
-static Sdb *compute_vertical_nodes (const RAGraph *g) {
+static Sdb *compute_vertical_nodes(const RAGraph *g) {
 	Sdb *res = sdb_new0 ();
 	int i, j;
 
@@ -781,7 +821,9 @@ static Sdb *compute_vertical_nodes (const RAGraph *g) {
 					while (anext->is_dummy) {
 						r_list_append (vert, next);
 						next = r_graph_nth_neighbour (g->graph, next, 0);
-						if (!next) break;
+						if (!next) {
+							break;
+						}
 						anext = get_anode (next);
 					}
 				} else {
@@ -799,9 +841,9 @@ static Sdb *compute_vertical_nodes (const RAGraph *g) {
  * - v E C
  * - w E C => L(v) is a subset of C
  * - w E C, the s+(w) exists and is not in any class yet => s+(w) E C */
-static RList **compute_classes (const RAGraph *g, Sdb *v_nodes, int is_left, int *n_classes) {
+static RList **compute_classes(const RAGraph *g, Sdb *v_nodes, int is_left, int *n_classes) {
 	int i, j, c;
-	RList **res = R_NEWS0 (RList *, g->n_layers);
+	RList * *res = R_NEWS0 (RList *, g->n_layers);
 	RGraphNode *gn;
 	const RListIter *it;
 	RANode *n;
@@ -813,17 +855,18 @@ static RList **compute_classes (const RAGraph *g, Sdb *v_nodes, int is_left, int
 	for (i = 0; i < g->n_layers; ++i) {
 		c = i;
 
-		for (j = is_left ? 0 : g->layers[i].n_nodes - 1;
-			(is_left && j < g->layers[i].n_nodes) || (!is_left && j >= 0);
-			j = is_left ? j + 1 : j - 1) {
+		for (j = is_left? 0: g->layers[i].n_nodes - 1;
+		(is_left && j < g->layers[i].n_nodes) || (!is_left && j >= 0);
+		j = is_left? j + 1: j - 1) {
 			const RGraphNode *gj = g->layers[i].nodes[j];
 			const RANode *aj = get_anode (gj);
 
 			if (aj->klass == -1) {
 				const RList *laj = hash_get_rlist (v_nodes, gj);
 
-				if (!res[c])
+				if (!res[c]) {
 					res[c] = r_list_new ();
+				}
 				graph_foreach_anode (laj, it, gn, n) {
 					r_list_append (res[c], gn);
 					n->klass = c;
@@ -834,36 +877,42 @@ static RList **compute_classes (const RAGraph *g, Sdb *v_nodes, int is_left, int
 		}
 	}
 
-	if (n_classes)
+	if (n_classes) {
 		*n_classes = g->n_layers;
+	}
 	return res;
 }
 
-static int cmp_dist (const size_t a, const size_t b) {
-	return (int)a < (int)b;
+static int cmp_dist(const size_t a, const size_t b) {
+	return (int) a < (int) b;
 }
 
-static RGraphNode *get_sibling (const RAGraph *g, const RANode *n, int is_left, int is_adjust_class) {
+static RGraphNode *get_sibling(const RAGraph *g, const RANode *n, int is_left, int is_adjust_class) {
 	RGraphNode *res = NULL;
 	int pos = n->pos_in_layer;
 
-	if ((is_left && is_adjust_class) || (!is_left && !is_adjust_class))
+	if ((is_left && is_adjust_class) || (!is_left && !is_adjust_class)) {
 		pos++;
-	else pos--;
+	} else {
+		pos--;
+	}
 
-	if (is_valid_pos (g, n->layer, pos))
+	if (is_valid_pos (g, n->layer, pos)) {
 		res = g->layers[n->layer].nodes[pos];
+	}
 	return res;
 }
 
-static int adjust_class_val (const RAGraph *g, const RGraphNode *gn, const RGraphNode *sibl, Sdb *res, int is_left) {
-	if (is_left) return hash_get_int (res, sibl) - hash_get_int (res, gn) - dist_nodes (g, gn, sibl);
+static int adjust_class_val(const RAGraph *g, const RGraphNode *gn, const RGraphNode *sibl, Sdb *res, int is_left) {
+	if (is_left) {
+		return hash_get_int (res, sibl) - hash_get_int (res, gn) - dist_nodes (g, gn, sibl);
+	}
 	return hash_get_int (res, gn) - hash_get_int (res, sibl) - dist_nodes (g, sibl, gn);
 }
 
 /* adjusts the position of previously placed left/right classes */
 /* tries to place classes as close as possible */
-static void adjust_class (const RAGraph *g, int is_left, RList **classes, Sdb *res, int c) {
+static void adjust_class(const RAGraph *g, int is_left, RList * *classes, Sdb *res, int c) {
 	const RGraphNode *gn;
 	const RListIter *it;
 	const RANode *an;
@@ -874,11 +923,15 @@ static void adjust_class (const RAGraph *g, int is_left, RList **classes, Sdb *r
 		const RANode *sibl_anode;
 
 		sibling = get_sibling (g, an, is_left, true);
-		if (!sibling) continue;
+		if (!sibling) {
+			continue;
+		}
 		sibl_anode = get_anode (sibling);
-		if (sibl_anode->klass == c) continue;
+		if (sibl_anode->klass == c) {
+			continue;
+		}
 		v = adjust_class_val (g, gn, sibling, res, is_left);
-		dist = is_first ? v : R_MIN (dist, v);
+		dist = is_first? v: R_MIN (dist, v);
 		is_first = false;
 	}
 
@@ -893,8 +946,9 @@ static void adjust_class (const RAGraph *g, int is_left, RList **classes, Sdb *r
 			const RANode *ak;
 
 			graph_foreach_anode (neigh, itk, gk, ak) {
-				if (ak->klass < c)
-					r_list_append (heap, (void *)(size_t)(ak->x - an->x));
+				if (ak->klass < c) {
+					r_list_append (heap, (void *) (size_t) (ak->x - an->x));
+				}
 			}
 		}
 
@@ -902,8 +956,8 @@ static void adjust_class (const RAGraph *g, int is_left, RList **classes, Sdb *r
 		if (len == 0) {
 			dist = 0;
 		} else {
-			r_list_sort (heap, (RListComparator)cmp_dist);
-			dist = (int)(size_t)r_list_get_n (heap, len / 2);
+			r_list_sort (heap, (RListComparator) cmp_dist);
+			dist = (int) (size_t) r_list_get_n (heap, len / 2);
 		}
 
 		r_list_free (heap);
@@ -911,24 +965,30 @@ static void adjust_class (const RAGraph *g, int is_left, RList **classes, Sdb *r
 
 	graph_foreach_anode (classes[c], it, gn, an) {
 		const int old_val = hash_get_int (res, gn);
-		const int new_val = is_left ?  old_val + dist : old_val - dist;
+		const int new_val = is_left?  old_val + dist: old_val - dist;
 		hash_set (res, gn, new_val);
 	}
 }
 
-static int place_nodes_val (const RAGraph *g, const RGraphNode *gn, const RGraphNode *sibl, Sdb *res, int is_left) {
-	if (is_left) return hash_get_int (res, sibl) + dist_nodes (g, sibl, gn);
+static int place_nodes_val(const RAGraph *g, const RGraphNode *gn, const RGraphNode *sibl, Sdb *res, int is_left) {
+	if (is_left) {
+		return hash_get_int (res, sibl) + dist_nodes (g, sibl, gn);
+	}
 	return hash_get_int (res, sibl) - dist_nodes (g, gn, sibl);
 }
 
-static int place_nodes_sel_p (int newval, int oldval, int is_first, int is_left) {
-	if (is_first) return newval;
-	if (is_left) return R_MAX (oldval, newval);
+static int place_nodes_sel_p(int newval, int oldval, int is_first, int is_left) {
+	if (is_first) {
+		return newval;
+	}
+	if (is_left) {
+		return R_MAX (oldval, newval);
+	}
 	return R_MIN (oldval, newval);
 }
 
 /* places left/right the nodes of a class */
-static void place_nodes (const RAGraph *g, const RGraphNode *gn, int is_left, Sdb *v_nodes, RList **classes, Sdb *res, Sdb *placed) {
+static void place_nodes(const RAGraph *g, const RGraphNode *gn, int is_left, Sdb *v_nodes, RList * *classes, Sdb *res, Sdb *placed) {
 	const RList *lv = hash_get_rlist (v_nodes, gn);
 	int p = 0, v, is_first = true;
 	const RGraphNode *gk;
@@ -940,11 +1000,14 @@ static void place_nodes (const RAGraph *g, const RGraphNode *gn, int is_left, Sd
 		const RANode *sibl_anode;
 
 		sibling = get_sibling (g, ak, is_left, false);
-		if (!sibling) continue;
+		if (!sibling) {
+			continue;
+		}
 		sibl_anode = get_anode (sibling);
 		if (ak->klass == sibl_anode->klass) {
-			if (!hash_get (placed, sibling))
+			if (!hash_get (placed, sibling)) {
 				place_nodes (g, sibling, is_left, v_nodes, classes, res, placed);
+			}
 
 			v = place_nodes_val (g, gk, sibling, res, is_left);
 			p = place_nodes_sel_p (v, p, is_first, is_left);
@@ -952,8 +1015,9 @@ static void place_nodes (const RAGraph *g, const RGraphNode *gn, int is_left, Sd
 		}
 	}
 
-	if (is_first)
-		p = is_left ? 0 : 50;
+	if (is_first) {
+		p = is_left? 0: 50;
+	}
 
 	graph_foreach_anode (lv, itk, gk, ak) {
 		hash_set (res, gk, p);
@@ -962,13 +1026,15 @@ static void place_nodes (const RAGraph *g, const RGraphNode *gn, int is_left, Sd
 }
 
 /* computes the position to the left/right of all the nodes */
-static Sdb *compute_pos (const RAGraph *g, int is_left, Sdb *v_nodes) {
+static Sdb *compute_pos(const RAGraph *g, int is_left, Sdb *v_nodes) {
 	Sdb *res, *placed;
-	RList **classes;
+	RList * *classes;
 	int n_classes, i;
 
 	classes = compute_classes (g, v_nodes, is_left, &n_classes);
-	if (!classes) return NULL;
+	if (!classes) {
+		return NULL;
+	}
 
 	res = sdb_new0 ();
 	placed = sdb_new0 ();
@@ -987,8 +1053,9 @@ static Sdb *compute_pos (const RAGraph *g, int is_left, Sdb *v_nodes) {
 
 	sdb_free (placed);
 	for (i = 0; i < n_classes; ++i) {
-		if (classes[i])
+		if (classes[i]) {
 			r_list_free (classes[i]);
+		}
 	}
 	free (classes);
 	return res;
@@ -997,7 +1064,7 @@ static Sdb *compute_pos (const RAGraph *g, int is_left, Sdb *v_nodes) {
 /* calculates position of all nodes, but in particular dummies nodes */
 /* computes two different placements (called "left"/"right") and set the final
  * position of each node to the average of the values in the two placements */
-static void place_dummies (const RAGraph *g) {
+static void place_dummies(const RAGraph *g) {
 	const RList *nodes;
 	Sdb *xminus, *xplus, *vertical_nodes;
 	const RGraphNode *gn;
@@ -1005,11 +1072,17 @@ static void place_dummies (const RAGraph *g) {
 	RANode *n;
 
 	vertical_nodes = compute_vertical_nodes (g);
-	if (!vertical_nodes) return;
+	if (!vertical_nodes) {
+		return;
+	}
 	xminus = compute_pos (g, true, vertical_nodes);
-	if (!xminus) goto xminus_err;
+	if (!xminus) {
+		goto xminus_err;
+	}
 	xplus = compute_pos (g, false, vertical_nodes);
-	if (!xplus) goto xplus_err;
+	if (!xplus) {
+		goto xplus_err;
+	}
 
 	nodes = r_graph_get_nodes (g->graph);
 	graph_foreach_anode (nodes, it, gn, n) {
@@ -1023,26 +1096,31 @@ xminus_err:
 	sdb_free (vertical_nodes);
 }
 
-static RGraphNode *get_right_dummy (const RAGraph *g, const RGraphNode *n) {
+static RGraphNode *get_right_dummy(const RAGraph *g, const RGraphNode *n) {
 	const RANode *an = get_anode (n);
-	if (!an) return NULL;
+	if (!an) {
+		return NULL;
+	}
 	int k, layer = an->layer;
 
 	for (k = an->pos_in_layer + 1; k < g->layers[layer].n_nodes; ++k) {
 		RGraphNode *gk = g->layers[layer].nodes[k];
 		const RANode *ak = get_anode (gk);
-		if (!ak) break;
+		if (!ak) {
+			break;
+		}
 
-		if (ak->is_dummy)
+		if (ak->is_dummy) {
 			return gk;
+		}
 	}
 	return NULL;
 }
 
-static void adjust_directions (const RAGraph *g, int i, int from_up, Sdb *D, Sdb *P) {
+static void adjust_directions(const RAGraph *g, int i, int from_up, Sdb *D, Sdb *P) {
 	const RGraphNode *vm = NULL, *wm = NULL;
 	const RANode *vma = NULL, *wma = NULL;
-	int j, d = from_up ? 1 : -1;
+	int j, d = from_up? 1: -1;
 
 	if (i + d < 0 || i + d >= g->n_layers) {
 		return;
@@ -1051,9 +1129,14 @@ static void adjust_directions (const RAGraph *g, int i, int from_up, Sdb *D, Sdb
 		const RGraphNode *wp, *vp = g->layers[i + d].nodes[j];
 		const RANode *wpa, *vpa = get_anode (vp);
 
-		if (!vpa->is_dummy) continue;
-		if (from_up) wp = r_list_get_n (r_graph_innodes (g->graph, vp), 0);
-		else wp = r_graph_nth_neighbour (g->graph, vp, 0);
+		if (!vpa->is_dummy) {
+			continue;
+		}
+		if (from_up) {
+			wp = r_list_get_n (r_graph_innodes (g->graph, vp), 0);
+		} else {
+			wp = r_graph_nth_neighbour (g->graph, vp, 0);
+		}
 		wpa = get_anode (wp);
 		if (!wpa || !wpa->is_dummy) {
 			continue;
@@ -1066,8 +1149,9 @@ static void adjust_directions (const RAGraph *g, int i, int from_up, Sdb *D, Sdb
 				const RGraphNode *w = g->layers[wma->layer].nodes[k];
 				const RANode *aw = get_anode (w);
 
-				if (aw->is_dummy)
+				if (aw->is_dummy) {
 					p &= hash_get_int (P, w);
+				}
 			}
 			if (p) {
 				hash_set (D, vm, from_up);
@@ -1088,7 +1172,7 @@ static void adjust_directions (const RAGraph *g, int i, int from_up, Sdb *D, Sdb
 }
 
 /* find a placement for a single node */
-static void place_single (const RAGraph *g, int l, const RGraphNode *bm, const RGraphNode *bp, int from_up, int va) {
+static void place_single(const RAGraph *g, int l, const RGraphNode *bm, const RGraphNode *bp, int from_up, int va) {
 	const RGraphNode *gk, *v = g->layers[l].nodes[va];
 	const RANode *ak;
 	RANode *av = get_anode (v);
@@ -1097,7 +1181,7 @@ static void place_single (const RAGraph *g, int l, const RGraphNode *bm, const R
 	int len;
 
 	neigh = from_up
-		? r_graph_innodes (g->graph, v)
+	? r_graph_innodes (g->graph, v)
 		: r_graph_get_neighbours (g->graph, v);
 
 	len = r_list_length (neigh);
@@ -1143,11 +1227,11 @@ static void collect_changes(const RAGraph *g, int l, const RGraphNode *b, int fr
 	struct len_pos_t *cx;
 	int i;
 
-	lcmp = is_left ? (RListComparator)RM_listcmp : (RListComparator)RP_listcmp;
+	lcmp = is_left? (RListComparator) RM_listcmp: (RListComparator) RP_listcmp;
 
-	for (i = is_left ? s : e - 1;
-		(is_left && i < e) || (!is_left && i >= s);
-		i = is_left ? i + 1 : i - 1) {
+	for (i = is_left? s: e - 1;
+	(is_left && i < e) || (!is_left && i >= s);
+	i = is_left? i + 1: i - 1) {
 		const RGraphNode *v, *vi = g->layers[l].nodes[i];
 		const RANode *av, *avi = get_anode (vi);
 		const RList *neigh;
@@ -1159,7 +1243,7 @@ static void collect_changes(const RAGraph *g, int l, const RGraphNode *b, int fr
 		}
 		neigh = from_up
 		? r_graph_innodes (g->graph, vi)
-		: r_graph_get_neighbours (g->graph, vi);
+			: r_graph_get_neighbours (g->graph, vi);
 
 		graph_foreach_anode (neigh, it, v, av) {
 			if ((is_left && av->x >= avi->x) || (!is_left && av->x <= avi->x)) {
@@ -1169,10 +1253,11 @@ static void collect_changes(const RAGraph *g, int l, const RGraphNode *b, int fr
 				c--;
 				cx->len = 2;
 				cx->pos = av->x;
-				if (is_left)
+				if (is_left) {
 					cx->pos += dist_nodes (g, vi, vt);
-				else
+				} else {
 					cx->pos -= dist_nodes (g, vtp, vi);
+				}
 				r_list_add_sorted (list, cx, lcmp);
 			}
 		}
@@ -1180,15 +1265,18 @@ static void collect_changes(const RAGraph *g, int l, const RGraphNode *b, int fr
 		cx = R_NEW0 (struct len_pos_t);
 		cx->len = c;
 		cx->pos = avi->x;
-		if (is_left) cx->pos += dist_nodes (g, vi, vt);
-		else cx->pos -= dist_nodes (g, vtp, vi);
+		if (is_left) {
+			cx->pos += dist_nodes (g, vi, vt);
+		} else {
+			cx->pos -= dist_nodes (g, vtp, vi);
+		}
 		r_list_add_sorted (list, cx, lcmp);
 	}
 
 	if (b) {
 		const RANode *ab = get_anode (b);
 		cx = R_NEW (struct len_pos_t);
-		cx->len = is_left ? INT_MAX : INT_MIN;
+		cx->len = is_left? INT_MAX: INT_MIN;
 		cx->pos = ab->x;
 		if (is_left) {
 			cx->pos += dist_nodes (g, b, vt);
@@ -1204,8 +1292,8 @@ static void combine_sequences(const RAGraph *g, int l, const RGraphNode *bm, con
 	const RGraphNode *vt, *vtp;
 	RANode *at, *atp;
 	int rm, rp, t, m, i;
-	Rm->free = (RListFree)free;
-	Rp->free = (RListFree)free;
+	Rm->free = (RListFree) free;
+	Rp->free = (RListFree) free;
 
 	t = (a + r) / 2;
 	vt = g->layers[l].nodes[t - 1];
@@ -1229,7 +1317,7 @@ static void combine_sequences(const RAGraph *g, int l, const RGraphNode *bm, con
 					if (r_list_empty (Rm)) {
 						at->x = atp->x - m;
 					} else {
-						struct len_pos_t *cx = (struct len_pos_t *)r_list_pop (Rm);
+						struct len_pos_t *cx = (struct len_pos_t *) r_list_pop (Rm);
 						rm = rm + cx->len;
 						at->x = R_MAX (cx->pos, atp->x - m);
 						free (cx);
@@ -1238,7 +1326,7 @@ static void combine_sequences(const RAGraph *g, int l, const RGraphNode *bm, con
 					if (r_list_empty (Rp)) {
 						atp->x = at->x + m;
 					} else {
-						struct len_pos_t *cx = (struct len_pos_t *)r_list_pop (Rp);
+						struct len_pos_t *cx = (struct len_pos_t *) r_list_pop (Rp);
 						rp = rp + cx->len;
 						atp->x = R_MIN (cx->pos, at->x + m);
 						free (cx);
@@ -1273,7 +1361,7 @@ static void combine_sequences(const RAGraph *g, int l, const RGraphNode *bm, con
  * neighbours in the "previous" layer. Those neighbours are considered as
  * "fixed". The previous layer depends on the direction used during the layers
  * traversal */
-static void place_sequence (const RAGraph *g, int l, const RGraphNode *bm, const RGraphNode *bp, int from_up, int va, int vr) {
+static void place_sequence(const RAGraph *g, int l, const RGraphNode *bm, const RGraphNode *bp, int from_up, int va, int vr) {
 	int vt;
 
 	if (vr == va + 1) {
@@ -1289,12 +1377,12 @@ static void place_sequence (const RAGraph *g, int l, const RGraphNode *bm, const
 /* finds the placements of nodes while traversing the graph in the given
  * direction */
 /* places all the sequences of consecutive original nodes in each layer. */
-static void original_traverse_l (const RAGraph *g, Sdb *D, Sdb *P, int from_up) {
+static void original_traverse_l(const RAGraph *g, Sdb *D, Sdb *P, int from_up) {
 	int i, k, va, vr;
 
-	for (i = from_up ? 0 : g->n_layers - 1;
-		(from_up && i < g->n_layers) || (!from_up && i >= 0);
-		i = from_up ? i + 1 : i - 1) {
+	for (i = from_up? 0: g->n_layers - 1;
+	(from_up && i < g->n_layers) || (!from_up && i >= 0);
+	i = from_up? i + 1: i - 1) {
 		int j;
 		const RGraphNode *bm = NULL;
 		const RANode *bma = NULL;
@@ -1334,8 +1422,9 @@ static void original_traverse_l (const RAGraph *g, Sdb *D, Sdb *P, int from_up)
 				for (k = va; k < vr - 1; ++k)
 					set_dist_nodes (g, i, k, k + 1);
 
-				if (is_valid_pos (g, i, va))
+				if (is_valid_pos (g, i, va)) {
 					set_dist_nodes (g, i, bma->pos_in_layer, va);
+				}
 			} else if (hash_get_int (D, bm) == from_up) {
 				bpa = get_anode (bp);
 				va = bma->pos_in_layer + 1;
@@ -1352,7 +1441,7 @@ static void original_traverse_l (const RAGraph *g, Sdb *D, Sdb *P, int from_up)
 /* computes a final position of original nodes, considering dummies nodes as
  * fixed */
 /* set the node placements traversing the graph downward and then upward */
-static void place_original (RAGraph *g) {
+static void place_original(RAGraph *g) {
 	const RList *nodes = r_graph_get_nodes (g->graph);
 	Sdb *D, *P;
 	const RGraphNode *gn;
@@ -1360,7 +1449,9 @@ static void place_original (RAGraph *g) {
 	const RANode *an;
 
 	D = sdb_new0 ();
-	if (!D) return;
+	if (!D) {
+		return;
+	}
 	P = sdb_new0 ();
 	if (!P) {
 		sdb_free (D);
@@ -1395,27 +1486,27 @@ static void place_original (RAGraph *g) {
 	sdb_free (D);
 }
 
-static void restore_original_edges (const RAGraph *g) {
+static void restore_original_edges(const RAGraph *g) {
 	const RListIter *it;
 	const RGraphEdge *e;
 
 	r_list_foreach (g->long_edges, it, e) {
 		RANode *from, *to;
-		from = e->from ? get_anode (e->from) : NULL;
-		to = e->to ? get_anode (e->to) : NULL;
+		from = e->from? get_anode (e->from): NULL;
+		to = e->to? get_anode (e->to): NULL;
 		r_agraph_add_edge_at (g, from, to, e->nth);
 	}
 
 	r_list_foreach (g->back_edges, it, e) {
 		RANode *from, *to;
-		from = e->from ? get_anode (e->from) : NULL;
-		to = e->to ? get_anode (e->to) : NULL;
+		from = e->from? get_anode (e->from): NULL;
+		to = e->to? get_anode (e->to): NULL;
 		r_agraph_del_edge (g, to, from);
 		r_agraph_add_edge_at (g, from, to, e->nth);
 	}
 }
 
-static void create_edge_from_dummies (const RAGraph *g, RANode *an, RList *toremove) {
+static void create_edge_from_dummies(const RAGraph *g, RANode *an, RList *toremove) {
 	RGraphNode *n = an->gnode;
 	RGraphNode *from = r_list_get_n (r_graph_innodes (g->graph, n), 0);
 	RANode *a_from = get_anode (from);
@@ -1430,8 +1521,8 @@ static void create_edge_from_dummies (const RAGraph *g, RANode *an, RList *torem
 	if (e->is_reversed) {
 		e->to = a_from;
 		add_to_list = r_list_prepend;
-		add_to_list (e->x, (void *)(size_t)an->x);
-		add_to_list (e->y, (void *)(size_t)a_from->y);
+		add_to_list (e->x, (void *) (size_t) an->x);
+		add_to_list (e->y, (void *) (size_t) a_from->y);
 	} else {
 		e->from = a_from;
 		add_to_list = r_list_append;
@@ -1440,12 +1531,12 @@ static void create_edge_from_dummies (const RAGraph *g, RANode *an, RList *torem
 	while (an->is_dummy) {
 		add_to_list (toremove, n);
 
-		add_to_list (e->x, (void *)(size_t)an->x);
-		add_to_list (e->y, (void *)(size_t)an->y);
+		add_to_list (e->x, (void *) (size_t) an->x);
+		add_to_list (e->y, (void *) (size_t) an->y);
 
-		add_to_list (e->x, (void *)(size_t)an->x);
-		add_to_list (e->y, (void *)(size_t)
-				(an->y + g->layers[an->layer].height));
+		add_to_list (e->x, (void *) (size_t) an->x);
+		add_to_list (e->y, (void *) (size_t)
+			(an->y + g->layers[an->layer].height));
 
 		n = r_graph_nth_neighbour (g->graph, n, 0);
 		an = get_anode (n);
@@ -1459,7 +1550,7 @@ static void create_edge_from_dummies (const RAGraph *g, RANode *an, RList *torem
 	r_list_append (g->edges, e);
 }
 
-static void analyze_back_edges (const RAGraph *g, RANode *an) {
+static void analyze_back_edges(const RAGraph *g, RANode *an) {
 	const RList *neigh;
 	RListIter *itk;
 	RGraphNode *gk;
@@ -1471,7 +1562,7 @@ static void analyze_back_edges (const RAGraph *g, RANode *an) {
 
 	neigh = r_graph_get_neighbours (g->graph, an->gnode);
 	/* traverse all neighbours and analyze only the ones that create back
-	 * edges. */
+	* edges. */
 	graph_foreach_anode (neigh, itk, gk, ak) {
 		RGraphNode *fn, *ln;
 		RANode *first, *last;
@@ -1501,12 +1592,12 @@ static void analyze_back_edges (const RAGraph *g, RANode *an) {
 
 			if (first == an) {
 				r_list_append (e->x,
-					(void *)(size_t)(an->x - 2 - j));
-				r_list_append (e->y, (void *)(size_t)ak->y);
+					(void *) (size_t) (an->x - 2 - j));
+				r_list_append (e->y, (void *) (size_t) ak->y);
 			} else {
 				r_list_append (e->x,
-					(void *)(size_t)(last->x + last->w + 2 + j));
-				r_list_append (e->y, (void *)(size_t)ak->y);
+					(void *) (size_t) (last->x + last->w + 2 + j));
+				r_list_append (e->y, (void *) (size_t) ak->y);
 			}
 		}
 		r_list_append (g->edges, e);
@@ -1514,14 +1605,14 @@ static void analyze_back_edges (const RAGraph *g, RANode *an) {
 	}
 }
 
-static void remove_dummy_nodes (const RAGraph *g) {
+static void remove_dummy_nodes(const RAGraph *g) {
 	RGraphNode *gn;
 	const RListIter *it;
 	RList *toremove = r_list_new ();
 	int i, j;
 
 	/* traverse all dummy nodes to keep track
-	 * of the path long edges should go by.  */
+	* of the path long edges should go by.  */
 	for (i = 0; i < g->n_layers; ++i) {
 		for (j = 0; j < g->layers[i].n_nodes; ++j) {
 			RGraphNode *n = g->layers[i].nodes[j];
@@ -1577,8 +1668,8 @@ static void set_layout(RAGraph *g) {
 	}
 
 	/* x-coordinate assignment: algorithm based on:
-	 * A Fast Layout Algorithm for k-Level Graphs
-	 * by C. Buchheim, M. Junger, S. Leipert */
+	* A Fast Layout Algorithm for k-Level Graphs
+	* by C. Buchheim, M. Junger, S. Leipert */
 	place_dummies (g);
 	place_original (g);
 
@@ -1647,13 +1738,13 @@ static char *get_body(RCore *core, ut64 addr, int size, int opts) {
 		return NULL;
 	}
 	r_config_save_num (hc, "asm.fcnlines", "asm.lines", "asm.bytes",
-			   "asm.cmtcol", "asm.marks", "asm.marks", "asm.offset",
-			   "asm.comments", NULL);
+		"asm.cmtcol", "asm.marks", "asm.marks", "asm.offset",
+		"asm.comments", NULL);
 	const bool o_comments = r_config_get_i (core->config, "graph.comments");
 	const bool o_cmtright = r_config_get_i (core->config, "graph.cmtright");
 	int o_cursor = core->print->cur_enabled;
 
-	const char *cmd = (opts & BODY_SUMMARY) ? "pds" : "pD";
+	const char *cmd = (opts & BODY_SUMMARY)? "pds": "pD";
 
 	// configure options
 	r_config_set_i (core->config, "asm.fcnlines", false);
@@ -1703,10 +1794,10 @@ static char *get_bb_body(RCore *core, RAnalBlock *b, int opts, RAnalFunction *fc
 	if (b->parent_stackptr != INT_MAX) {
 		core->anal->stackptr = b->parent_stackptr;
 	}
-	char * body = get_body (core, b->addr, b->size, opts);
+	char *body = get_body (core, b->addr, b->size, opts);
 	if (b->jump != UT64_MAX) {
 		if (b->jump > b->addr) {
-			RAnalBlock * jumpbb = r_anal_bb_get_jumpbb (fcn, b);
+			RAnalBlock *jumpbb = r_anal_bb_get_jumpbb (fcn, b);
 			if (jumpbb) {
 				if (emu && core->anal->last_disasm_reg != NULL && !jumpbb->parent_reg_arena) {
 					jumpbb->parent_reg_arena = r_reg_arena_dup (core->anal->reg, core->anal->last_disasm_reg);
@@ -1719,7 +1810,7 @@ static char *get_bb_body(RCore *core, RAnalBlock *b, int opts, RAnalFunction *fc
 	}
 	if (b->fail != UT64_MAX) {
 		if (b->fail > b->addr) {
-			RAnalBlock * failbb = r_anal_bb_get_failbb (fcn, b);
+			RAnalBlock *failbb = r_anal_bb_get_failbb (fcn, b);
 			if (failbb) {
 				if (emu && core->anal->last_disasm_reg != NULL && !failbb->parent_reg_arena) {
 					failbb->parent_reg_arena = r_reg_arena_dup (core->anal->reg, core->anal->last_disasm_reg);
@@ -1753,7 +1844,7 @@ static void get_bbupdate(RAGraph *g, RCore *core, RAnalFunction *fcn) {
 		R_FREE (saved_arena);
 		return;
 	}
-	r_list_sort (fcn->bbs, (RListComparator)bbcmp);
+	r_list_sort (fcn->bbs, (RListComparator) bbcmp);
 
 	r_list_foreach (fcn->bbs, iter, bb) {
 		RANode *node;
@@ -1804,7 +1895,7 @@ static int get_bbnodes(RAGraph *g, RCore *core, RAnalFunction *fcn) {
 	if (emu) {
 		saved_arena = r_reg_arena_peek (core->anal->reg);
 	}
-	r_list_sort (fcn->bbs, (RListComparator)bbcmp);
+	r_list_sort (fcn->bbs, (RListComparator) bbcmp);
 
 	core->keep_asmqjmps = false;
 	r_list_foreach (fcn->bbs, iter, bb) {
@@ -1839,8 +1930,9 @@ static int get_bbnodes(RAGraph *g, RCore *core, RAnalFunction *fcn) {
 		RANode *u, *v;
 		char *title;
 
-		if (bb->addr == UT64_MAX)
+		if (bb->addr == UT64_MAX) {
 			continue;
+		}
 
 		title = get_title (bb->addr);
 		u = r_agraph_get_node (g, title);
@@ -1893,7 +1985,9 @@ static int get_cgnodes(RAGraph *g, RCore *core, RAnalFunction *fcn) {
 	RAnalRef *ref;
 	char *title, *body;
 
-	if (!f) return false;
+	if (!f) {
+		return false;
+	}
 
 	r_core_seek (core, f->addr, 1);
 
@@ -1910,22 +2004,27 @@ static int get_cgnodes(RAGraph *g, RCore *core, RAnalFunction *fcn) {
 
 	r_list_foreach (fcn->refs, iter, ref) {
 		/* XXX: something is broken, why there are duplicated
-		 *      nodes here?! goto check fcn->refs!! */
+		*      nodes here?! goto check fcn->refs!! */
 		/* avoid dups wtf */
 		title = get_title (ref->addr);
-		if (r_agraph_get_node (g, title) != NULL)
-				continue;
+		if (r_agraph_get_node (g, title) != NULL) {
+			continue;
+		}
 		free (title);
 
 		int size = 0;
 		RAnalBlock *bb = r_anal_bb_from_offset (core->anal, ref->addr);
-		if (bb) size = bb->size;
+		if (bb) {
+			size = bb->size;
+		}
 
 		body = get_body (core, ref->addr, size, mode2opts (g));
 		title = get_title (ref->addr);
 
 		node = r_agraph_add_node (g, title, body);
-		if (!node) return false;
+		if (!node) {
+			return false;
+		}
 
 		free (title);
 		free (body);
@@ -1944,7 +2043,7 @@ static int get_cgnodes(RAGraph *g, RCore *core, RAnalFunction *fcn) {
 
 static int reload_nodes(RAGraph *g, RCore *core, RAnalFunction *fcn) {
 	int is_c = g->is_callgraph;
-	return is_c ? get_cgnodes (g, core, fcn) : get_bbnodes (g, core, fcn);
+	return is_c? get_cgnodes (g, core, fcn): get_bbnodes (g, core, fcn);
 }
 
 static void update_seek(RConsCanvas *can, RANode *n, int force) {
@@ -1967,7 +2066,7 @@ static void update_seek(RConsCanvas *can, RANode *n, int force) {
 	}
 }
 
-static int is_near (const RANode *n, int x, int y, int is_next) {
+static int is_near(const RANode *n, int x, int y, int is_next) {
 	if (is_next) {
 		return (n->y == y && n->x > x) || n->y > y;
 	}
@@ -1975,26 +2074,26 @@ static int is_near (const RANode *n, int x, int y, int is_next) {
 }
 
 /// XXX is wrong
-static int is_near_h (const RANode *n, int x, int y, int is_next) {
+static int is_near_h(const RANode *n, int x, int y, int is_next) {
 	if (is_next) {
 		return (n->x == x && n->y > y) || n->x > x;
 	}
 	return (n->x == x && n->y < y) || n->x < x;
 }
 
-static const RGraphNode *find_near_of (const RAGraph *g, const RGraphNode *cur, int is_next) {
+static const RGraphNode *find_near_of(const RAGraph *g, const RGraphNode *cur, int is_next) {
 	/* XXX: it's slow */
 	const RList *nodes = r_graph_get_nodes (g->graph);
 	const RListIter *it;
 	const RGraphNode *gn, *resgn = NULL;
-	const RANode *n, *acur = cur ? get_anode (cur) : NULL;
-	int default_v = is_next ? INT_MIN : INT_MAX;
-	int start_y = acur ? acur->y : default_v;
-	int start_x = acur ? acur->x : default_v;
+	const RANode *n, *acur = cur? get_anode (cur): NULL;
+	int default_v = is_next? INT_MIN: INT_MAX;
+	int start_y = acur? acur->y: default_v;
+	int start_x = acur? acur->x: default_v;
 
 	graph_foreach_anode (nodes, it, gn, n) {
 		bool isNear = g->layout
-			? is_near (n, start_x, start_y, is_next)
+		? is_near (n, start_x, start_y, is_next)
 			: is_near_h (n, start_x, start_y, is_next);
 		if (isNear) {
 			const RANode *resn;
@@ -2008,7 +2107,7 @@ static const RGraphNode *find_near_of (const RAGraph *g, const RGraphNode *cur,
 			if ((is_next && resn->y > n->y) || (!is_next && resn->y < n->y)) {
 				resgn = gn;
 			} else if ((is_next && resn->y == n->y && resn->x > n->x) ||
-					(!is_next && resn->y == n->y && resn->x < n->x)) {
+			(!is_next && resn->y == n->y && resn->x < n->x)) {
 				resgn = gn;
 			}
 		}
@@ -2019,7 +2118,7 @@ static const RGraphNode *find_near_of (const RAGraph *g, const RGraphNode *cur,
 	return resgn;
 }
 
-static void update_graph_sizes (RAGraph *g) {
+static void update_graph_sizes(RAGraph *g) {
 	RListIter *it;
 	RGraphNode *gk;
 	RANode *ak, *min_gn, *max_gn;
@@ -2032,12 +2131,16 @@ static void update_graph_sizes (RAGraph *g) {
 	min_gn = max_gn = NULL;
 
 	graph_foreach_anode (r_graph_get_nodes (g->graph), it, gk, ak) {
-		if (ak->x < g->x) g->x = ak->x;
+		if (ak->x < g->x) {
+			g->x = ak->x;
+		}
 		if (ak->y < g->y) {
 			g->y = ak->y;
 			min_gn = ak;
 		}
-		if (ak->x + ak->w > max_x) max_x = ak->x + ak->w;
+		if (ak->x + ak->w > max_x) {
+			max_x = ak->x + ak->w;
+		}
 		if (ak->y + ak->h > max_y) {
 			max_y = ak->y + ak->h;
 			max_gn = ak;
@@ -2056,17 +2159,25 @@ static void update_graph_sizes (RAGraph *g) {
 			if (r_cons_is_breaked ()) {
 				break;
 			}
-			v = (int)(size_t)vv;
-			if (v < g->x) g->x = v;
-			if (v + 1 > max_x) max_x = v + 1;
+			v = (int) (size_t) vv;
+			if (v < g->x) {
+				g->x = v;
+			}
+			if (v + 1 > max_x) {
+				max_x = v + 1;
+			}
 		}
 		r_list_foreach (e->y, kt, vv) {
 			if (r_cons_is_breaked ()) {
 				break;
 			}
-			v = (int)(size_t)vv;
-			if (v < g->y) g->y = v;
-			if (v + 1 > max_y) max_y = v + 1;
+			v = (int) (size_t) vv;
+			if (v < g->y) {
+				g->y = v;
+			}
+			if (v + 1 > max_y) {
+				max_y = v + 1;
+			}
 		}
 	}
 	r_cons_break_pop ();
@@ -2079,8 +2190,9 @@ static void update_graph_sizes (RAGraph *g) {
 		}
 		if (max_gn) {
 			const RList *neigh = r_graph_get_neighbours (g->graph, min_gn->gnode);
-			if (r_list_length (neigh) > 0)
+			if (r_list_length (neigh) > 0) {
 				max_y++;
+			}
 		}
 	}
 
@@ -2088,8 +2200,12 @@ static void update_graph_sizes (RAGraph *g) {
 		g->w = max_x - g->x;
 		if (g->title) {
 			size_t len = strlen (g->title);
-			if (len > INT_MAX) g->w = INT_MAX;
-			if ((int)len > g->w) g->w = len;
+			if (len > INT_MAX) {
+				g->w = INT_MAX;
+			}
+			if ((int) len > g->w) {
+				g->w = len;
+			}
 		}
 		g->h = max_y - g->y;
 	} else {
@@ -2100,9 +2216,9 @@ static void update_graph_sizes (RAGraph *g) {
 	sdb_num_set (g->db, "agraph.w", g->w, 0);
 	sdb_num_set (g->db, "agraph.h", g->h, 0);
 	/* delta_x, delta_y are needed to make every other x,y coordinates
-	 * unsigned, so that we can use sdb_num_ API */
-	delta_x = g->x < 0 ? -g->x : 0;
-	delta_y = g->y < 0 ? -g->y : 0;
+	* unsigned, so that we can use sdb_num_ API */
+	delta_x = g->x < 0? -g->x: 0;
+	delta_y = g->y < 0? -g->y: 0;
 	sdb_num_set (g->db, "agraph.delta_x", delta_x, 0);
 	sdb_num_set (g->db, "agraph.delta_y", delta_y, 0);
 }
@@ -2121,7 +2237,7 @@ R_API void r_agraph_set_curnode(RAGraph *g, RANode *a) {
 }
 
 static ut64 rebase(RAGraph *g, int v) {
-	return g->x < 0 ? -g->x + v : v;
+	return g->x < 0? -g->x + v: v;
 }
 
 static void agraph_set_layout(RAGraph *g, bool is_interactive) {
@@ -2167,7 +2283,7 @@ static void agraph_print_node(const RAGraph *g, RANode *n) {
 		} else {
 			if (n->h < 4) {
 				int titlen = strlen (n->title);
-				n->w = r_str_bounds (n->body, (int *)&n->h);
+				n->w = r_str_bounds (n->body, (int *) &n->h);
 				if (titlen > n->w) {
 					n->w = titlen + 6;
 				} else {
@@ -2198,8 +2314,8 @@ static void agraph_print_nodes(const RAGraph *g) {
 	}
 }
 
-static int find_ascii_edge (const AEdge *a, const AEdge *b) {
-	return a->from == b->from && a->to == b->to ? 0 : 1;
+static int find_ascii_edge(const AEdge *a, const AEdge *b) {
+	return a->from == b->from && a->to == b->to? 0: 1;
 }
 
 /* print an edge between two nodes.
@@ -2217,7 +2333,9 @@ static void agraph_print_edge(const RAGraph *g, RANode *a, RANode *b, int nth) {
 	xinc = 4 + 2 * (nth + 1);
 	x = a->x + xinc;
 	y = a->y + a->h;
-	if (nth > 1) nth = 1;
+	if (nth > 1) {
+		nth = 1;
+	}
 
 	switch (nth) {
 	case 0: style.color = LINE_TRUE; break;
@@ -2229,12 +2347,12 @@ static void agraph_print_edge(const RAGraph *g, RANode *a, RANode *b, int nth) {
 
 	e.from = a;
 	e.to = b;
-	it = r_list_find (g->edges, &e, (RListComparator)find_ascii_edge);
+	it = r_list_find (g->edges, &e, (RListComparator) find_ascii_edge);
 
 	switch (g->layout) {
 	case 0:
 	default:
-		it = r_list_find (g->edges, &e, (RListComparator)find_ascii_edge);
+		it = r_list_find (g->edges, &e, (RListComparator) find_ascii_edge);
 		if (it) {
 			int i, len;
 
@@ -2242,8 +2360,8 @@ static void agraph_print_edge(const RAGraph *g, RANode *a, RANode *b, int nth) {
 			len = r_list_length (edg->x);
 
 			for (i = 0; i < len; ++i) {
-				x2 = (int)(size_t)r_list_get_n (edg->x, i);
-				y2 = (int)(size_t)r_list_get_n (edg->y, i) - 1;
+				x2 = (int) (size_t) r_list_get_n (edg->x, i);
+				y2 = (int) (size_t) r_list_get_n (edg->y, i) - 1;
 
 				if (is_first && nth == 0 && x2 > x) {
 					xinc += 4;
@@ -2303,8 +2421,8 @@ static void agraph_print_edges(const RAGraph *g) {
 			int cur_nth = nth;
 			if (g->is_callgraph) {
 				/* hack: we don't support more than two exit edges from a node
-				 * yet, so set nth to zero, to make every edge appears as the
-				 * "true" edge of the node */
+				* yet, so set nth to zero, to make every edge appears as the
+				* "true" edge of the node */
 				cur_nth = 0;
 			} else if (exit_edges == 1) {
 				cur_nth = -1;
@@ -2321,8 +2439,8 @@ static void agraph_toggle_callgraph(RAGraph *g) {
 	g->force_update_seek = true;
 }
 
-static void agraph_set_zoom (RAGraph *g, int v) {
-	g->mode = v <= 0 ? R_AGRAPH_MODE_MINI : R_AGRAPH_MODE_NORMAL;
+static void agraph_set_zoom(RAGraph *g, int v) {
+	g->mode = v <= 0? R_AGRAPH_MODE_MINI: R_AGRAPH_MODE_NORMAL;
 	g->zoom = R_MAX (0, v);
 	g->need_update_dim = true;
 	g->need_set_layout = true;
@@ -2344,7 +2462,7 @@ static void follow_nth(RAGraph *g, int nth) {
 }
 
 #if GRAPH_MERGE_FEATURE
-#define K_NEIGHBOURS(x) (sdb_fmt(2, "agraph.nodes.%s.neighbours", x->title))
+#define K_NEIGHBOURS(x) (sdb_fmt (2, "agraph.nodes.%s.neighbours", x->title))
 static void agraph_merge_child(RAGraph *g, int idx) {
 	const RGraphNode *nn = r_graph_nth_neighbour (g->graph, g->curnode, idx);
 	const RGraphNode *cn = g->curnode;
@@ -2378,7 +2496,7 @@ static void agraph_toggle_mini(RAGraph *g) {
 	RANode *n = get_anode (g->curnode);
 	n->mini = !n->mini;
 	agraph_refresh (r_cons_singleton ()->event_data);
-	agraph_set_layout ((RAGraph *)g, r_cons_singleton() ->is_interactive);
+	agraph_set_layout ((RAGraph *) g, r_cons_singleton ()->is_interactive);
 }
 
 static void agraph_follow_true(RAGraph *g) {
@@ -2403,12 +2521,12 @@ static void agraph_prev_node(RAGraph *g) {
 	agraph_update_seek (g, get_anode (g->curnode), false);
 }
 
-static void agraph_update_title (RAGraph *g, RAnalFunction *fcn) {
-	const char *mode_str = g->is_callgraph ? mode2str (g, "CG") : mode2str (g, "BB");
+static void agraph_update_title(RAGraph *g, RAnalFunction *fcn) {
+	const char *mode_str = g->is_callgraph? mode2str (g, "CG"): mode2str (g, "BB");
 	char *new_title = r_str_newf (
-			"[0x%08"PFMT64x"]> VV @ %s (nodes %d edges %d zoom %d%%) %s mouse:%s movements-speed:%d",
-			fcn->addr, fcn->name, g->graph->n_nodes, g->graph->n_edges,
-			g->zoom, mode_str, mousemodes[mousemode], g->movspeed);
+		"[0x%08"PFMT64x "]> VV @ %s (nodes %d edges %d zoom %d%%) %s mouse:%s movements-speed:%d",
+		fcn->addr, fcn->name, g->graph->n_nodes, g->graph->n_edges,
+		g->zoom, mode_str, mousemodes[mousemode], g->movspeed);
 	r_agraph_set_title (g, new_title);
 	r_str_free (new_title);
 }
@@ -2416,8 +2534,10 @@ static void agraph_update_title (RAGraph *g, RAnalFunction *fcn) {
 /* look for any change in the state of the graph
  * and update what's necessary */
 static int check_changes(RAGraph *g, int is_interactive,
-		RCore *core, RAnalFunction *fcn) {
-	int oldpos[2] = {0, 0};
+                         RCore *core, RAnalFunction *fcn) {
+	int oldpos[2] = {
+		0, 0
+	};
 	if (g->need_reload_nodes && core) {
 		if (!g->update_seek_on && !g->force_update_seek) {
 			// save scroll here
@@ -2442,7 +2562,7 @@ static int check_changes(RAGraph *g, int is_interactive,
 		char *title = get_title (off);
 		RANode *cur_anode = get_anode (g->curnode);
 		if (fcn && ((is_interactive && !cur_anode) ||
-			(cur_anode && strcmp (cur_anode->title, title) != 0))) {
+		(cur_anode && strcmp (cur_anode->title, title) != 0))) {
 			g->update_seek_on = r_agraph_get_node (g, title);
 			if (g->update_seek_on) {
 				r_agraph_set_curnode (g, g->update_seek_on);
@@ -2455,8 +2575,12 @@ static int check_changes(RAGraph *g, int is_interactive,
 	}
 	if (g->update_seek_on || g->force_update_seek) {
 		RANode *n = g->update_seek_on;
-		if (!n && g->curnode) n = get_anode (g->curnode);
-		if (n) update_seek (g->can, n, g->force_update_seek);
+		if (!n && g->curnode) {
+			n = get_anode (g->curnode);
+		}
+		if (n) {
+			update_seek (g->can, n, g->force_update_seek);
+		}
 	}
 	if (oldpos[0] || oldpos[1]) {
 		g->can->sx = oldpos[0];
@@ -2473,7 +2597,9 @@ static int check_changes(RAGraph *g, int is_interactive,
 static int agraph_print(RAGraph *g, int is_interactive, RCore *core, RAnalFunction *fcn) {
 	int h, w = r_cons_get_size (&h);
 	int ret = check_changes (g, is_interactive, core, fcn);
-	if (!ret) return false;
+	if (!ret) {
+		return false;
+	}
 
 	if (is_interactive) {
 		r_cons_clear00 ();
@@ -2482,8 +2608,8 @@ static int agraph_print(RAGraph *g, int is_interactive, RCore *core, RAnalFuncti
 		update_graph_sizes (g);
 	}
 
-	h = is_interactive ? h : g->h + 1;
-	w = is_interactive ? w : g->w;
+	h = is_interactive? h: g->h + 1;
+	w = is_interactive? w: g->w;
 	r_cons_canvas_resize (g->can, w, h);
 	//r_cons_canvas_clear (g->can);
 	if (!is_interactive) {
@@ -2495,12 +2621,12 @@ static int agraph_print(RAGraph *g, int is_interactive, RCore *core, RAnalFuncti
 	agraph_print_nodes (g);
 
 	/* print the graph title */
-	(void)G (-g->can->sx, -g->can->sy);
+	(void) G (-g->can->sx, -g->can->sy);
 	W (g->title);
 	if (is_interactive && g->title) {
 		int title_len = strlen (g->title);
 		r_cons_canvas_fill (g->can, -g->can->sx + title_len, -g->can->sy,
-				w - title_len, 1, ' ', true);
+			w - title_len, 1, ' ', true);
 	}
 
 	r_cons_canvas_print_region (g->can);
@@ -2520,7 +2646,7 @@ static int agraph_print(RAGraph *g, int is_interactive, RCore *core, RAnalFuncti
 static int agraph_refresh(struct agraph_refresh_data *grd) {
 	RCore *core = grd->core;
 	RAGraph *g = grd->g;
-	RAnalFunction *f, **fcn = grd->fcn;
+	RAnalFunction *f, * *fcn = grd->fcn;
 
 	// allow to change the current function during debugging
 	if (g->is_instep && core->io->debug) {
@@ -2554,12 +2680,12 @@ static int agraph_refresh(struct agraph_refresh_data *grd) {
 		}
 	}
 
-	return agraph_print (g, grd->fs, core, fcn != NULL ? *fcn : NULL);
+	return agraph_print (g, grd->fs, core, fcn != NULL? *fcn: NULL);
 }
 
-static void agraph_toggle_speed (RAGraph *g, RCore *core) {
+static void agraph_toggle_speed(RAGraph *g, RCore *core) {
 	int alt = r_config_get_i (core->config, "graph.scroll");
-	g->movspeed = g->movspeed == DEFAULT_SPEED ? alt : DEFAULT_SPEED;
+	g->movspeed = g->movspeed == DEFAULT_SPEED? alt: DEFAULT_SPEED;
 }
 
 static void agraph_init(RAGraph *g) {
@@ -2577,30 +2703,32 @@ static void agraph_init(RAGraph *g) {
 	g->db = sdb_new0 ();
 }
 
-static void free_anode (RANode *n) {
+static void free_anode(RANode *n) {
 	free (n->title);
 	free (n->body);
 }
 
-static int free_anode_cb (void *user UNUSED, const char *k UNUSED, const char *v) {
-	RANode *n = (RANode *)(size_t)sdb_atoi(v);
-	if (!n) return 0;
+static int free_anode_cb(void *user UNUSED, const char *k UNUSED, const char *v) {
+	RANode *n = (RANode *) (size_t) sdb_atoi (v);
+	if (!n) {
+		return 0;
+	}
 	free_anode (n);
 	return 1;
 }
 
-static void agraph_free_nodes (const RAGraph *g) {
-	sdb_foreach (g->nodes, (SdbForeachCallback)free_anode_cb, NULL);
+static void agraph_free_nodes(const RAGraph *g) {
+	sdb_foreach (g->nodes, (SdbForeachCallback) free_anode_cb, NULL);
 	sdb_free (g->nodes);
 }
 
-static void sdb_set_enc (Sdb *db, const char *key, const char *v, ut32 cas) {
-	char *estr = sdb_encode ((const void *)v, -1);
+static void sdb_set_enc(Sdb *db, const char *key, const char *v, ut32 cas) {
+	char *estr = sdb_encode ((const void *) v, -1);
 	sdb_set (db, key, estr, cas);
 	free (estr);
 }
 
-static void agraph_sdb_init (const RAGraph *g) {
+static void agraph_sdb_init(const RAGraph *g) {
 	sdb_bool_set (g->db, "agraph.is_callgraph", g->is_callgraph, 0);
 	sdb_set_enc (g->db, "agraph.color_box", g->color_box, 0);
 	sdb_set_enc (g->db, "agraph.color_box2", g->color_box2, 0);
@@ -2609,23 +2737,23 @@ static void agraph_sdb_init (const RAGraph *g) {
 	sdb_set_enc (g->db, "agraph.color_false", g->color_false, 0);
 }
 
-R_API Sdb *r_agraph_get_sdb (RAGraph *g) {
+R_API Sdb *r_agraph_get_sdb(RAGraph *g) {
 	g->need_update_dim = true;
 	g->need_set_layout = true;
 	check_changes (g, false, NULL, NULL);
 	return g->db;
 }
 
-R_API void r_agraph_print (RAGraph *g) {
+R_API void r_agraph_print(RAGraph *g) {
 	agraph_print (g, false, NULL, NULL);
 	if (g->graph->n_nodes > 0) {
 		r_cons_newline ();
 	}
 }
 
-R_API void r_agraph_set_title (RAGraph *g, const char *title) {
+R_API void r_agraph_set_title(RAGraph *g, const char *title) {
 	free (g->title);
-	g->title = title ? strdup (title) : NULL;
+	g->title = title? strdup (title): NULL;
 	sdb_set (g->db, "agraph.title", g->title, 0);
 }
 
@@ -2638,15 +2766,15 @@ R_API RANode *r_agraph_add_node(const RAGraph *g, const char *title, const char
 	if (!res) {
 		return NULL;
 	}
-	res->title = title ? strdup (title) : strdup ("");
-	res->body = body ? strdup (body) : strdup ("");
+	res->title = title? strdup (title): strdup ("");
+	res->body = body? strdup (body): strdup ("");
 	res->layer = -1;
 	res->pos_in_layer = -1;
 	res->is_dummy = false;
 	res->is_reversed = false;
 	res->klass = -1;
 	res->gnode = r_graph_add_node (g->graph, res);
-	sdb_num_set (g->nodes, title, (ut64)(size_t)res, 0);
+	sdb_num_set (g->nodes, title, (ut64) (size_t) res, 0);
 	if (res->title) {
 		char *s, *estr, *b;
 		size_t len;
@@ -2656,7 +2784,7 @@ R_API RANode *r_agraph_add_node(const RAGraph *g, const char *title, const char
 		if (len > 0 && b[len - 1] == '\n') {
 			b[len - 1] = '\0';
 		}
-		estr = sdb_encode ((const void *)b, -1);
+		estr = sdb_encode ((const void *) b, -1);
 		s = sdb_fmt (1, "base64:%s", estr);
 		free (estr);
 		free (b);
@@ -2700,8 +2828,10 @@ R_API bool r_agraph_del_node(const RAGraph *g, const char *title) {
 static int user_node_cb(struct g_cb *user, const char *k UNUSED, const char *v) {
 	RANodeCallback cb = user->node_cb;
 	void *user_data = user->data;
-	RANode *n = (RANode *)(size_t)sdb_atoi (v);
-	if (n) cb (n, user_data);
+	RANode *n = (RANode *) (size_t) sdb_atoi (v);
+	if (n) {
+		cb (n, user_data);
+	}
 	return 1;
 }
 
@@ -2709,8 +2839,10 @@ static int user_edge_cb(struct g_cb *user, const char *k UNUSED, const char *v)
 	RAEdgeCallback cb = user->edge_cb;
 	RAGraph *g = user->graph;
 	void *user_data = user->data;
-	RANode *an, *n = (RANode *)(size_t)sdb_atoi (v);
-	if (!n) return 0;
+	RANode *an, *n = (RANode *) (size_t) sdb_atoi (v);
+	if (!n) {
+		return 0;
+	}
 	const RList *neigh = r_graph_get_neighbours (g->graph, n->gnode);
 	RListIter *it;
 	RGraphNode *gn;
@@ -2725,7 +2857,7 @@ R_API void r_agraph_foreach(RAGraph *g, RANodeCallback cb, void *user) {
 	struct g_cb u;
 	u.node_cb = cb;
 	u.data = user;
-	sdb_foreach (g->nodes, (SdbForeachCallback)user_node_cb, &u);
+	sdb_foreach (g->nodes, (SdbForeachCallback) user_node_cb, &u);
 }
 
 R_API void r_agraph_foreach_edge(RAGraph *g, RAEdgeCallback cb, void *user) {
@@ -2733,7 +2865,7 @@ R_API void r_agraph_foreach_edge(RAGraph *g, RAEdgeCallback cb, void *user) {
 	u.graph = g;
 	u.edge_cb = cb;
 	u.data = user;
-	sdb_foreach (g->nodes, (SdbForeachCallback)user_edge_cb, &u);
+	sdb_foreach (g->nodes, (SdbForeachCallback) user_edge_cb, &u);
 }
 
 R_API RANode *r_agraph_get_first_node(const RAGraph *g) {
@@ -2743,11 +2875,13 @@ R_API RANode *r_agraph_get_first_node(const RAGraph *g) {
 }
 
 R_API RANode *r_agraph_get_node(const RAGraph *g, const char *title) {
-	return (RANode *)(size_t)sdb_num_get (g->nodes, title, NULL);
+	return (RANode *) (size_t) sdb_num_get (g->nodes, title, NULL);
 }
 
 R_API void r_agraph_add_edge(const RAGraph *g, RANode *a, RANode *b) {
-	if (!g || !a || !b) return;
+	if (!g || !a || !b) {
+		return;
+	}
 	r_graph_add_edge (g->graph, a->gnode, b->gnode);
 	if (a->title && b->title) {
 		char *k = sdb_fmt (1, "agraph.nodes.%s.neighbours", a->title);
@@ -2756,7 +2890,9 @@ R_API void r_agraph_add_edge(const RAGraph *g, RANode *a, RANode *b) {
 }
 
 R_API void r_agraph_add_edge_at(const RAGraph *g, RANode *a, RANode *b, int nth) {
-	if (!g || !a || !b) return;
+	if (!g || !a || !b) {
+		return;
+	}
 	if (a->title && b->title) {
 		char *k = sdb_fmt (1, "agraph.nodes.%s.neighbours", a->title);
 		sdb_array_insert (g->db, k, nth, b->title, 0);
@@ -2765,7 +2901,9 @@ R_API void r_agraph_add_edge_at(const RAGraph *g, RANode *a, RANode *b, int nth)
 }
 
 R_API void r_agraph_del_edge(const RAGraph *g, RANode *a, RANode *b) {
-	if (!g || !a || !b) return;
+	if (!g || !a || !b) {
+		return;
+	}
 	if (a->title && b->title) {
 		char *k = sdb_fmt (1, "agraph.nodes.%s.neighbours", a->title);
 		sdb_array_remove (g->db, k, b->title, 0);
@@ -2773,7 +2911,7 @@ R_API void r_agraph_del_edge(const RAGraph *g, RANode *a, RANode *b) {
 	r_graph_del_edge (g->graph, a->gnode, b->gnode);
 }
 
-R_API void r_agraph_reset (RAGraph *g) {
+R_API void r_agraph_reset(RAGraph *g) {
 	r_graph_reset (g->graph);
 	agraph_free_nodes (g);
 	r_agraph_set_title (g, NULL);
@@ -2802,14 +2940,16 @@ R_API void r_agraph_free(RAGraph *g) {
 
 R_API RAGraph *r_agraph_new(RConsCanvas *can) {
 	RAGraph *g = R_NEW0 (RAGraph);
-	if (!g) return NULL;
+	if (!g) {
+		return NULL;
+	}
 	g->can = can;
 	agraph_init (g);
 	agraph_sdb_init (g);
 	return g;
 }
 
-static void visual_offset (RAGraph *g, RCore *core) {
+static void visual_offset(RAGraph *g, RCore *core) {
 	char buf[256];
 	int rows;
 	r_cons_get_size (&rows);
@@ -2844,7 +2984,7 @@ static void goto_asmqjmps(RAGraph *g, RCore *core) {
 		obuf[i++] = ch;
 		r_cons_printf ("%c", ch);
 		r_cons_flush ();
-		cont = isalpha ((ut8)ch) && !islower ((ut8)ch);
+		cont = isalpha ((ut8) ch) && !islower ((ut8) ch);
 	} while (i < R_CORE_ASMQJMPS_LEN_LETTERS && cont);
 
 	obuf[i] = '\0';
@@ -2907,7 +3047,7 @@ R_API int r_core_visual_graph(RCore *core, RAGraph *g, RAnalFunction *_fcn, int
 	r_config_save_num (hc, "asm.cmtright", NULL);
 	if (!g) {
 		graph_allocated = true;
-		fcn = _fcn ? _fcn : r_anal_get_fcn_in (core->anal, core->offset, 0);
+		fcn = _fcn? _fcn: r_anal_get_fcn_in (core->anal, core->offset, 0);
 		if (!fcn) {
 			eprintf ("No function in current seek\n");
 			r_config_restore (hc);
@@ -2928,11 +3068,11 @@ R_API int r_core_visual_graph(RCore *core, RAGraph *g, RAnalFunction *_fcn, int
 	r_config_set_i (core->config, "scr.interactive", false);
 	g->can = can;
 	g->movspeed = r_config_get_i (core->config, "graph.scroll");
-	g->on_curnode_change = (RANodeCallback)seek_to_node;
+	g->on_curnode_change = (RANodeCallback) seek_to_node;
 	g->on_curnode_change_data = core;
 	bool asm_comments = r_config_get_i (core->config, "asm.comments");
-	r_config_set (core->config, "asm.comments", 
-	  	r_str_bool (r_config_get_i (core->config, "graph.comments")));
+	r_config_set (core->config, "asm.comments",
+		r_str_bool (r_config_get_i (core->config, "graph.comments")));
 
 	/* we want letters as shortcuts for call/jmps */
 	core->is_asmqjmps_letter = true;
@@ -2948,7 +3088,7 @@ R_API int r_core_visual_graph(RCore *core, RAGraph *g, RAnalFunction *_fcn, int
 	grd->g = g;
 	grd->fs = is_interactive;
 	grd->core = core;
-	grd->fcn = fcn != NULL ? &fcn : NULL;
+	grd->fcn = fcn != NULL? &fcn: NULL;
 	ret = agraph_refresh (grd);
 	if (!ret || !is_interactive) {
 		r_cons_newline ();
@@ -2957,7 +3097,7 @@ R_API int r_core_visual_graph(RCore *core, RAGraph *g, RAnalFunction *_fcn, int
 	}
 
 	core->cons->event_data = grd;
-	core->cons->event_resize = (RConsEvent)agraph_refresh;
+	core->cons->event_resize = (RConsEvent) agraph_refresh;
 	r_cons_break_push (NULL, NULL);
 
 	while (!exit_graph && !is_error && !r_cons_is_breaked ()) {
@@ -2986,9 +3126,9 @@ R_API int r_core_visual_graph(RCore *core, RAGraph *g, RAnalFunction *_fcn, int
 			case 'k':
 				switch (mousemode) {
 				case 0: break;
-				case 1: key = key=='k'?'h':'l'; break;
-				case 2: key = key=='k'?'J':'K'; break;
-				case 3: key = key=='k'?'L':'H'; break;
+				case 1: key = key == 'k'? 'h': 'l'; break;
+				case 2: key = key == 'k'? 'J': 'K'; break;
+				case 3: key = key == 'k'? 'L': 'H'; break;
 				}
 				break;
 			}
@@ -3008,16 +3148,16 @@ R_API int r_core_visual_graph(RCore *core, RAGraph *g, RAnalFunction *_fcn, int
 			agraph_update_seek (g, get_anode (g->curnode), true);
 			break;
 		case '|':
-			{ // TODO: edit
-				const char *buf = NULL;
-				const char *cmd = r_config_get (core->config, "cmd.gprompt");
-				r_line_set_prompt ("cmd.gprompt> ");
-				core->cons->line->contents = strdup (cmd);
-				buf = r_line_readline ();
-				core->cons->line->contents = NULL;
-				r_config_set (core->config, "cmd.gprompt", buf);
-			}
-			break;
+		{         // TODO: edit
+			const char *buf = NULL;
+			const char *cmd = r_config_get (core->config, "cmd.gprompt");
+			r_line_set_prompt ("cmd.gprompt> ");
+			core->cons->line->contents = strdup (cmd);
+			buf = r_line_readline ();
+			core->cons->line->contents = NULL;
+			r_config_set (core->config, "cmd.gprompt", buf);
+		}
+		break;
 		case '>':
 			r_core_cmd0 (core, "ag-;.agc* $$;aggi");
 			break;
@@ -3063,13 +3203,15 @@ R_API int r_core_visual_graph(RCore *core, RAGraph *g, RAnalFunction *_fcn, int
 		case 'x':
 		case 'X':
 		{
-			if (!fcn) break;
+			if (!fcn) {
+				break;
+			}
 
 			ut64 old_off = core->offset;
 			ut64 off = r_core_anal_get_bbaddr (core, core->offset);
 			r_core_seek (core, off, 0);
 			if ((key == 'x' && !r_core_visual_xrefs_x (core)) ||
-				(key == 'X' && !r_core_visual_xrefs_X (core))) {
+			(key == 'X' && !r_core_visual_xrefs_X (core))) {
 				r_core_seek (core, old_off, 0);
 			}
 			break;
@@ -3080,42 +3222,42 @@ R_API int r_core_visual_graph(RCore *core, RAGraph *g, RAnalFunction *_fcn, int
 		case '?':
 			r_cons_clear00 ();
 			r_cons_printf ("Visual Ascii Art graph keybindings:\n"
-					" +/-/0        - zoom in/out/default\n"
-					" ;            - add comment in current basic block\n"
-					" .            - center graph to the current node\n"
-					" :cmd         - run radare command\n"
-					" '            - toggle graph.comments\n"
-					" \"            - toggle graph.refs\n"
-					" /            - highlight text\n"
-					" |            - set cmd.gprompt\n"
-					" >            - show function callgraph (see graph.refs)\n"
-					" <            - show program callgraph (see graph.refs)\n"
-					" Home/End     - go to the top/bottom of the canvas\n"
-					" Page-UP/DOWN - scroll canvas up/down\n"
-					" C            - toggle scr.colors\n"
-					" d            - rename function\n"
-					" hjkl         - scroll canvas\n"
-					" HJKL         - move node\n"
-					" m/M          - change mouse modes\n"
-					" y            - toggle node folding/minification\n"
-					" n/N          - next/previous scr.nkey (function/flag..)\n"
-					" tab          - select next node\n"
-					" TAB          - select previous node\n"
-					" t/f          - follow true/false edges\n"
-					" g([A-Za-z]*) - follow jmp/call identified by shortcut\n"
-					" G            - debug trace callgraph (generated with dtc)\n"
-					" F            - enter flag selector\n"
-					" _            - enter hud selector\n"
-					" o            - go/seek to given offset\n"
-					" r            - refresh graph\n"
-					" R            - randomize colors\n"
-					" u/U          - undo/redo seek\n"
-					" p/P          - rotate graph modes (normal, display offsets, minigraph, summary)\n"
-					" s/S          - step / step over\n"
-					" V            - toggle basicblock / call graphs\n"
-					" w            - toggle between movements speed 1 and graph.scroll\n"
-					" x/X          - jump to xref/ref\n"
-					" Z            - follow parent node");
+				" +/-/0        - zoom in/out/default\n"
+				" ;            - add comment in current basic block\n"
+				" .            - center graph to the current node\n"
+				" :cmd         - run radare command\n"
+				" '            - toggle graph.comments\n"
+				" \"            - toggle graph.refs\n"
+				" /            - highlight text\n"
+				" |            - set cmd.gprompt\n"
+				" >            - show function callgraph (see graph.refs)\n"
+				" <            - show program callgraph (see graph.refs)\n"
+				" Home/End     - go to the top/bottom of the canvas\n"
+				" Page-UP/DOWN - scroll canvas up/down\n"
+				" C            - toggle scr.colors\n"
+				" d            - rename function\n"
+				" hjkl         - scroll canvas\n"
+				" HJKL         - move node\n"
+				" m/M          - change mouse modes\n"
+				" y            - toggle node folding/minification\n"
+				" n/N          - next/previous scr.nkey (function/flag..)\n"
+				" tab          - select next node\n"
+				" TAB          - select previous node\n"
+				" t/f          - follow true/false edges\n"
+				" g([A-Za-z]*) - follow jmp/call identified by shortcut\n"
+				" G            - debug trace callgraph (generated with dtc)\n"
+				" F            - enter flag selector\n"
+				" _            - enter hud selector\n"
+				" o            - go/seek to given offset\n"
+				" r            - refresh graph\n"
+				" R            - randomize colors\n"
+				" u/U          - undo/redo seek\n"
+				" p/P          - rotate graph modes (normal, display offsets, minigraph, summary)\n"
+				" s/S          - step / step over\n"
+				" V            - toggle basicblock / call graphs\n"
+				" w            - toggle between movements speed 1 and graph.scroll\n"
+				" x/X          - jump to xref/ref\n"
+				" Z            - follow parent node");
 			r_cons_flush ();
 			r_cons_any_key (NULL);
 			break;
@@ -3123,12 +3265,16 @@ R_API int r_core_visual_graph(RCore *core, RAGraph *g, RAnalFunction *_fcn, int
 			r_config_toggle (core->config, "graph.refs");
 			break;
 		case 'p':
-			if (!fcn) break;
+			if (!fcn) {
+				break;
+			}
 			g->mode = next_mode (g->mode);
 			g->need_reload_nodes = true;
 			break;
 		case 'P':
-			if (!fcn) break;
+			if (!fcn) {
+				break;
+			}
 			g->mode = prev_mode (g->mode);
 			g->need_reload_nodes = true;
 			break;
@@ -3140,7 +3286,9 @@ R_API int r_core_visual_graph(RCore *core, RAGraph *g, RAnalFunction *_fcn, int
 			break;
 		case 'u':
 		{
-			if (!fcn) break;
+			if (!fcn) {
+				break;
+			}
 			RIOUndos *undo = r_io_sundo (core->io, core->offset);
 			if (undo) {
 				r_core_seek (core, undo->off, 0);
@@ -3151,7 +3299,9 @@ R_API int r_core_visual_graph(RCore *core, RAGraph *g, RAnalFunction *_fcn, int
 		}
 		case 'U':
 		{
-			if (!fcn) break;
+			if (!fcn) {
+				break;
+			}
 			RIOUndos *undo = r_io_sundo_redo (core->io);
 			if (undo) {
 				r_core_seek (core, undo->off, 0);
@@ -3167,7 +3317,9 @@ R_API int r_core_visual_graph(RCore *core, RAGraph *g, RAnalFunction *_fcn, int
 			}
 			break;
 		case 'R':
-			if (!fcn) break;
+			if (!fcn) {
+				break;
+			}
 			if (r_config_get_i (core->config, "scr.randpal")) {
 				r_core_cmd0 (core, "ecr");
 			} else {
@@ -3215,17 +3367,17 @@ R_API int r_core_visual_graph(RCore *core, RAGraph *g, RAnalFunction *_fcn, int
 			}
 			break;
 		case 'd':
-			{
-				char *newname = r_cons_input ("New function name:");
-				if (newname) {
-					if (*newname) {
-						r_core_cmdf (core, "\"afn %s\"", newname);
-						get_bbupdate (g, core, fcn);
-					}
-					free (newname);
+		{
+			char *newname = r_cons_input ("New function name:");
+			if (newname) {
+				if (*newname) {
+					r_core_cmdf (core, "\"afn %s\"", newname);
+					get_bbupdate (g, core, fcn);
 				}
+				free (newname);
 			}
-			break;
+		}
+		break;
 		case 'n':
 			r_core_seek_next (core, r_config_get (core->config, "scr.nkey"));
 			break;
@@ -3238,7 +3390,7 @@ R_API int r_core_visual_graph(RCore *core, RAGraph *g, RAnalFunction *_fcn, int
 		case 'J':
 			if (okey == 27) { // && r_cons_readchar () == 126) {
 				// handle page down key
-				can->sy -= PAGEKEY_SPEED * (invscroll ? -1 : 1);
+				can->sy -= PAGEKEY_SPEED * (invscroll? -1: 1);
 			} else {
 				RANode *n = get_anode (g->curnode);
 				if (n) {
@@ -3249,7 +3401,7 @@ R_API int r_core_visual_graph(RCore *core, RAGraph *g, RAnalFunction *_fcn, int
 		case 'K':
 			if (okey == 27) { // && r_cons_readchar () == 126) {
 				// handle page up key
-				can->sy += PAGEKEY_SPEED * (invscroll ? -1 : 1);
+				can->sy += PAGEKEY_SPEED * (invscroll? -1: 1);
 			} else {
 				RANode *n = get_anode (g->curnode);
 				if (n) {
@@ -3272,18 +3424,18 @@ R_API int r_core_visual_graph(RCore *core, RAGraph *g, RAnalFunction *_fcn, int
 		case 'v':
 			r_core_visual_anal (core);
 			break;
-		case 'L': 
-			 {
-				RANode *n = get_anode (g->curnode);
-				if (n) {
-					n->x += movspeed;
-				}
-				break;
-			 }
-		case 'j': can->sy -= movspeed * (invscroll ? -1 : 1); break;
-		case 'k': can->sy += movspeed * (invscroll ? -1 : 1); break;
-		case 'l': can->sx -= movspeed * (invscroll ? -1 : 1); break;
-		case 'h': can->sx += movspeed * (invscroll ? -1 : 1); break;
+		case 'L':
+		{
+			RANode *n = get_anode (g->curnode);
+			if (n) {
+				n->x += movspeed;
+			}
+			break;
+		}
+		case 'j': can->sy -= movspeed * (invscroll? -1: 1); break;
+		case 'k': can->sy += movspeed * (invscroll? -1: 1); break;
+		case 'l': can->sx -= movspeed * (invscroll? -1: 1); break;
+		case 'h': can->sx += movspeed * (invscroll? -1: 1); break;
 		case '.':
 			agraph_update_seek (g, get_anode (g->curnode), true);
 			break;
@@ -3302,7 +3454,7 @@ R_API int r_core_visual_graph(RCore *core, RAGraph *g, RAnalFunction *_fcn, int
 				const RGraphNode *gn = find_near_of (g, NULL, false);
 				g->update_seek_on = get_anode (gn);
 			} else {
-			//	agraph_merge_child (g, 1);
+				//	agraph_merge_child (g, 1);
 				r_core_visual_trackflags (core);
 			}
 			break;
diff --git a/libr/core/yank.c b/libr/core/yank.c
index a3d90cdea8..90f6d074e8 100644
--- a/libr/core/yank.c
+++ b/libr/core/yank.c
@@ -38,19 +38,19 @@ static int perform_mapped_file_yank(RCore *core, ut64 offset, ut64 len, const ch
 	// grab the current file descriptor, so we can reset core and io state
 	// after our io op is done
 	RIODesc *yankfd = NULL;
-	ut64 fd = core->file ? core->file->desc->fd : -1, yank_file_sz = 0,
-		 loadaddr = 0, addr = offset;
+	ut64 fd = core->file? core->file->desc->fd: -1, yank_file_sz = 0,
+	loadaddr = 0, addr = offset;
 	int res = false;
 
 	if (filename && *filename) {
 		ut64 load_align = r_config_get_i (core->config, "file.loadalign");
-		RIOMap * map = NULL;
+		RIOMap *map = NULL;
 		yankfd = r_io_open_nomap (core->io, filename, R_IO_READ, 0644);
 		// map the file in for IO operations.
 		if (yankfd && load_align) {
 			yank_file_sz = r_io_size (core->io);
 			map = r_io_map_add_next_available (core->io, yankfd->fd, R_IO_READ, 0, 0, yank_file_sz, load_align);
-			loadaddr = map ? map->from : -1;
+			loadaddr = map? map->from: -1;
 			if (yankfd && map && loadaddr != -1) {
 				// ***NOTE*** this is important, we need to
 				// address the file at its physical address!
@@ -74,7 +74,7 @@ static int perform_mapped_file_yank(RCore *core, ut64 offset, ut64 len, const ch
 	// map into the IO layer
 	if (yankfd) {
 		ut64 res = r_io_seek (core->io, addr, R_IO_SEEK_SET);
-		ut64 actual_len = len <= yank_file_sz ? len : 0;
+		ut64 actual_len = len <= yank_file_sz? len: 0;
 		ut8 *buf = NULL;
 		if (actual_len > 0 && res == addr) {
 			buf = malloc (actual_len);
@@ -91,7 +91,7 @@ static int perform_mapped_file_yank(RCore *core, ut64 offset, ut64 len, const ch
 		} else if (actual_len == 0) {
 			eprintf (
 				"ERROR: Unable to yank from file: addr+len (0x%"
-				PFMT64x ") > file_sz (0x%"PFMT64x ")\n", addr+len,
+				PFMT64x ") > file_sz (0x%"PFMT64x ")\n", addr + len,
 				yank_file_sz );
 		}
 		r_io_close (core->io, yankfd);
@@ -118,9 +118,9 @@ R_API int r_core_yank_set(RCore *core, ut64 addr, const ut8 *buf, ut32 len) {
 // Call set and then null terminate the bytes.
 R_API int r_core_yank_set_str(RCore *core, ut64 addr, const char *str, ut32 len) {
 	//free (core->yank_buf);
-	int res = r_core_yank_set (core, addr, (ut8*)str, len);
+	int res = r_core_yank_set (core, addr, (ut8 *) str, len);
 	if (res == true) {
-		core->yank_buf->buf[len-1] = 0;
+		core->yank_buf->buf[len - 1] = 0;
 	}
 	return res;
 }
@@ -171,7 +171,7 @@ R_API int r_core_yank_string(RCore *core, ut64 addr, int maxlen) {
 	r_core_read_at (core, addr, buf, core->blocksize);
 	if (maxlen == 0) {
 		// Don't use strnlen, see: http://sourceforge.net/p/mingw/bugs/1912/
-		maxlen = r_str_nlen ((const char*)buf, core->blocksize);
+		maxlen = r_str_nlen ((const char *) buf, core->blocksize);
 	} else if (maxlen > core->blocksize) {
 		maxlen = core->blocksize;
 	}
@@ -200,7 +200,7 @@ R_API int r_core_yank_to(RCore *core, const char *_arg) {
 	char *str, *arg;
 	int res = false;
 
-	while (*_arg==' ') {
+	while (*_arg == ' ') {
 		_arg++;
 	}
 	arg = strdup (_arg);
@@ -208,7 +208,7 @@ R_API int r_core_yank_to(RCore *core, const char *_arg) {
 	if (str) {
 		str[0] = '\0';
 		len = r_num_math (core->num, arg);
-		pos = r_num_math (core->num, str+1);
+		pos = r_num_math (core->num, str + 1);
 		str[0] = ' ';
 	}
 	if (len < 1) {
@@ -231,10 +231,10 @@ R_API int r_core_yank_dump(RCore *core, ut64 pos) {
 	int res = false, i = 0;
 	int ybl = core->yank_buf->length;
 	if (ybl > 0) {
-		if (pos<ybl) {
+		if (pos < ybl) {
 			r_cons_printf ("0x%08"PFMT64x " %d ",
-				core->yank_buf->base+pos,
-				core->yank_buf->length-pos);
+				core->yank_buf->base + pos,
+				core->yank_buf->length - pos);
 			for (i = pos; i < core->yank_buf->length; i++) {
 				r_cons_printf ("%02x",
 					core->yank_buf->buf[i]);
@@ -272,7 +272,7 @@ R_API int r_core_yank_cat(RCore *core, ut64 pos) {
 	int ybl = core->yank_buf->length;
 	if (ybl > 0) {
 		if (pos < ybl) {
-			r_cons_memcat ((const char*)core->yank_buf->buf + pos,
+			r_cons_memcat ((const char *) core->yank_buf->buf + pos,
 				core->yank_buf->length - pos);
 			r_cons_newline ();
 			return true;
@@ -288,8 +288,8 @@ R_API int r_core_yank_cat_string(RCore *core, ut64 pos) {
 	int ybl = core->yank_buf->length;
 	if (ybl > 0) {
 		if (pos < ybl) {
-			int len = r_str_nlen ((const char *)core->yank_buf->buf + pos, ybl - pos);
-			r_cons_memcat ((const char*)core->yank_buf->buf + pos, len);
+			int len = r_str_nlen ((const char *) core->yank_buf->buf + pos, ybl - pos);
+			r_cons_memcat ((const char *) core->yank_buf->buf + pos, len);
 			r_cons_newline ();
 			return true;
 		}
@@ -311,7 +311,7 @@ R_API int r_core_yank_hud_file(RCore *core, const char *input) {
 		/* nothing */
 	}
 	buf = r_cons_hud_file (input);
-	len = buf ? strlen ((const char*)buf) + 1 : 0;
+	len = buf? strlen ((const char *) buf) + 1: 0;
 	res = r_core_yank_set_str (core, R_CORE_FOREIGN_ADDR, buf, len);
 	free (buf);
 	return res;
@@ -321,11 +321,11 @@ R_API int r_core_yank_hud_path(RCore *core, const char *input, int dir) {
 	char *buf = NULL;
 	ut32 len = 0;
 	int res;
-	for (input++; *input==' '; input++) {
+	for (input++; *input == ' '; input++) {
 		/* nothing */
 	}
 	buf = r_cons_hud_path (input, dir);
-	len = buf ? strlen ((const char*)buf) + 1 : 0;
+	len = buf? strlen ((const char *) buf) + 1: 0;
 	res = r_core_yank_set_str (core, R_CORE_FOREIGN_ADDR, buf, len);
 	free (buf);
 	return res;
@@ -340,13 +340,13 @@ R_API bool r_core_yank_file_ex(RCore *core, const char *input) {
 	}
 	// get the number of bytes to yank
 	adv = consume_chars (input, ' ');
-	len = r_num_math (core->num, input+adv);
+	len = r_num_math (core->num, input + adv);
 	if (len == 0) {
 		eprintf ("ERROR: Number of bytes read must be > 0\n");
 		return res;
 	}
 	// get the addr/offset from in the file we want to read
-	adv += find_next_char (input+adv, ' ');
+	adv += find_next_char (input + adv, ' ');
 	if (adv == 0) {
 		eprintf ("ERROR: Address must be specified\n");
 		return res;
@@ -354,9 +354,9 @@ R_API bool r_core_yank_file_ex(RCore *core, const char *input) {
 	adv++;
 
 	// XXX - bug, will fail if address needs to be computed and has spaces
-	addr = r_num_math (core->num, input+adv);
+	addr = r_num_math (core->num, input + adv);
 
-	adv += find_next_char (input+adv, ' ');
+	adv += find_next_char (input + adv, ' ');
 	if (adv == 0) {
 		eprintf ("ERROR: File must be specified\n");
 		return res;
@@ -365,7 +365,7 @@ R_API bool r_core_yank_file_ex(RCore *core, const char *input) {
 
 	// grab the current file descriptor, so we can reset core and io state
 	// after our io op is done
-	return perform_mapped_file_yank (core, addr, len, input+adv);
+	return perform_mapped_file_yank (core, addr, len, input + adv);
 }
 
 R_API int r_core_yank_file_all(RCore *core, const char *input) {
@@ -374,5 +374,5 @@ R_API int r_core_yank_file_all(RCore *core, const char *input) {
 		return false;
 	}
 	adv = consume_chars (input, ' ');
-	return perform_mapped_file_yank (core, 0, -1, input+adv);
+	return perform_mapped_file_yank (core, 0, -1, input + adv);
 }
diff --git a/sys/indent.sh b/sys/indent.sh
index 6bad85e0e4..317e1fccb4 100755
--- a/sys/indent.sh
+++ b/sys/indent.sh
@@ -1,5 +1,11 @@
 #!/bin/sh
 
+# known bugs
+# ----------
+# - labels are indented
+# - #if 0 code is indented
+# - //comment should be // comment
+
 IFILE="$1"
 P=`readlink $0`
 cd `dirname $P`/..