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
*/
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) {
int child_depth = 1;
const RBinDwarfDie *child_die = &ctx->all_dies[++idx];
size_t 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
// can be also DW_TAG_suprogram for class methods or tag for templates
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) {
const RBinDwarfDie *die = &ctx->all_dies[idx];
const RBinDwarfDie *die = &ctx->all_dies[idx++];
if (die->has_children) {
int child_depth = 1;
const RBinDwarfDie *child_die = &ctx->all_dies[++idx];
bool get_linkage_name = prefer_linkage_name (ctx->lang);
bool has_linkage_name = false;
int argNumber = 1;
size_t 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;
r_strbuf_init (&type);
const char *name = NULL;

View File

@ -3244,7 +3244,6 @@ static void agraph_follow_innodes(RAGraph *g, bool in) {
if (!an) {
return;
}
RGraphNode *gn = an->gnode;
const RList *list = in? an->gnode->in_nodes: an->gnode->out_nodes;
int nth = -1;
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_printf (in? "Input nodes:\n": "Output nodes:\n");
RGraphNode *gn = an->gnode;
RList *options = r_list_newf (NULL);
RList *gnodes = in? an->gnode->in_nodes: an->gnode->out_nodes;
r_list_foreach (gnodes, iter, gn) {

View File

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

View File

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

View File

@ -1161,7 +1161,6 @@ static void rcc_next(REgg *egg) {
if (*ptr) {
eq = strchr (ptr, '=');
if (eq) {
char *p = (char *) skipspaces (ptr);
vs = egg->lang.varsize;
*buf = *eq = '\x00';
e->mathop (egg, '=', vs, '$', "0", e->regs (egg, 1));
@ -1172,7 +1171,7 @@ static void rcc_next(REgg *egg) {
R_FREE (egg->lang.mathline);
tmp = NULL;
// 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)) {
char *q = r_egg_mkvar (egg, buf, p, 0);
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;
int K = 0;
bool hex_style = false;
int rowbytes = p->cols;
if (step < len) {
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?
r_print_set_screenbounds (p, addr);
int rowbytes;
int rows = 0;
int bytes = 0;
bool printValue = true;

View File

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