Remove all dead assignment detect by clang sa (#310) ##rizin

This commit is contained in:
Alexis Ehret 2021-01-19 02:52:48 +01:00 committed by pancake
parent a2b3adb671
commit 21c98d60ac
7 changed files with 15 additions and 16 deletions

View File

@ -204,14 +204,13 @@ static ut64 get_die_size(const RBinDwarfDie *die) {
* @return st32 -1 if error else 0 * @return st32 -1 if error else 0
*/ */
static st32 parse_array_type(Context *ctx, ut64 idx, RStrBuf *strbuf) { static st32 parse_array_type(Context *ctx, ut64 idx, RStrBuf *strbuf) {
const RBinDwarfDie *die = &ctx->all_dies[idx]; const RBinDwarfDie *die = &ctx->all_dies[idx++];
if (die->has_children) { if (die->has_children) {
int child_depth = 1; int child_depth = 1;
const RBinDwarfDie *child_die = &ctx->all_dies[++idx];
size_t j; size_t j;
for (j = idx; child_depth > 0 && j < ctx->count; j++) { for (j = idx; child_depth > 0 && j < ctx->count; j++) {
child_die = &ctx->all_dies[j]; const RBinDwarfDie *child_die = &ctx->all_dies[j];
// right now we skip non direct descendats of the structure // right now we skip non direct descendats of the structure
// can be also DW_TAG_suprogram for class methods or tag for templates // can be also DW_TAG_suprogram for class methods or tag for templates
if (child_depth == 1 && child_die->tag == DW_TAG_subrange_type) { if (child_depth == 1 && child_die->tag == DW_TAG_subrange_type) {
@ -1148,18 +1147,17 @@ static VariableLocation *parse_dwarf_location (Context *ctx, const RBinDwarfAttr
} }
static st32 parse_function_args_and_vars(Context *ctx, ut64 idx, RStrBuf *args, RList/*<Variable*>*/ *variables) { static st32 parse_function_args_and_vars(Context *ctx, ut64 idx, RStrBuf *args, RList/*<Variable*>*/ *variables) {
const RBinDwarfDie *die = &ctx->all_dies[idx]; const RBinDwarfDie *die = &ctx->all_dies[idx++];
if (die->has_children) { if (die->has_children) {
int child_depth = 1; int child_depth = 1;
const RBinDwarfDie *child_die = &ctx->all_dies[++idx];
bool get_linkage_name = prefer_linkage_name (ctx->lang); bool get_linkage_name = prefer_linkage_name (ctx->lang);
bool has_linkage_name = false; bool has_linkage_name = false;
int argNumber = 1; int argNumber = 1;
size_t j; size_t j;
for (j = idx; child_depth > 0 && j < ctx->count; j++) { for (j = idx; child_depth > 0 && j < ctx->count; j++) {
child_die = &ctx->all_dies[j]; const RBinDwarfDie *child_die = &ctx->all_dies[j];
RStrBuf type; RStrBuf type;
r_strbuf_init (&type); r_strbuf_init (&type);
const char *name = NULL; const char *name = NULL;

View File

@ -3244,7 +3244,6 @@ static void agraph_follow_innodes(RAGraph *g, bool in) {
if (!an) { if (!an) {
return; return;
} }
RGraphNode *gn = an->gnode;
const RList *list = in? an->gnode->in_nodes: an->gnode->out_nodes; const RList *list = in? an->gnode->in_nodes: an->gnode->out_nodes;
int nth = -1; int nth = -1;
if (r_list_length (list) == 0) { if (r_list_length (list) == 0) {
@ -3252,6 +3251,7 @@ static void agraph_follow_innodes(RAGraph *g, bool in) {
} }
r_cons_gotoxy (0, 2); r_cons_gotoxy (0, 2);
r_cons_printf (in? "Input nodes:\n": "Output nodes:\n"); r_cons_printf (in? "Input nodes:\n": "Output nodes:\n");
RGraphNode *gn = an->gnode;
RList *options = r_list_newf (NULL); RList *options = r_list_newf (NULL);
RList *gnodes = in? an->gnode->in_nodes: an->gnode->out_nodes; RList *gnodes = in? an->gnode->in_nodes: an->gnode->out_nodes;
r_list_foreach (gnodes, iter, gn) { r_list_foreach (gnodes, iter, gn) {

View File

@ -2990,7 +2990,7 @@ static int r_core_cmd_subst(RCore *core, char *cmd) {
goto beach; goto beach;
} }
if (*icmd && !strchr (icmd, '"')) { if (*icmd && !strchr (icmd, '"')) {
char *hash = icmd; char *hash;
for (hash = icmd + 1; *hash; hash++) { for (hash = icmd + 1; *hash; hash++) {
if (*hash == '\\') { if (*hash == '\\') {
hash++; hash++;

View File

@ -3575,10 +3575,9 @@ reaccept:
if (cmd == 'G') { if (cmd == 'G') {
// silly http emulation over rap:// // silly http emulation over rap://
char line[256] = {0}; char line[256] = {0};
char *cmd = line;
r_socket_read_block (c, (ut8*)line, sizeof (line)); r_socket_read_block (c, (ut8*)line, sizeof (line));
if (!strncmp (line, "ET /cmd/", 8)) { if (!strncmp (line, "ET /cmd/", 8)) {
cmd = line + 8; char *cmd = line + 8;
char *http = strstr (cmd, "HTTP"); char *http = strstr (cmd, "HTTP");
if (http) { if (http) {
*http = 0; *http = 0;

View File

@ -1161,7 +1161,6 @@ static void rcc_next(REgg *egg) {
if (*ptr) { if (*ptr) {
eq = strchr (ptr, '='); eq = strchr (ptr, '=');
if (eq) { if (eq) {
char *p = (char *) skipspaces (ptr);
vs = egg->lang.varsize; vs = egg->lang.varsize;
*buf = *eq = '\x00'; *buf = *eq = '\x00';
e->mathop (egg, '=', vs, '$', "0", e->regs (egg, 1)); e->mathop (egg, '=', vs, '$', "0", e->regs (egg, 1));
@ -1172,7 +1171,7 @@ static void rcc_next(REgg *egg) {
R_FREE (egg->lang.mathline); R_FREE (egg->lang.mathline);
tmp = NULL; tmp = NULL;
// following code block is too ugly, oh noes // following code block is too ugly, oh noes
p = r_egg_mkvar (egg, buf, ptr, 0); char *p = r_egg_mkvar (egg, buf, ptr, 0);
if (is_var (p)) { if (is_var (p)) {
char *q = r_egg_mkvar (egg, buf, p, 0); char *q = r_egg_mkvar (egg, buf, p, 0);
if (q) { if (q) {

View File

@ -841,7 +841,6 @@ R_API void r_print_hexdump(RPrint *p, ut64 addr, const ut8 *buf, int len, int ba
const char *a, *b; const char *a, *b;
int K = 0; int K = 0;
bool hex_style = false; bool hex_style = false;
int rowbytes = p->cols;
if (step < len) { if (step < len) {
len = len - (len % step); len = len - (len % step);
} }
@ -1026,6 +1025,7 @@ R_API void r_print_hexdump(RPrint *p, ut64 addr, const ut8 *buf, int len, int ba
// is this necessary? // is this necessary?
r_print_set_screenbounds (p, addr); r_print_set_screenbounds (p, addr);
int rowbytes;
int rows = 0; int rows = 0;
int bytes = 0; int bytes = 0;
bool printValue = true; bool printValue = true;

View File

@ -55,9 +55,12 @@ static int enter_switch_op (ut64 addr, const ut8* bytes, int len) {
return 0; return 0;
} }
int sz = 4; int sz = 4;
IFDBG {
int sz2 = (4 - (addr+1) % 4) + (addr+1) % 4; int sz2 = (4 - (addr+1) % 4) + (addr+1) % 4;
IFDBG eprintf ("Addr approach: 0x%04x and BYTES_CONSUMED approach: 0x%04"PFMT64x", BYTES_CONSUMED%%4 = 0x%04x\n", eprintf ("Addr approach: 0x%04x and BYTES_CONSUMED approach: 0x%04"PFMT64x", BYTES_CONSUMED%%4 = 0x%04x\n",
sz2, BYTES_CONSUMED, sz); sz2, BYTES_CONSUMED, sz);
}
init_switch_op (); init_switch_op ();
IN_SWITCH_OP = 1; IN_SWITCH_OP = 1;
SWITCH_OP.addr = addr; SWITCH_OP.addr = addr;