Update coding style rules for braces

This commit is contained in:
pancake 2018-02-28 01:24:03 +01:00
parent 7b5ab319f8
commit df48171b2d
4 changed files with 21 additions and 62 deletions

View file

@ -48,8 +48,7 @@ default:
* Braces open on the same line as the for/while/if/else/function/etc. Closing
braces are put on a line of their own, except in the else of an if statement
or in a while of a do-while statement. Always use braces for if and while,
except when the expressions are very simple and they can fit in a one-line.
or in a while of a do-while statement. Always use braces for if and while.
```c
if (a == b) {
@ -62,15 +61,6 @@ if (a == b) {
...
}
if (a == b) do_something ();
if (a == b) do_something ();
else do_something_else ();
if (!ok) return false;
if (!buf) goto err_buf;
if (a == b) {
...
} else {

View file

@ -1,4 +1,4 @@
/* radare - LGPL - Copyright 2007-2017 - pancake */
/* radare - LGPL - Copyright 2007-2018 - pancake */
/* dietline is a lightweight and portable library similar to GNU readline */
#include <r_cons.h>

View file

@ -1,4 +1,4 @@
/* radare - LGPL - Copyright 2009-2017 - pancake */
/* radare - LGPL - Copyright 2009-2018 - pancake */
#include <r_cons.h>
#include <string.h>
@ -342,28 +342,16 @@ do_it_again:
ch='J';
break;
case VK_F1:
if (bCtrl)
ch=R_CONS_KEY_F1;
else
ch=R_CONS_KEY_F1;
ch = R_CONS_KEY_F1;
break;
case VK_F2:
if (bCtrl)
ch=R_CONS_KEY_F2;
else
ch=R_CONS_KEY_F2;
ch = R_CONS_KEY_F2;
break;
case VK_F3:
if (bCtrl)
ch=R_CONS_KEY_F3;
else
ch=R_CONS_KEY_F3;
ch = R_CONS_KEY_F3;
break;
case VK_F4:
if (bCtrl)
ch=R_CONS_KEY_F4;
else
ch=R_CONS_KEY_F4;
ch = R_CONS_KEY_F4;
break;
case VK_F5:
if (bCtrl)
@ -372,49 +360,28 @@ do_it_again:
ch=R_CONS_KEY_F5;
break;
case VK_F6:
if (bCtrl)
ch=R_CONS_KEY_F6;
else
ch=R_CONS_KEY_F6;
ch = R_CONS_KEY_F6;
break;
case VK_F7:
if (bCtrl)
ch=R_CONS_KEY_F7;
else
ch=R_CONS_KEY_F7;
ch = R_CONS_KEY_F7;
break;
case VK_F8:
if (bCtrl)
ch=R_CONS_KEY_F8;
else
ch=R_CONS_KEY_F8;
ch = R_CONS_KEY_F8;
break;
case VK_F9:
if (bCtrl)
ch=R_CONS_KEY_F9;
else
ch=R_CONS_KEY_F9;
ch = R_CONS_KEY_F9;
break;
case VK_F10:
if (bCtrl)
ch=R_CONS_KEY_F10;
else
ch=R_CONS_KEY_F10;
ch = R_CONS_KEY_F10;
break;
case VK_F11:
if (bCtrl)
ch=R_CONS_KEY_F11;
else
ch=R_CONS_KEY_F11;
ch = R_CONS_KEY_F11;
break;
case VK_F12:
if (bCtrl)
ch=R_CONS_KEY_F12;
else
ch=R_CONS_KEY_F12;
ch = R_CONS_KEY_F12;
break;
default:
ch=0;
ch = 0;
break;
}
}
@ -422,7 +389,7 @@ do_it_again:
}
}
}
FlushConsoleInputBuffer(h);
FlushConsoleInputBuffer (h);
SetConsoleMode (h, mode);
if (ch == 0) {
goto do_it_again;

View file

@ -1,4 +1,4 @@
/* radare2 - LGPL - Copyright 2014-2016 - pancake, Judge_Dredd */
/* radare2 - LGPL - Copyright 2014-2018 - pancake, Judge_Dredd */
#include <r_cons.h>
#include <r_regex.h>
@ -15,7 +15,7 @@ static void color_line(const char *line, RStrpool *p, RList *ml){
};
int linv[2] = {
strlen (inv[0]),
strlen(inv[1])
strlen (inv[1])
};
r_strpool_empty (p);
r_list_foreach (ml, it, m) {
@ -23,7 +23,9 @@ static void color_line(const char *line, RStrpool *p, RList *ml){
r_strpool_memcat (p, line + offset, m->rm_so - offset);
r_strpool_memcat (p, inv[0], linv[0]);
m_len = m->rm_eo - m->rm_so;
if (m_len<0) m_len = 0;
if (m_len < 0) {
m_len = 0;
}
m_addr = r_str_ndup (line + m->rm_so, m_len);
if (m_addr) {
/* in case there's a CSI in the middle of this match*/