mirror of
https://github.com/radareorg/radare2.git
synced 2024-11-23 13:19:54 +00:00
Dont use != NULL as its implicit in C, even for bool casts ##refactor
$ find binr libr -name "*.c" -exec sed -i -e 's/ != NULL//g' {} \;
This commit is contained in:
parent
d759ee6a07
commit
f8a35da205
@ -268,7 +268,7 @@ rd_label (const char **p, int *exists, struct label **previous, int level,
|
||||
/* Return a value to discriminate between non-existing and invalid */
|
||||
if (verbose >= 7)
|
||||
fprintf (stderr, "rd_label returns invalid value\n");
|
||||
return l != NULL;
|
||||
return (int)(bool)l;
|
||||
}
|
||||
if (exists)
|
||||
*exists = 1;
|
||||
|
@ -110,7 +110,7 @@ static bool strbuf_rev_prepend_char(RStrBuf *sb, const char *s, int c) {
|
||||
memcpy (ns + idx, s, l);
|
||||
memcpy (ns + idx + l, sb_str + idx, sb->len - idx);
|
||||
ns[newlen] = 0;
|
||||
ret = r_strbuf_set (sb, ns) != NULL;
|
||||
ret = r_strbuf_set (sb, ns);
|
||||
free (ns);
|
||||
}
|
||||
return ret;
|
||||
@ -145,7 +145,7 @@ static bool strbuf_rev_append_char(RStrBuf *sb, const char *s, const char *needl
|
||||
memcpy (ns + idx, s, l);
|
||||
memcpy (ns + idx + l, sb_str + idx, sb->len - idx);
|
||||
ns[newlen] = 0;
|
||||
ret = r_strbuf_set (sb, ns) != NULL;
|
||||
ret = r_strbuf_set (sb, ns);
|
||||
free (ns);
|
||||
}
|
||||
return ret;
|
||||
|
@ -429,8 +429,8 @@ R_API bool try_get_jmptbl_info(RAnal *anal, RAnalFunction *fcn, ut64 addr, RAnal
|
||||
/* if UJMP is in .plt section just skip it */
|
||||
RBinSection *s = anal->binb.get_vsect_at (anal->binb.bin, addr);
|
||||
if (s && s->name[0]) {
|
||||
bool in_plt = strstr (s->name, ".plt") != NULL;
|
||||
if (!in_plt && strstr (s->name, "_stubs") != NULL) {
|
||||
bool in_plt = strstr (s->name, ".plt");
|
||||
if (!in_plt && strstr (s->name, "_stubs")) {
|
||||
/* for mach0 */
|
||||
in_plt = true;
|
||||
}
|
||||
|
@ -237,7 +237,7 @@ R_API const char *r_meta_type_to_string(int type) {
|
||||
}
|
||||
|
||||
R_API void r_meta_print(RAnal *a, RAnalMetaItem *d, ut64 start, ut64 size, int rad, PJ *pj, bool show_full) {
|
||||
r_return_if_fail (!(rad == 'j' && !pj)); // rad == 'j' => pj != NULL
|
||||
r_return_if_fail (!(rad == 'j' && !pj)); // rad == 'j' => pj
|
||||
char *pstr, *base64_str;
|
||||
RCore *core = a->coreb.core;
|
||||
bool esc_bslash = core ? core->print->esc_bslash : false;
|
||||
|
@ -243,7 +243,7 @@ static CPU_CONST *const_by_value(CPU_MODEL *cpu, int type, ut32 v) {
|
||||
static RStrBuf *__generic_io_dest(ut8 port, int write, CPU_MODEL *cpu) {
|
||||
RStrBuf *r = r_strbuf_new ("");
|
||||
CPU_CONST *c = const_by_value (cpu, CPU_CONST_REG, port);
|
||||
if (c != NULL) {
|
||||
if (c) {
|
||||
r_strbuf_set (r, c->key);
|
||||
if (write) {
|
||||
r_strbuf_append (r, ",=");
|
||||
|
@ -172,9 +172,9 @@ static int or1k_op(RAnal *a, RAnalOp *op, ut64 addr, const ut8 *data, int len, R
|
||||
|
||||
/* if name is null, but extra is present, it means 6 most significant bits
|
||||
* are not enough to decode instruction */
|
||||
if ((insn_descr->name == NULL) && (insn_descr->extra != NULL)) {
|
||||
if ((insn_descr->name == NULL) && (insn_descr->extra)) {
|
||||
extra_descr = find_extra_descriptor(insn_descr->extra, insn);
|
||||
if (extra_descr != NULL) {
|
||||
if (extra_descr) {
|
||||
insn_to_op(a, op, addr, insn_descr, extra_descr, insn);
|
||||
}
|
||||
}
|
||||
|
@ -781,7 +781,7 @@ RecoveryCompleteObjectLocator *recovery_anal_complete_object_locator(RRTTIMSVCAn
|
||||
RecoveryTypeDescriptor *recovery_anal_type_descriptor(RRTTIMSVCAnalContext *context, ut64 addr, RecoveryCompleteObjectLocator *col) {
|
||||
RecoveryTypeDescriptor *td = ht_up_find (context->addr_td, addr, NULL);
|
||||
if (td) {
|
||||
if (col != NULL) {
|
||||
if (col) {
|
||||
td->col = col;
|
||||
}
|
||||
return td;
|
||||
@ -901,7 +901,7 @@ static const char *recovery_apply_complete_object_locator(RRTTIMSVCAnalContext *
|
||||
RAnal *anal = context->vt_context->anal;
|
||||
|
||||
const char *existing = ht_up_find (context->col_td_classes, col->addr, NULL);
|
||||
if (existing != NULL) {
|
||||
if (existing) {
|
||||
return existing;
|
||||
}
|
||||
|
||||
@ -942,7 +942,7 @@ static const char *recovery_apply_type_descriptor(RRTTIMSVCAnalContext *context,
|
||||
RAnal *anal = context->vt_context->anal;
|
||||
|
||||
const char *existing = ht_up_find (context->col_td_classes, td->addr, NULL);
|
||||
if (existing != NULL) {
|
||||
if (existing) {
|
||||
return existing;
|
||||
}
|
||||
|
||||
|
@ -661,7 +661,7 @@ R_API bool r_sign_add_item(RAnal *a, RSignItem *it) {
|
||||
|
||||
static RSignItem *item_new_named(RAnal *a, const char *n) {
|
||||
RSignItem *it = r_sign_item_new ();
|
||||
if (it && (it->name = strdup (n)) != NULL) {
|
||||
if (it && (it->name = strdup (n))) {
|
||||
it->space = r_spaces_current (&a->zign_spaces);
|
||||
return it;
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ static struct {
|
||||
static int _6502Disass(ut64 pc, RAsmOp *op, const ut8 *buf, ut64 len) {
|
||||
int i;
|
||||
r_strf_buffer (64);
|
||||
for (i = 0; ops[i].name != NULL; i++) {
|
||||
for (i = 0; ops[i].name; i++) {
|
||||
if (ops[i].op == buf[0]) {
|
||||
const char *buf_asm = "invalid";
|
||||
int len = ops[i].len;
|
||||
|
@ -585,4 +585,4 @@ void amd29k_instr_print(char* string, int string_size, ut64 address, amd29k_inst
|
||||
#undef AMD29K_IS_2
|
||||
#undef AMD29K_IS_3
|
||||
#undef AMD29K_IS_4
|
||||
#undef AMD29K_IS_5
|
||||
#undef AMD29K_IS_5
|
||||
|
@ -460,7 +460,7 @@ build_ARC_extmap (void *text_bfd)
|
||||
*/
|
||||
destroy_map();
|
||||
|
||||
for (sect = text_bfd->sections; sect != NULL; sect = sect->next)
|
||||
for (sect = text_bfd->sections; sect; sect = sect->next)
|
||||
if (!strncmp (sect->name,
|
||||
".gnu.linkonce.arcextmap.",
|
||||
sizeof (".gnu.linkonce.arcextmap.") - 1)
|
||||
@ -497,7 +497,7 @@ void dump_ARC_extmap (void)
|
||||
{
|
||||
struct ExtInstruction *insn;
|
||||
|
||||
for (insn = arc_extension_map.instructions[i]; insn != NULL; insn = insn->next) {
|
||||
for (insn = arc_extension_map.instructions[i]; insn; insn = insn->next) {
|
||||
printf ("INST: %d %d %x %s\n", insn->major, insn->minor, insn->flags, insn->name);
|
||||
}
|
||||
}
|
||||
|
@ -1454,7 +1454,7 @@ insert_base (arc_insn insn,long *ex ATTRIBUTE_UNUSED,
|
||||
long value,
|
||||
const char **errmsg)
|
||||
{
|
||||
if (reg != NULL)
|
||||
if (reg)
|
||||
{
|
||||
arc_insn myinsn;
|
||||
if (!arc_mach_a4 && ('g' == operand->fmt)) {
|
||||
@ -1511,7 +1511,7 @@ insert_offset (arc_insn insn,long *ex ATTRIBUTE_UNUSED,
|
||||
{
|
||||
long minval, maxval;
|
||||
|
||||
if (reg != NULL)
|
||||
if (reg)
|
||||
{
|
||||
if (arc_mach_a4)
|
||||
{
|
||||
@ -2243,7 +2243,7 @@ extract_reg (arc_insn *insn,
|
||||
if (!reg) {
|
||||
return 0;
|
||||
}
|
||||
if (opval != NULL) {
|
||||
if (opval) {
|
||||
*opval = reg;
|
||||
}
|
||||
value = regno;
|
||||
@ -2257,7 +2257,7 @@ extract_reg (arc_insn *insn,
|
||||
|
||||
/* This is really a constant, but tell the caller it has a special
|
||||
name. */
|
||||
if (reg != NULL && opval != NULL) {
|
||||
if (reg && opval) {
|
||||
*opval = reg;
|
||||
}
|
||||
}
|
||||
@ -2310,7 +2310,7 @@ extract_flag (arc_insn *insn,
|
||||
}
|
||||
flag_p = 1;
|
||||
val = arc_opcode_lookup_suffix (operand, 1);
|
||||
if (opval != NULL && val != NULL) {
|
||||
if (opval && val) {
|
||||
*opval = val;
|
||||
}
|
||||
return val?val->value:0;
|
||||
@ -2340,7 +2340,7 @@ extract_cond (arc_insn *insn,
|
||||
|
||||
/* Ignore NULL values of `val'. Several condition code values are
|
||||
reserved for extensions. */
|
||||
if (opval != NULL && val != NULL) {
|
||||
if (opval && val) {
|
||||
*opval = val;
|
||||
}
|
||||
return cond;
|
||||
@ -2454,7 +2454,7 @@ extract_unopmacro (arc_insn *insn,
|
||||
C == ARC_REG_SHIMM (or vice versa). No big deal. Those insns will get
|
||||
printed as "and"s. */
|
||||
if (((*insn >> ARC_SHIFT_REGB) & ARC_MASK_REG) != ((*insn >> ARC_SHIFT_REGC) & ARC_MASK_REG)) {
|
||||
if (invalid != NULL) {
|
||||
if (invalid) {
|
||||
*invalid = 1;
|
||||
}
|
||||
}
|
||||
|
@ -3772,7 +3772,7 @@ static void
|
||||
parse_disassembler_options (char *options)
|
||||
{
|
||||
const char *p;
|
||||
for (p = options; p != NULL; )
|
||||
for (p = options; p; )
|
||||
{
|
||||
if (CONST_STRNEQ (p, "simd"))
|
||||
{
|
||||
@ -3785,7 +3785,7 @@ parse_disassembler_options (char *options)
|
||||
|
||||
p = strchr (p, ',');
|
||||
|
||||
if (p != NULL) {
|
||||
if (p) {
|
||||
p++;
|
||||
}
|
||||
}
|
||||
@ -3894,7 +3894,7 @@ ARCompact_decodeInstr (bfd_vma address, /* Address of this instruct
|
||||
}
|
||||
|
||||
/* if the operand is actually in the instruction buffer */
|
||||
if ((space != NULL) && (operand[0] == '\0'))
|
||||
if ((space) && (operand[0] == '\0'))
|
||||
{
|
||||
*space = '\0';
|
||||
operand = space + 1;
|
||||
|
@ -1315,7 +1315,7 @@ aarch64_ext_hint (const aarch64_operand *self ATTRIBUTE_UNUSED,
|
||||
|
||||
hint_number = extract_fields (code, 0, 2, FLD_CRm, FLD_op2);
|
||||
|
||||
for (i = 0; aarch64_hint_options[i].name != NULL; i++)
|
||||
for (i = 0; aarch64_hint_options[i].name; i++)
|
||||
{
|
||||
if (hint_number == aarch64_hint_options[i].value)
|
||||
{
|
||||
@ -2964,7 +2964,7 @@ aarch64_decode_insn (aarch64_insn insn, aarch64_inst *inst,
|
||||
const aarch64_opcode *tmp = opcode;
|
||||
printf ("\n");
|
||||
DEBUG_TRACE ("opcode lookup:");
|
||||
while (tmp != NULL)
|
||||
while (tmp)
|
||||
{
|
||||
aarch64_verbose (" %s", tmp->name);
|
||||
tmp = aarch64_find_next_opcode (tmp);
|
||||
@ -2977,7 +2977,7 @@ aarch64_decode_insn (aarch64_insn insn, aarch64_inst *inst,
|
||||
opcode field and value, apart from the difference that one of them has an
|
||||
extra field as part of the opcode, but such a field is used for operand
|
||||
encoding in other opcode(s) ('immh' in the case of the example). */
|
||||
while (opcode != NULL)
|
||||
while (opcode)
|
||||
{
|
||||
/* But only one opcode can be decoded successfully for, as the
|
||||
decoding routine will check the constraint carefully. */
|
||||
@ -3213,7 +3213,7 @@ get_sym_code_type (struct disassemble_info *info, int n,
|
||||
const char *name;
|
||||
|
||||
/* If the symbol is in a different section, ignore it. */
|
||||
if (info->section != NULL && info->section != info->symtab[n]->section)
|
||||
if (info->section && info->section != info->symtab[n]->section)
|
||||
return FALSE;
|
||||
|
||||
es = *(elf_symbol_type **)(info->symtab + n);
|
||||
|
@ -1062,7 +1062,7 @@ aarch64_wide_constant_p (int64_t value, int is32, unsigned int *shift_amount)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (shift_amount != NULL)
|
||||
if (shift_amount)
|
||||
*shift_amount = amount;
|
||||
|
||||
DEBUG_TRACE ("exit TRUE with amount %d", amount);
|
||||
@ -1238,7 +1238,7 @@ aarch64_logical_immediate_p (uint64_t value, int esize, aarch64_insn *encoding)
|
||||
DEBUG_TRACE ("exit with FALSE");
|
||||
return FALSE;
|
||||
}
|
||||
if (encoding != NULL)
|
||||
if (encoding)
|
||||
*encoding = imm_encoding->encoding;
|
||||
DEBUG_TRACE ("exit with TRUE");
|
||||
return TRUE;
|
||||
@ -3626,7 +3626,7 @@ aarch64_print_operand (char *buf, size_t size, bfd_vma pc,
|
||||
break;
|
||||
|
||||
case AARCH64_OPND_PRFOP:
|
||||
if (opnd->prfop->name != NULL)
|
||||
if (opnd->prfop->name)
|
||||
snprintf (buf, size, "%s", opnd->prfop->name);
|
||||
else
|
||||
snprintf (buf, size, "0x%02x", opnd->prfop->value);
|
||||
|
@ -977,7 +977,7 @@ void collect_list(ArmOpcode *ao) {
|
||||
int conc = 0;
|
||||
int start = 0, end = 0;
|
||||
int arrsz;
|
||||
for (arrsz = 1; input[arrsz] != NULL; arrsz++) {
|
||||
for (arrsz = 1; input[arrsz]; arrsz++) {
|
||||
;
|
||||
}
|
||||
|
||||
|
@ -1272,7 +1272,7 @@ static bool parseOpcode(const char *str, ArmOp *op) {
|
||||
space[0] = '\0';
|
||||
op->mnemonic = in;
|
||||
space ++;
|
||||
op->writeback = strstr (space, "]!") != NULL;
|
||||
op->writeback = strstr (space, "]!");
|
||||
return parseOperands (space, op);
|
||||
}
|
||||
|
||||
|
@ -5014,7 +5014,7 @@ print_insn_arm (bfd_vma pc, struct disassemble_info *info, long given)
|
||||
sysm |= (given & 0x300) >> 4;
|
||||
name = banked_regname (sysm);
|
||||
|
||||
if (name != NULL) {
|
||||
if (name) {
|
||||
func (stream, "%s", name);
|
||||
} else {
|
||||
func (stream, "(UNDEF: %lu)", (unsigned long)sysm);
|
||||
@ -5047,7 +5047,7 @@ print_insn_arm (bfd_vma pc, struct disassemble_info *info, long given)
|
||||
}
|
||||
} else {
|
||||
const char *opt = data_barrier_option (given & 0xf);
|
||||
if (opt != NULL) {
|
||||
if (opt) {
|
||||
func (stream, "%s", opt);
|
||||
} else {
|
||||
func (stream, "%d", (int)given & 0xf);
|
||||
@ -5184,7 +5184,7 @@ print_insn_arm (bfd_vma pc, struct disassemble_info *info, long given)
|
||||
sysm |= (given & 0x300) >> 4;
|
||||
name = banked_regname (sysm);
|
||||
|
||||
if (name != NULL) {
|
||||
if (name) {
|
||||
func (stream, "%s", name);
|
||||
} else {
|
||||
func (stream, "(UNDEF: %lu)", (unsigned long)sysm);
|
||||
@ -5921,7 +5921,7 @@ print_insn_thumb32 (bfd_vma pc, struct disassemble_info *info, long given)
|
||||
}
|
||||
} else {
|
||||
const char *opt = data_barrier_option (given & 0xf);
|
||||
if (opt != NULL) {
|
||||
if (opt) {
|
||||
func (stream, "%s", opt);
|
||||
} else {
|
||||
func (stream, "%d", (int)given & 0xf);
|
||||
@ -5952,7 +5952,7 @@ print_insn_thumb32 (bfd_vma pc, struct disassemble_info *info, long given)
|
||||
sysm |= (given & 0x00100000) >> 14;
|
||||
name = banked_regname (sysm);
|
||||
|
||||
if (name != NULL) {
|
||||
if (name) {
|
||||
func (stream, "%s", name);
|
||||
} else {
|
||||
func (stream, "(UNDEF: %lu)", (unsigned long)sysm);
|
||||
@ -5971,7 +5971,7 @@ print_insn_thumb32 (bfd_vma pc, struct disassemble_info *info, long given)
|
||||
sm |= (given & 0x00100000) >> 14;
|
||||
name = banked_regname (sm);
|
||||
|
||||
if (name != NULL) {
|
||||
if (name) {
|
||||
func (stream, "%s", name);
|
||||
} else {
|
||||
func (stream, "(UNDEF: %lu)", (unsigned long)sm);
|
||||
@ -6319,7 +6319,7 @@ get_map_sym_type (struct disassemble_info *info,
|
||||
enum map_type *map_type)
|
||||
{
|
||||
/* If the symbol is in a different section, ignore it. */
|
||||
if (info->section != NULL && info->section != info->symtab[n]->section) {
|
||||
if (info->section && info->section != info->symtab[n]->section) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -6340,7 +6340,7 @@ return FALSE;
|
||||
unsigned int type;
|
||||
|
||||
/* If the symbol is in a different section, ignore it. */
|
||||
if (info->section != NULL && info->section != info->symtab[n]->section)
|
||||
if (info->section && info->section != info->symtab[n]->section)
|
||||
return FALSE;
|
||||
|
||||
es = *(elf_symbol_type **)(info->symtab + n);
|
||||
@ -6853,7 +6853,7 @@ print_insn_big_arm (bfd_vma pc, struct disassemble_info *info)
|
||||
/* Detect BE8-ness and record it in the disassembler info. */
|
||||
#if 0
|
||||
if (info->flavour == bfd_target_elf_flavour
|
||||
&& info->section != NULL
|
||||
&& info->section
|
||||
&& (elf_elfheader (info->section->owner)->e_flags & EF_ARM_BE8))
|
||||
info->endian_code = BFD_ENDIAN_LITTLE;
|
||||
#endif
|
||||
@ -6881,7 +6881,7 @@ disassembler_options_arm (void)
|
||||
for (i = 0; i < NUM_ARM_OPTIONS; i++)
|
||||
{
|
||||
opts->name[i] = regnames[i].name;
|
||||
if (regnames[i].description != NULL) {
|
||||
if (regnames[i].description) {
|
||||
opts->description[i] = _ (regnames[i].description);
|
||||
} else {
|
||||
opts->description[i] = NULL;
|
||||
|
@ -48,7 +48,7 @@ int avr_encode(RAsm *a, RAsmOp *ao, const char *str) {
|
||||
// simple tokenizer -- creates an array of maximum three tokens
|
||||
// the delimiters are ' ' and ','
|
||||
token = strtok ((char *)str, TOKEN_DELIM);
|
||||
while (token != NULL && tokens_cnt < 3) {
|
||||
while (token && tokens_cnt < 3) {
|
||||
memset (tokens[tokens_cnt], 0, MAX_TOKEN_SIZE);
|
||||
strncpy (tokens[tokens_cnt], token, MAX_TOKEN_SIZE-1);
|
||||
token = strtok (NULL, TOKEN_DELIM);
|
||||
|
@ -169,7 +169,7 @@ static int formatDisassembledOperand(RAsm *a, avrDisassembleContext *context, ch
|
||||
#if 0
|
||||
/* If we have an address label, print it, otherwise just print the
|
||||
* relative distance to the destination address. */
|
||||
if ((fOptions.options & FORMAT_OPTION_ADDRESS_LABEL) && fOptions.addressLabelPrefix != NULL) {
|
||||
if ((fOptions.options & FORMAT_OPTION_ADDRESS_LABEL) && fOptions.addressLabelPrefix) {
|
||||
retVal = sprintf(strOperand, "%s%0*X",
|
||||
fOptions.addressLabelPrefix,
|
||||
fOptions.addressFieldWidth,
|
||||
@ -512,7 +512,7 @@ static int analFormatDisassembledOperand(RAnal *a, avrDisassembleContext *contex
|
||||
#if 0
|
||||
/* If we have an address label, print it, otherwise just print the
|
||||
* relative distance to the destination address. */
|
||||
if ((fOptions.options & FORMAT_OPTION_ADDRESS_LABEL) && fOptions.addressLabelPrefix != NULL) {
|
||||
if ((fOptions.options & FORMAT_OPTION_ADDRESS_LABEL) && fOptions.addressLabelPrefix) {
|
||||
retVal = sprintf(strOperand, "%s%0*X",
|
||||
fOptions.addressLabelPrefix,
|
||||
fOptions.addressFieldWidth,
|
||||
|
@ -127,7 +127,7 @@ spec_reg_info (unsigned int sreg, enum cris_disass_family distype)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; cris_spec_regs[i].name != NULL; i++)
|
||||
for (i = 0; cris_spec_regs[i].name; i++)
|
||||
{
|
||||
if (cris_spec_regs[i].number == sreg)
|
||||
{
|
||||
@ -237,7 +237,7 @@ get_opcode_entry (unsigned int insn,
|
||||
if (prefix_insn != NO_CRIS_PREFIX)
|
||||
{
|
||||
const struct cris_opcode *popcodep
|
||||
= (opc_table[prefix_insn] != NULL
|
||||
= (opc_table[prefix_insn]
|
||||
? opc_table[prefix_insn]
|
||||
: get_opcode_entry (prefix_insn, NO_CRIS_PREFIX, disdata));
|
||||
|
||||
@ -282,16 +282,16 @@ get_opcode_entry (unsigned int insn,
|
||||
}
|
||||
}
|
||||
|
||||
if (prefix_insn != NO_CRIS_PREFIX && prefix_opc_table[insn] != NULL) {
|
||||
if (prefix_insn != NO_CRIS_PREFIX && prefix_opc_table[insn]) {
|
||||
max_matchedp = prefix_opc_table[insn];
|
||||
} else if (prefix_insn == NO_CRIS_PREFIX && opc_table[insn] != NULL) {
|
||||
} else if (prefix_insn == NO_CRIS_PREFIX && opc_table[insn]) {
|
||||
max_matchedp = opc_table[insn];
|
||||
} else {
|
||||
const struct cris_opcode *opcodep;
|
||||
int max_level_of_match = -1;
|
||||
|
||||
for (opcodep = cris_opcodes;
|
||||
opcodep->name != NULL;
|
||||
opcodep->name;
|
||||
opcodep++) {
|
||||
int level_of_match;
|
||||
|
||||
@ -512,7 +512,7 @@ cris_constraint (const char *cs,
|
||||
for a move from a special register is matched in the
|
||||
register constraint. */
|
||||
|
||||
if (sregp != NULL) {
|
||||
if (sregp) {
|
||||
retval += 3;
|
||||
break;
|
||||
} else {
|
||||
@ -613,7 +613,7 @@ format_sup_reg (unsigned int regno,
|
||||
*outbuffer++ = REGISTER_PREFIX_CHAR;
|
||||
}
|
||||
|
||||
for (i = 0; cris_support_regs[i].name != NULL; i++) {
|
||||
for (i = 0; cris_support_regs[i].name; i++) {
|
||||
if (cris_support_regs[i].number == regno) {
|
||||
sprintf (outbuffer, "%s", cris_support_regs[i].name);
|
||||
return outbuffer_start + strlen (outbuffer_start);
|
||||
@ -1480,7 +1480,7 @@ print_insn_cris_generic (bfd_vma memaddr,
|
||||
|
||||
/* Check if we're supposed to write out prefixes as address
|
||||
modes and if this was a prefix. */
|
||||
if (matchedp != NULL && PARSE_PREFIX && matchedp->args[0] == 'p') {
|
||||
if (matchedp && PARSE_PREFIX && matchedp->args[0] == 'p') {
|
||||
/* If it's a prefix, put it into the prefix vars and get the
|
||||
main insn. */
|
||||
prefix_size = bytes_to_skip (prefix_insn, matchedp,
|
||||
@ -1490,7 +1490,7 @@ print_insn_cris_generic (bfd_vma memaddr,
|
||||
insn = bufp[prefix_size] + bufp[prefix_size + 1] * 256;
|
||||
matchedp = get_opcode_entry (insn, prefix_insn, disdata);
|
||||
|
||||
if (matchedp != NULL) {
|
||||
if (matchedp) {
|
||||
addr += prefix_size;
|
||||
bufp += prefix_size;
|
||||
advance += prefix_size;
|
||||
|
@ -760,7 +760,7 @@ choose_arch_by_number (unsigned long mach)
|
||||
/* We optimize this because even if the user specifies no
|
||||
flags, this will be done for every instruction! */
|
||||
if (hint_bfd_mach == mach
|
||||
&& hint_arch_choice != NULL
|
||||
&& hint_arch_choice
|
||||
&& hint_arch_choice->bfd_mach == hint_bfd_mach)
|
||||
return hint_arch_choice;
|
||||
|
||||
@ -890,7 +890,7 @@ set_default_mips_dis_options (struct disassemble_info *info)
|
||||
mips_ase = mips_target_info.ase;
|
||||
#else
|
||||
chosen_arch = choose_arch_by_number (info->mach);
|
||||
if (chosen_arch != NULL)
|
||||
if (chosen_arch)
|
||||
{
|
||||
mips_processor = chosen_arch->processor;
|
||||
mips_isa = chosen_arch->isa;
|
||||
@ -903,7 +903,7 @@ set_default_mips_dis_options (struct disassemble_info *info)
|
||||
}
|
||||
|
||||
/* Update settings according to the ELF file header flags. */
|
||||
if (info->flavour == bfd_target_elf_flavour && info->section != NULL)
|
||||
if (info->flavour == bfd_target_elf_flavour && info->section)
|
||||
{
|
||||
struct bfd *abfd = info->section->owner;
|
||||
Elf_Internal_Ehdr *header = elf_elfheader (abfd);
|
||||
@ -1051,7 +1051,7 @@ parse_mips_dis_option (const char *option, unsigned int len)
|
||||
&& strlen ("gpr-names") == optionlen)
|
||||
{
|
||||
chosen_abi = choose_abi_by_name (val, vallen);
|
||||
if (chosen_abi != NULL)
|
||||
if (chosen_abi)
|
||||
mips_gpr_names = chosen_abi->gpr_names;
|
||||
return;
|
||||
}
|
||||
@ -1060,7 +1060,7 @@ parse_mips_dis_option (const char *option, unsigned int len)
|
||||
&& strlen ("fpr-names") == optionlen)
|
||||
{
|
||||
chosen_abi = choose_abi_by_name (val, vallen);
|
||||
if (chosen_abi != NULL)
|
||||
if (chosen_abi)
|
||||
mips_fpr_names = chosen_abi->fpr_names;
|
||||
return;
|
||||
}
|
||||
@ -1069,7 +1069,7 @@ parse_mips_dis_option (const char *option, unsigned int len)
|
||||
&& strlen ("cp0-names") == optionlen)
|
||||
{
|
||||
chosen_arch = choose_arch_by_name (val, vallen);
|
||||
if (chosen_arch != NULL)
|
||||
if (chosen_arch)
|
||||
{
|
||||
mips_cp0_names = chosen_arch->cp0_names;
|
||||
mips_cp0sel_names = chosen_arch->cp0sel_names;
|
||||
@ -1082,7 +1082,7 @@ parse_mips_dis_option (const char *option, unsigned int len)
|
||||
&& strlen ("cp1-names") == optionlen)
|
||||
{
|
||||
chosen_arch = choose_arch_by_name (val, vallen);
|
||||
if (chosen_arch != NULL)
|
||||
if (chosen_arch)
|
||||
mips_cp1_names = chosen_arch->cp1_names;
|
||||
return;
|
||||
}
|
||||
@ -1091,7 +1091,7 @@ parse_mips_dis_option (const char *option, unsigned int len)
|
||||
&& strlen ("hwr-names") == optionlen)
|
||||
{
|
||||
chosen_arch = choose_arch_by_name (val, vallen);
|
||||
if (chosen_arch != NULL)
|
||||
if (chosen_arch)
|
||||
mips_hwr_names = chosen_arch->hwr_names;
|
||||
return;
|
||||
}
|
||||
@ -1104,13 +1104,13 @@ parse_mips_dis_option (const char *option, unsigned int len)
|
||||
numeric register names for all registers. Other than
|
||||
that, a given name probably won't match both. */
|
||||
chosen_abi = choose_abi_by_name (val, vallen);
|
||||
if (chosen_abi != NULL)
|
||||
if (chosen_abi)
|
||||
{
|
||||
mips_gpr_names = chosen_abi->gpr_names;
|
||||
mips_fpr_names = chosen_abi->fpr_names;
|
||||
}
|
||||
chosen_arch = choose_arch_by_name (val, vallen);
|
||||
if (chosen_arch != NULL)
|
||||
if (chosen_arch)
|
||||
{
|
||||
mips_cp0_names = chosen_arch->cp0_names;
|
||||
mips_cp0sel_names = chosen_arch->cp0sel_names;
|
||||
@ -1871,7 +1871,7 @@ print_insn_args (struct disassemble_info *info,
|
||||
n = lookup_mips_cp0sel_name (mips_cp0sel_names,
|
||||
mips_cp0sel_names_len,
|
||||
reg, sel);
|
||||
if (n != NULL)
|
||||
if (n)
|
||||
infprintf (is, "%s", n->name);
|
||||
else
|
||||
infprintf (is, "$%d,%d", reg, sel);
|
||||
@ -1955,7 +1955,7 @@ print_insn_mips (bfd_vma memaddr,
|
||||
info->target2 = 0;
|
||||
|
||||
op = mips_hash[GET_OP (word, OP)];
|
||||
if (op != NULL)
|
||||
if (op)
|
||||
{
|
||||
for (; op < &mips_opcodes[NUMOPCODES]; op++)
|
||||
{
|
||||
@ -2364,7 +2364,7 @@ print_insn_mips16 (bfd_vma memaddr, struct disassemble_info *info)
|
||||
n = lookup_mips_cp0sel_name (mips_cp0sel_names,
|
||||
mips_cp0sel_names_len,
|
||||
reg, sel);
|
||||
if (n != NULL)
|
||||
if (n)
|
||||
infprintf (is, "%s", n->name);
|
||||
else
|
||||
infprintf (is, "$%d,%d", reg, sel);
|
||||
|
@ -98,7 +98,7 @@ nios2_init_opcode_hash (void)
|
||||
{
|
||||
nios2_opcode_hash *tmp_hash = nios2_hash[i];
|
||||
printf ("index: 0x%02X ops: ", i);
|
||||
while (tmp_hash != NULL)
|
||||
while (tmp_hash)
|
||||
{
|
||||
printf ("%s ", tmp_hash->opcode->name);
|
||||
tmp_hash = tmp_hash->next;
|
||||
@ -110,7 +110,7 @@ nios2_init_opcode_hash (void)
|
||||
{
|
||||
nios2_opcode_hash *tmp_hash = nios2_ps_hash[i];
|
||||
printf ("index: 0x%02X ops: ", i);
|
||||
while (tmp_hash != NULL)
|
||||
while (tmp_hash)
|
||||
{
|
||||
printf ("%s ", tmp_hash->opcode->name);
|
||||
tmp_hash = tmp_hash->next;
|
||||
@ -337,7 +337,7 @@ nios2_disassemble (bfd_vma address, unsigned long opcode,
|
||||
the instruction and its arguments. */
|
||||
op = nios2_find_opcode_hash (opcode);
|
||||
|
||||
if (op != NULL)
|
||||
if (op)
|
||||
{
|
||||
bfd_boolean is_nop = FALSE;
|
||||
if (op->pinfo == NIOS2_INSN_MACRO_MOV)
|
||||
@ -360,7 +360,7 @@ nios2_disassemble (bfd_vma address, unsigned long opcode,
|
||||
if (!is_nop)
|
||||
{
|
||||
const char *argstr = op->args;
|
||||
if (argstr != NULL && *argstr != '\0')
|
||||
if (argstr && *argstr != '\0')
|
||||
{
|
||||
(*info->fprintf_func) (info->stream, " ");
|
||||
while (*argstr != '\0')
|
||||
|
@ -84,57 +84,57 @@ powerpc_init_dialect (struct disassemble_info *info)
|
||||
dialect |= PPC_OPCODE_64;
|
||||
}
|
||||
|
||||
if (info->disassembler_options && strstr (info->disassembler_options, "ppcps") != NULL) {
|
||||
if (info->disassembler_options && strstr (info->disassembler_options, "ppcps")) {
|
||||
dialect |= PPC_OPCODE_PPCPS;
|
||||
} else if (info->disassembler_options && strstr (info->disassembler_options, "booke") != NULL) {
|
||||
} else if (info->disassembler_options && strstr (info->disassembler_options, "booke")) {
|
||||
dialect |= PPC_OPCODE_BOOKE | PPC_OPCODE_BOOKE64;
|
||||
} else if ((info->mach == bfd_mach_ppc_e500mc) || (info->disassembler_options && strstr (info->disassembler_options, "e500mc") != NULL)) {
|
||||
} else if ((info->mach == bfd_mach_ppc_e500mc) || (info->disassembler_options && strstr (info->disassembler_options, "e500mc"))) {
|
||||
dialect |= (PPC_OPCODE_BOOKE | PPC_OPCODE_ISEL | PPC_OPCODE_PMR | PPC_OPCODE_CACHELCK | PPC_OPCODE_RFMCI | PPC_OPCODE_E500MC);
|
||||
} else if ((info->mach == bfd_mach_ppc_e500) || (info->disassembler_options && strstr (info->disassembler_options, "e500") != NULL)) {
|
||||
} else if ((info->mach == bfd_mach_ppc_e500) || (info->disassembler_options && strstr (info->disassembler_options, "e500"))) {
|
||||
dialect |= (PPC_OPCODE_BOOKE | PPC_OPCODE_SPE | PPC_OPCODE_ISEL | PPC_OPCODE_EFS | PPC_OPCODE_BRLOCK | PPC_OPCODE_PMR | PPC_OPCODE_CACHELCK | PPC_OPCODE_RFMCI | PPC_OPCODE_E500MC);
|
||||
} else if (info->disassembler_options && strstr (info->disassembler_options, "efs") != NULL) {
|
||||
} else if (info->disassembler_options && strstr (info->disassembler_options, "efs")) {
|
||||
dialect |= PPC_OPCODE_EFS;
|
||||
} else if (info->disassembler_options && strstr (info->disassembler_options, "e300") != NULL) {
|
||||
} else if (info->disassembler_options && strstr (info->disassembler_options, "e300")) {
|
||||
dialect |= PPC_OPCODE_E300 | PPC_OPCODE_CLASSIC | PPC_OPCODE_COMMON;
|
||||
} else if (info->disassembler_options && (strstr (info->disassembler_options, "440") != NULL || strstr (info->disassembler_options, "464") != NULL)) {
|
||||
} else if (info->disassembler_options && (strstr (info->disassembler_options, "440") || strstr (info->disassembler_options, "464"))) {
|
||||
dialect |= PPC_OPCODE_BOOKE | PPC_OPCODE_32 | PPC_OPCODE_440 | PPC_OPCODE_ISEL | PPC_OPCODE_RFMCI;
|
||||
} else {
|
||||
dialect |= (PPC_OPCODE_403 | PPC_OPCODE_601 | PPC_OPCODE_CLASSIC | PPC_OPCODE_COMMON | PPC_OPCODE_ALTIVEC);
|
||||
}
|
||||
|
||||
if (info->disassembler_options && strstr (info->disassembler_options, "power4") != NULL) {
|
||||
if (info->disassembler_options && strstr (info->disassembler_options, "power4")) {
|
||||
dialect |= PPC_OPCODE_POWER4;
|
||||
}
|
||||
|
||||
if (info->disassembler_options && strstr (info->disassembler_options, "power5") != NULL) {
|
||||
if (info->disassembler_options && strstr (info->disassembler_options, "power5")) {
|
||||
dialect |= PPC_OPCODE_POWER4 | PPC_OPCODE_POWER5;
|
||||
}
|
||||
|
||||
if (info->disassembler_options && strstr (info->disassembler_options, "cell") != NULL) {
|
||||
if (info->disassembler_options && strstr (info->disassembler_options, "cell")) {
|
||||
dialect |= PPC_OPCODE_POWER4 | PPC_OPCODE_CELL | PPC_OPCODE_ALTIVEC;
|
||||
}
|
||||
|
||||
if (info->disassembler_options && strstr (info->disassembler_options, "power6") != NULL) {
|
||||
if (info->disassembler_options && strstr (info->disassembler_options, "power6")) {
|
||||
dialect |= PPC_OPCODE_POWER4 | PPC_OPCODE_POWER5 | PPC_OPCODE_POWER6 | PPC_OPCODE_ALTIVEC;
|
||||
}
|
||||
|
||||
if (info->disassembler_options && strstr (info->disassembler_options, "power7") != NULL) {
|
||||
if (info->disassembler_options && strstr (info->disassembler_options, "power7")) {
|
||||
dialect |= PPC_OPCODE_POWER4 | PPC_OPCODE_POWER5 | PPC_OPCODE_POWER6 | PPC_OPCODE_ALTIVEC | PPC_OPCODE_VSX;
|
||||
}
|
||||
|
||||
if (info->disassembler_options && strstr (info->disassembler_options, "vsx") != NULL) {
|
||||
if (info->disassembler_options && strstr (info->disassembler_options, "vsx")) {
|
||||
dialect |= PPC_OPCODE_VSX;
|
||||
}
|
||||
|
||||
if (info->disassembler_options && strstr (info->disassembler_options, "any") != NULL) {
|
||||
if (info->disassembler_options && strstr (info->disassembler_options, "any")) {
|
||||
dialect |= PPC_OPCODE_ANY;
|
||||
}
|
||||
|
||||
if (info->disassembler_options)
|
||||
{
|
||||
if (strstr (info->disassembler_options, "32") != NULL) {
|
||||
if (strstr (info->disassembler_options, "32")) {
|
||||
dialect &= ~PPC_OPCODE_64;
|
||||
} else if (strstr (info->disassembler_options, "64") != NULL) {
|
||||
} else if (strstr (info->disassembler_options, "64")) {
|
||||
dialect |= PPC_OPCODE_64;
|
||||
}
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ disassemble_init_s390 (struct disassemble_info *info)
|
||||
current_arch_mask = 1 << S390_OPCODE_ZARCH;
|
||||
option_use_insn_len_bits_p = 0;
|
||||
|
||||
for (p = info->disassembler_options; p != NULL; )
|
||||
for (p = info->disassembler_options; p; )
|
||||
{
|
||||
if (CONST_STRNEQ (p, "esa"))
|
||||
current_arch_mask = 1 << S390_OPCODE_ESA;
|
||||
@ -78,7 +78,7 @@ disassemble_init_s390 (struct disassemble_info *info)
|
||||
}
|
||||
|
||||
p = strchr (p, ',');
|
||||
if (p != NULL)
|
||||
if (p)
|
||||
p++;
|
||||
}
|
||||
}
|
||||
@ -328,7 +328,7 @@ print_insn_s390 (bfd_vma memaddr, struct disassemble_info *info)
|
||||
opcode = op;
|
||||
}
|
||||
|
||||
if (opcode != NULL)
|
||||
if (opcode)
|
||||
{
|
||||
/* The instruction is valid. Print it and return its size. */
|
||||
s390_print_insn_with_opcode (memaddr, info, buffer, opcode);
|
||||
@ -340,7 +340,7 @@ print_insn_s390 (bfd_vma memaddr, struct disassemble_info *info)
|
||||
according to their length bits. */
|
||||
if (status == 0
|
||||
&& option_use_insn_len_bits_p
|
||||
&& info->section != NULL
|
||||
&& info->section
|
||||
&& (info->section->flags & SEC_CODE))
|
||||
bytes_to_dump = opsize;
|
||||
else
|
||||
|
@ -430,7 +430,7 @@ build_hash_table (const sparc_opcode **opcode_table,
|
||||
|
||||
memset (hash_table, 0, HASH_SIZE * sizeof (hash_table[0]));
|
||||
memset (hash_count, 0, HASH_SIZE * sizeof (hash_count[0]));
|
||||
if (hash_buf != NULL) {
|
||||
if (hash_buf) {
|
||||
free (hash_buf);
|
||||
}
|
||||
hash_buf = calloc (sizeof (* hash_buf), num_opcodes);
|
||||
|
@ -377,7 +377,7 @@ static char *do_decode(ut32 ins_off, ut32 ins_pos, ut32 two_ins, ut32 *next_ins_
|
||||
hash_aux = 0x223;
|
||||
}
|
||||
|
||||
if (ins_hash_code != NULL) {
|
||||
if (ins_hash_code) {
|
||||
*ins_hash_code = hash_code;
|
||||
}
|
||||
|
||||
|
@ -258,7 +258,7 @@ char *get_reg_pair(ut32 idx) {
|
||||
default: res = NULL;
|
||||
}
|
||||
|
||||
if (res != NULL) {
|
||||
if (res) {
|
||||
res = strdup (res);
|
||||
}
|
||||
|
||||
@ -323,7 +323,7 @@ char *get_reg_name_3(ut32 idx) {
|
||||
default: res = NULL;
|
||||
}
|
||||
|
||||
if (res != NULL) {
|
||||
if (res) {
|
||||
res = strdup (res);
|
||||
}
|
||||
return res;
|
||||
@ -379,7 +379,7 @@ char *get_reg_name_2(ut32 idx) {
|
||||
default: res = NULL;
|
||||
}
|
||||
|
||||
if (res != NULL) {
|
||||
if (res) {
|
||||
res = strdup (res);
|
||||
}
|
||||
|
||||
@ -634,7 +634,7 @@ char *get_reg_name_1(ut32 idx) {
|
||||
default: res = NULL;
|
||||
}
|
||||
|
||||
if (res != NULL) {
|
||||
if (res) {
|
||||
res = strdup (res);
|
||||
}
|
||||
|
||||
@ -850,7 +850,7 @@ char *get_status_regs_and_bits(char *reg_arg, int reg_bit) {
|
||||
}
|
||||
}
|
||||
|
||||
if (res != NULL) {
|
||||
if (res) {
|
||||
res = strdup (res);
|
||||
}
|
||||
|
||||
|
@ -1143,7 +1143,7 @@ find_core_reg (addr)
|
||||
struct sfrlist *psfr;
|
||||
int idx = addr & 0xff;
|
||||
|
||||
for (psfr = sfrs[idx]; psfr != NULL; psfr = psfr->next) {
|
||||
for (psfr = sfrs[idx]; psfr; psfr = psfr->next) {
|
||||
if ((psfr->sfr->addr == addr) && MATCHES_ISA (psfr->sfr->isa)) {
|
||||
return psfr->sfr->name;
|
||||
}
|
||||
@ -1556,7 +1556,7 @@ decode_tricore_insn (memaddr, insn, len32, info)
|
||||
tricore_fmt fmt;
|
||||
|
||||
/* Try to find the instruction matching the given opcode. */
|
||||
for (pinsn = insns[idx]; pinsn != NULL; pinsn = pinsn->next)
|
||||
for (pinsn = insns[idx]; pinsn; pinsn = pinsn->next)
|
||||
{
|
||||
if ((pinsn->code->len32 != len32) || (insn & pinsn->code->lose)) {
|
||||
continue;
|
||||
@ -1613,7 +1613,7 @@ decode_pcp_insn (memaddr, buffer, info)
|
||||
/* Try to find the PCP instruction matching the given opcode. */
|
||||
insn = bfd_getl16 (buffer);
|
||||
idx = (insn >> 11) & 0x1f;
|
||||
for (pinsn = pcpinsns[idx]; pinsn != NULL; pinsn = pinsn->next)
|
||||
for (pinsn = pcpinsns[idx]; pinsn; pinsn = pinsn->next)
|
||||
{
|
||||
if (((insn & pinsn->code->opcode) != pinsn->code->opcode) || (insn & pinsn->code->lose)) {
|
||||
continue;
|
||||
|
@ -404,7 +404,7 @@ print_insn_vax (bfd_vma memaddr, disassemble_info *info)
|
||||
priv.insn_start = memaddr;
|
||||
|
||||
if (! parsed_disassembler_options
|
||||
&& info->disassembler_options != NULL)
|
||||
&& info->disassembler_options)
|
||||
{
|
||||
parse_disassembler_options (info->disassembler_options);
|
||||
|
||||
|
@ -506,7 +506,7 @@ elf_xtensa_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < sizeof (elf_howto_table) / sizeof (elf_howto_table[0]); i++)
|
||||
if (elf_howto_table[i].name != NULL
|
||||
if (elf_howto_table[i].name
|
||||
&& r_str_casecmp (elf_howto_table[i].name, r_name) == 0)
|
||||
return &elf_howto_table[i];
|
||||
|
||||
@ -623,7 +623,7 @@ struct elf_xtensa_obj_tdata
|
||||
|
||||
#define is_xtensa_elf(bfd) \
|
||||
(bfd_get_flavour (bfd) == bfd_target_elf_flavour \
|
||||
&& elf_tdata (bfd) != NULL \
|
||||
&& elf_tdata (bfd) \
|
||||
&& elf_object_id (bfd) == XTENSA_ELF_DATA)
|
||||
|
||||
static bfd_boolean
|
||||
@ -684,7 +684,7 @@ elf_xtensa_link_hash_newfunc (struct bfd_hash_entry *entry,
|
||||
|
||||
/* Call the allocation method of the superclass. */
|
||||
entry = _bfd_elf_link_hash_newfunc (entry, table, string);
|
||||
if (entry != NULL)
|
||||
if (entry)
|
||||
{
|
||||
struct elf_xtensa_link_hash_entry *eh = elf_xtensa_hash_entry (entry);
|
||||
eh->tlsfunc_refcount = 0;
|
||||
@ -1124,8 +1124,8 @@ elf_xtensa_check_relocs (bfd *abfd,
|
||||
case R_XTENSA_GNU_VTENTRY:
|
||||
/* This relocation describes which C++ vtable entries are actually
|
||||
used. Record for later use during GC. */
|
||||
BFD_ASSERT (h != NULL);
|
||||
if (h != NULL
|
||||
BFD_ASSERT (h);
|
||||
if (h
|
||||
&& !bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend))
|
||||
return FALSE;
|
||||
continue;
|
||||
@ -1302,7 +1302,7 @@ elf_xtensa_gc_mark_hook (asection *sec,
|
||||
if (xtensa_is_property_section (sec))
|
||||
return NULL;
|
||||
|
||||
if (h != NULL)
|
||||
if (h)
|
||||
switch (ELF32_R_TYPE (rel->r_info))
|
||||
{
|
||||
case R_XTENSA_GNU_VTINHERIT:
|
||||
@ -1675,11 +1675,11 @@ elf_xtensa_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
|
||||
if (elf_hash_table (info)->dynamic_sections_created)
|
||||
{
|
||||
BFD_ASSERT (htab->srelgot != NULL
|
||||
&& htab->srelplt != NULL
|
||||
&& htab->sgot != NULL
|
||||
&& htab->spltlittbl != NULL
|
||||
&& htab->sgotloc != NULL);
|
||||
BFD_ASSERT (htab->srelgot
|
||||
&& htab->srelplt
|
||||
&& htab->sgot
|
||||
&& htab->spltlittbl
|
||||
&& htab->sgotloc);
|
||||
|
||||
/* Set the contents of the .interp section to the interpreter. */
|
||||
if (info->executable)
|
||||
@ -1721,13 +1721,13 @@ elf_xtensa_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
created earlier because the initial count of PLT relocations
|
||||
was an overestimate. */
|
||||
for (chunk = 0;
|
||||
(splt = elf_xtensa_get_plt_section (info, chunk)) != NULL;
|
||||
(splt = elf_xtensa_get_plt_section (info, chunk));
|
||||
chunk++)
|
||||
{
|
||||
int chunk_entries;
|
||||
|
||||
sgotplt = elf_xtensa_get_gotplt_section (info, chunk);
|
||||
BFD_ASSERT (sgotplt != NULL);
|
||||
BFD_ASSERT (sgotplt);
|
||||
|
||||
if (chunk < plt_chunks - 1)
|
||||
chunk_entries = PLT_ENTRIES_PER_CHUNK;
|
||||
@ -1754,11 +1754,11 @@ elf_xtensa_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
literal tables. */
|
||||
sgotloc = htab->sgotloc;
|
||||
sgotloc->size = spltlittbl->size;
|
||||
for (abfd = info->input_bfds; abfd != NULL; abfd = abfd->link.next)
|
||||
for (abfd = info->input_bfds; abfd; abfd = abfd->link.next)
|
||||
{
|
||||
if (abfd->flags & DYNAMIC)
|
||||
continue;
|
||||
for (s = abfd->sections; s != NULL; s = s->next)
|
||||
for (s = abfd->sections; s; s = s->next)
|
||||
{
|
||||
if (! discarded_section (s)
|
||||
&& xtensa_is_littable_section (s)
|
||||
@ -1771,7 +1771,7 @@ elf_xtensa_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
/* Allocate memory for dynamic sections. */
|
||||
relplt = FALSE;
|
||||
relgot = FALSE;
|
||||
for (s = dynobj->sections; s != NULL; s = s->next)
|
||||
for (s = dynobj->sections; s; s = s->next)
|
||||
{
|
||||
const char *name;
|
||||
|
||||
@ -2227,7 +2227,7 @@ vsprint_msg (const char *origmsg, const char *fmt, int arglen, ...)
|
||||
message = (char *) bfd_realloc_or_free (message, len);
|
||||
alloc_size = len;
|
||||
}
|
||||
if (message != NULL)
|
||||
if (message)
|
||||
{
|
||||
if (!is_append)
|
||||
memcpy (message, origmsg, orig_len);
|
||||
@ -2368,7 +2368,7 @@ elf_xtensa_create_plt_entry (struct bfd_link_info *info,
|
||||
chunk = reloc_index / PLT_ENTRIES_PER_CHUNK;
|
||||
splt = elf_xtensa_get_plt_section (info, chunk);
|
||||
sgotplt = elf_xtensa_get_gotplt_section (info, chunk);
|
||||
BFD_ASSERT (splt != NULL && sgotplt != NULL);
|
||||
BFD_ASSERT (splt && sgotplt);
|
||||
|
||||
plt_base = splt->output_section->vma + splt->output_offset;
|
||||
got_base = sgotplt->output_section->vma + sgotplt->output_offset;
|
||||
@ -2706,7 +2706,7 @@ elf_xtensa_relocate_section (bfd *output_bfd,
|
||||
sym_type = h->type;
|
||||
}
|
||||
|
||||
if (sec != NULL && discarded_section (sec))
|
||||
if (sec && discarded_section (sec))
|
||||
RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section,
|
||||
rel, 1, relend, howto, 0, contents);
|
||||
|
||||
@ -2830,7 +2830,7 @@ elf_xtensa_relocate_section (bfd *output_bfd,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (h != NULL)
|
||||
if (h)
|
||||
name = h->root.root.string;
|
||||
else
|
||||
{
|
||||
@ -2883,7 +2883,7 @@ elf_xtensa_relocate_section (bfd *output_bfd,
|
||||
else
|
||||
srel = htab->srelgot;
|
||||
|
||||
BFD_ASSERT (srel != NULL);
|
||||
BFD_ASSERT (srel);
|
||||
|
||||
outrel.r_offset =
|
||||
_bfd_elf_section_offset (output_bfd, info,
|
||||
@ -3135,7 +3135,7 @@ elf_xtensa_relocate_section (bfd *output_bfd,
|
||||
if (r != bfd_reloc_ok && !warned)
|
||||
{
|
||||
BFD_ASSERT (r == bfd_reloc_dangerous || r == bfd_reloc_other);
|
||||
BFD_ASSERT (error_message != NULL);
|
||||
BFD_ASSERT (error_message);
|
||||
|
||||
if (rel->r_addend == 0)
|
||||
error_message = vsprint_msg (error_message, ": %s",
|
||||
@ -3327,7 +3327,7 @@ elf_xtensa_finish_dynamic_sections (bfd *output_bfd,
|
||||
|
||||
dynobj = elf_hash_table (info)->dynobj;
|
||||
sdyn = bfd_get_linker_section (dynobj, ".dynamic");
|
||||
BFD_ASSERT (sdyn != NULL);
|
||||
BFD_ASSERT (sdyn);
|
||||
|
||||
/* Set the first entry in the global offset table to the address of
|
||||
the dynamic section. */
|
||||
@ -3354,7 +3354,7 @@ elf_xtensa_finish_dynamic_sections (bfd *output_bfd,
|
||||
|
||||
srelgot = htab->srelgot;
|
||||
spltlittbl = htab->spltlittbl;
|
||||
BFD_ASSERT (srelgot != NULL && spltlittbl != NULL);
|
||||
BFD_ASSERT (srelgot && spltlittbl);
|
||||
|
||||
/* Find the first XTENSA_RTLD relocation. Presumably the rest
|
||||
of them follow immediately after.... */
|
||||
@ -3376,7 +3376,7 @@ elf_xtensa_finish_dynamic_sections (bfd *output_bfd,
|
||||
int chunk_entries = 0;
|
||||
|
||||
sgotplt = elf_xtensa_get_gotplt_section (info, chunk);
|
||||
BFD_ASSERT (sgotplt != NULL);
|
||||
BFD_ASSERT (sgotplt);
|
||||
|
||||
/* Emit special RTLD relocations for the first two entries in
|
||||
each chunk of the .got.plt section. */
|
||||
@ -3799,7 +3799,7 @@ elf_xtensa_discard_info (bfd *abfd,
|
||||
asection *sec;
|
||||
bfd_boolean changed = FALSE;
|
||||
|
||||
for (sec = abfd->sections; sec != NULL; sec = sec->next)
|
||||
for (sec = abfd->sections; sec; sec = sec->next)
|
||||
{
|
||||
if (xtensa_is_property_section (sec))
|
||||
{
|
||||
@ -5699,7 +5699,7 @@ removed_by_actions (text_action_list *action_list,
|
||||
{
|
||||
splay_tree_node node = splay_tree_lookup (action_list->tree,
|
||||
(splay_tree_key)r);
|
||||
BFD_ASSERT (node != NULL && r == (text_action *)node->value);
|
||||
BFD_ASSERT (node && r == (text_action *)node->value);
|
||||
}
|
||||
|
||||
while (r)
|
||||
@ -6072,7 +6072,7 @@ print_removed_literals (FILE *fp, removed_literal_list *removed_list)
|
||||
r = removed_list->head;
|
||||
if (r)
|
||||
fprintf (fp, "Removed Literals\n");
|
||||
for (; r != NULL; r = r->next)
|
||||
for (; r; r = r->next)
|
||||
{
|
||||
print_r_reloc (fp, &r->from);
|
||||
fprintf (fp, " => ");
|
||||
@ -6268,7 +6268,7 @@ cache_fix_array (asection *sec)
|
||||
if (relax_info->fix_list == NULL)
|
||||
return;
|
||||
|
||||
for (r = relax_info->fix_list; r != NULL; r = r->next)
|
||||
for (r = relax_info->fix_list; r; r = r->next)
|
||||
count++;
|
||||
|
||||
relax_info->fix_array =
|
||||
@ -6966,7 +6966,7 @@ elf_xtensa_relax_section (bfd *abfd,
|
||||
return TRUE;
|
||||
|
||||
relax_info = get_xtensa_relax_info (sec);
|
||||
BFD_ASSERT (relax_info != NULL);
|
||||
BFD_ASSERT (relax_info);
|
||||
|
||||
switch (relax_info->visited)
|
||||
{
|
||||
@ -7021,15 +7021,15 @@ analyze_relocations (struct bfd_link_info *link_info)
|
||||
bfd_boolean is_relaxable = FALSE;
|
||||
|
||||
/* Initialize the per-section relaxation info. */
|
||||
for (abfd = link_info->input_bfds; abfd != NULL; abfd = abfd->link.next)
|
||||
for (sec = abfd->sections; sec != NULL; sec = sec->next)
|
||||
for (abfd = link_info->input_bfds; abfd; abfd = abfd->link.next)
|
||||
for (sec = abfd->sections; sec; sec = sec->next)
|
||||
{
|
||||
init_xtensa_relax_info (sec);
|
||||
}
|
||||
|
||||
/* Mark relaxable sections (and count relocations against each one). */
|
||||
for (abfd = link_info->input_bfds; abfd != NULL; abfd = abfd->link.next)
|
||||
for (sec = abfd->sections; sec != NULL; sec = sec->next)
|
||||
for (abfd = link_info->input_bfds; abfd; abfd = abfd->link.next)
|
||||
for (sec = abfd->sections; sec; sec = sec->next)
|
||||
{
|
||||
if (!find_relaxable_sections (abfd, sec, link_info, &is_relaxable))
|
||||
return FALSE;
|
||||
@ -7040,8 +7040,8 @@ analyze_relocations (struct bfd_link_info *link_info)
|
||||
return TRUE;
|
||||
|
||||
/* Allocate space for source_relocs. */
|
||||
for (abfd = link_info->input_bfds; abfd != NULL; abfd = abfd->link.next)
|
||||
for (sec = abfd->sections; sec != NULL; sec = sec->next)
|
||||
for (abfd = link_info->input_bfds; abfd; abfd = abfd->link.next)
|
||||
for (sec = abfd->sections; sec; sec = sec->next)
|
||||
{
|
||||
xtensa_relax_info *relax_info;
|
||||
|
||||
@ -7057,16 +7057,16 @@ analyze_relocations (struct bfd_link_info *link_info)
|
||||
}
|
||||
|
||||
/* Collect info on relocations against each relaxable section. */
|
||||
for (abfd = link_info->input_bfds; abfd != NULL; abfd = abfd->link.next)
|
||||
for (sec = abfd->sections; sec != NULL; sec = sec->next)
|
||||
for (abfd = link_info->input_bfds; abfd; abfd = abfd->link.next)
|
||||
for (sec = abfd->sections; sec; sec = sec->next)
|
||||
{
|
||||
if (!collect_source_relocs (abfd, sec, link_info))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Compute the text actions. */
|
||||
for (abfd = link_info->input_bfds; abfd != NULL; abfd = abfd->link.next)
|
||||
for (sec = abfd->sections; sec != NULL; sec = sec->next)
|
||||
for (abfd = link_info->input_bfds; abfd; abfd = abfd->link.next)
|
||||
for (sec = abfd->sections; sec; sec = sec->next)
|
||||
{
|
||||
if (!compute_text_actions (abfd, sec, link_info))
|
||||
return FALSE;
|
||||
@ -8359,7 +8359,7 @@ xlate_offset_with_removed_text (const xlate_map_t *map,
|
||||
sizeof (xlate_map_entry_t), &xlate_compare);
|
||||
e = (xlate_map_entry_t *) r;
|
||||
|
||||
BFD_ASSERT (e != NULL);
|
||||
BFD_ASSERT (e);
|
||||
if (e == NULL)
|
||||
return offset;
|
||||
return e->new_address - e->orig_address + offset;
|
||||
@ -9571,7 +9571,7 @@ relax_section (bfd *abfd, asection *sec, struct bfd_link_info *link_info)
|
||||
if (! elf_xtensa_ignore_discarded_relocs (sec)
|
||||
&& elf_xtensa_action_discarded (sec) == PRETEND
|
||||
&& sec->sec_info_type != SEC_INFO_TYPE_STABS
|
||||
&& target_sec != NULL
|
||||
&& target_sec
|
||||
&& discarded_section (target_sec))
|
||||
{
|
||||
/* It would be natural to call _bfd_elf_check_kept_section
|
||||
@ -9583,7 +9583,7 @@ relax_section (bfd *abfd, asection *sec, struct bfd_link_info *link_info)
|
||||
so just compare the section names to find the right group
|
||||
member. */
|
||||
asection *kept = target_sec->kept_section;
|
||||
if (kept != NULL)
|
||||
if (kept)
|
||||
{
|
||||
if ((kept->flags & SEC_GROUP) != 0)
|
||||
{
|
||||
@ -9591,7 +9591,7 @@ relax_section (bfd *abfd, asection *sec, struct bfd_link_info *link_info)
|
||||
asection *s = first;
|
||||
|
||||
kept = NULL;
|
||||
while (s != NULL)
|
||||
while (s)
|
||||
{
|
||||
if (strcmp (s->name, target_sec->name) == 0)
|
||||
{
|
||||
@ -9604,7 +9604,7 @@ relax_section (bfd *abfd, asection *sec, struct bfd_link_info *link_info)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (kept != NULL
|
||||
if (kept
|
||||
&& ((target_sec->rawsize != 0
|
||||
? target_sec->rawsize : target_sec->size)
|
||||
== (kept->rawsize != 0 ? kept->rawsize : kept->size)))
|
||||
@ -9936,7 +9936,7 @@ translate_section_fixes (asection *sec)
|
||||
if (!relax_info)
|
||||
return TRUE;
|
||||
|
||||
for (r = relax_info->fix_list; r != NULL; r = r->next)
|
||||
for (r = relax_info->fix_list; r; r = r->next)
|
||||
if (!translate_reloc_bfd_fix (r))
|
||||
return FALSE;
|
||||
|
||||
@ -9999,7 +9999,7 @@ translate_reloc_bfd_fix (reloc_bfd_fix *fix)
|
||||
|
||||
/* The fact that there is still a relocation to this literal indicates
|
||||
that the literal is being coalesced, not simply removed. */
|
||||
BFD_ASSERT (removed->to.abfd != NULL);
|
||||
BFD_ASSERT (removed->to.abfd);
|
||||
|
||||
/* This was moved to some other address (possibly another section). */
|
||||
new_sec = r_reloc_get_section (&removed->to);
|
||||
@ -10069,7 +10069,7 @@ translate_reloc (const r_reloc *orig_rel, r_reloc *new_rel, asection *sec)
|
||||
|
||||
/* The fact that there is still a relocation to this literal indicates
|
||||
that the literal is being coalesced, not simply removed. */
|
||||
BFD_ASSERT (removed->to.abfd != NULL);
|
||||
BFD_ASSERT (removed->to.abfd);
|
||||
|
||||
/* This was moved to some other address
|
||||
(possibly in another section). */
|
||||
@ -10179,7 +10179,7 @@ shrink_dynamic_reloc_sections (struct bfd_link_info *info,
|
||||
srel = htab->srelgot;
|
||||
|
||||
/* Reduce size of the .rela.* section by one reloc. */
|
||||
BFD_ASSERT (srel != NULL);
|
||||
BFD_ASSERT (srel);
|
||||
BFD_ASSERT (srel->size >= sizeof (Elf32_External_Rela));
|
||||
srel->size -= sizeof (Elf32_External_Rela);
|
||||
|
||||
@ -10199,14 +10199,14 @@ shrink_dynamic_reloc_sections (struct bfd_link_info *info,
|
||||
chunk = reloc_index / PLT_ENTRIES_PER_CHUNK;
|
||||
splt = elf_xtensa_get_plt_section (info, chunk);
|
||||
sgotplt = elf_xtensa_get_gotplt_section (info, chunk);
|
||||
BFD_ASSERT (splt != NULL && sgotplt != NULL);
|
||||
BFD_ASSERT (splt && sgotplt);
|
||||
|
||||
/* Check if an entire PLT chunk has just been eliminated. */
|
||||
if (reloc_index % PLT_ENTRIES_PER_CHUNK == 0)
|
||||
{
|
||||
/* The two magic GOT entries for that chunk can go away. */
|
||||
srelgot = htab->srelgot;
|
||||
BFD_ASSERT (srelgot != NULL);
|
||||
BFD_ASSERT (srelgot);
|
||||
srelgot->reloc_count -= 2;
|
||||
srelgot->size -= 2 * sizeof (Elf32_External_Rela);
|
||||
sgotplt->size -= 8;
|
||||
@ -11149,8 +11149,8 @@ match_section_group (bfd *abfd ATTRIBUTE_UNUSED, asection *sec, void *inf)
|
||||
const char *group_name = elf_group_name (sec);
|
||||
|
||||
return (group_name == gname
|
||||
|| (group_name != NULL
|
||||
&& gname != NULL
|
||||
|| (group_name
|
||||
&& gname
|
||||
&& strcmp (group_name, gname) == 0));
|
||||
}
|
||||
|
||||
|
@ -142,7 +142,7 @@ static int disassemble(RAsm *a, RAsmOp *op, const ut8 *buf, int len) {
|
||||
/* if name is null, but extra is present, it means 6 most significant bits
|
||||
* are not enough to decode instruction */
|
||||
if (!insn_descr->name && insn_descr->extra) {
|
||||
if ((extra_descr = find_extra_descriptor(insn_descr->extra, insn)) != NULL) {
|
||||
if ((extra_descr = find_extra_descriptor(insn_descr->extra, insn))) {
|
||||
insn_to_str (a, &line, insn_descr, extra_descr, insn);
|
||||
} else {
|
||||
line = strdup ("invalid");
|
||||
|
@ -15,7 +15,7 @@ static int arch_xap_disasm(char *str, const unsigned char *buf, ut64 seek) {
|
||||
s->s_off = seek;
|
||||
s->s_out = NULL;
|
||||
d = next_inst(s);
|
||||
if (d != NULL) {
|
||||
if (d) {
|
||||
xap_decode (s, d);
|
||||
strcpy (str, d->d_asm);
|
||||
free (d);
|
||||
|
@ -423,7 +423,7 @@ static bool __isDataSection(RBinFile *a, RBinSection *s) {
|
||||
return true;
|
||||
}
|
||||
// Rust
|
||||
return strstr (s->name, "_const") != NULL;
|
||||
return strstr (s->name, "_const");
|
||||
}
|
||||
|
||||
static void get_strings_range(RBinFile *bf, RList *list, int min, int raw, ut64 from, ut64 to, RBinSection *section) {
|
||||
@ -824,7 +824,7 @@ R_IPI bool r_bin_file_set_bytes(RBinFile *bf, const ut8 *bytes, ut64 sz, bool st
|
||||
} else {
|
||||
bf->buf = r_buf_new_with_bytes (bytes, sz);
|
||||
}
|
||||
return bf->buf != NULL;
|
||||
return bf->buf;
|
||||
}
|
||||
|
||||
R_API RBinPlugin *r_bin_file_cur_plugin(RBinFile *bf) {
|
||||
|
@ -344,7 +344,7 @@ static bool is_printable_lang(ut64 attr_code) {
|
||||
if (attr_code >= sizeof (dwarf_langs) / sizeof (dwarf_langs[0])) {
|
||||
return false;
|
||||
}
|
||||
return dwarf_langs[attr_code] != NULL;
|
||||
return dwarf_langs[attr_code];
|
||||
}
|
||||
|
||||
static inline bool is_printable_attr(ut64 attr_code) {
|
||||
|
@ -1,8 +1,5 @@
|
||||
/* radare - LGPL - Copyright 2008-2021 - nibble, pancake, alvaro_fe */
|
||||
/* radare - LGPL - Copyright 2008-2022 - nibble, pancake, alvaro_fe */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <r_types.h>
|
||||
#include <r_util.h>
|
||||
#include "elf.h"
|
||||
@ -2500,24 +2497,25 @@ int Elf_(r_bin_elf_get_bits)(ELFOBJ *bin) {
|
||||
}
|
||||
|
||||
static inline int noodle(ELFOBJ *bin, const char *s) {
|
||||
if (r_buf_size (bin->b) <= 64) {
|
||||
return 0;
|
||||
if (r_buf_size (bin->b) >= 64) {
|
||||
ut8 tmp[64] = {0};
|
||||
if (r_buf_read_at (bin->b, r_buf_size (bin->b) - 64, tmp, 64) == 64) {
|
||||
return (bool)r_mem_mem (tmp, 64, (const ut8 *)s, strlen (s));
|
||||
}
|
||||
}
|
||||
ut8 tmp[64];
|
||||
r_buf_read_at (bin->b, r_buf_size (bin->b) - 64, tmp, 64);
|
||||
return r_mem_mem (tmp, 64, (const ut8 *)s, strlen (s)) != NULL;
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline int needle(ELFOBJ *bin, const char *s) {
|
||||
static inline bool needle(ELFOBJ *bin, const char *s) {
|
||||
if (bin->shstrtab) {
|
||||
ut32 len = bin->shstrtab_size;
|
||||
if (len > 4096) {
|
||||
len = 4096; // avoid slow loading .. can be buggy?
|
||||
}
|
||||
return r_mem_mem ((const ut8*)bin->shstrtab, len,
|
||||
(const ut8*)s, strlen (s)) != NULL;
|
||||
return (bool)r_mem_mem ((const ut8*)bin->shstrtab, len,
|
||||
(const ut8*)s, strlen (s));
|
||||
}
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
// TODO: must return const char * all those strings must be const char os[LINUX] or so
|
||||
|
@ -451,7 +451,7 @@ void dotnet_parse_tilde_2(
|
||||
string_offset,
|
||||
DOTNET_STRING_INDEX(module_table->Name));
|
||||
|
||||
if (name != NULL)
|
||||
if (name)
|
||||
set_string(name, pe->object, "module_name");
|
||||
|
||||
table_offset += (
|
||||
@ -670,7 +670,7 @@ void dotnet_parse_tilde_2(
|
||||
|
||||
row_size = (index_size + index_size2 + index_sizes.blob);
|
||||
|
||||
if (typeref_ptr != NULL && memberref_ptr != NULL)
|
||||
if (typeref_ptr && memberref_ptr)
|
||||
{
|
||||
row_ptr = table_offset;
|
||||
|
||||
@ -801,7 +801,7 @@ void dotnet_parse_tilde_2(
|
||||
pe, string_offset, *(WORD*) typeref_row);
|
||||
}
|
||||
|
||||
if (name != NULL && strncmp(name, "GuidAttribute", 13) != 0)
|
||||
if (name && strncmp(name, "GuidAttribute", 13) != 0)
|
||||
{
|
||||
row_ptr += row_size;
|
||||
continue;
|
||||
@ -1002,7 +1002,7 @@ void dotnet_parse_tilde_2(
|
||||
string_offset,
|
||||
DOTNET_STRING_INDEX(moduleref_table->Name));
|
||||
|
||||
if (name != NULL)
|
||||
if (name)
|
||||
{
|
||||
set_string(name, pe->object, "modulerefs[%i]", counter);
|
||||
counter++;
|
||||
@ -1085,7 +1085,7 @@ void dotnet_parse_tilde_2(
|
||||
row_ptr + 4 + 2 + 2 + 2 + 2 + 4 +
|
||||
index_sizes.blob));
|
||||
|
||||
if (name != NULL)
|
||||
if (name)
|
||||
set_string(name, pe->object, "assembly.name");
|
||||
|
||||
// Culture comes after Name.
|
||||
@ -1112,7 +1112,7 @@ void dotnet_parse_tilde_2(
|
||||
|
||||
// Sometimes it will be a zero length string. This is technically
|
||||
// against the specification but happens from time to time.
|
||||
if (name != NULL && strlen(name) > 0)
|
||||
if (name && strlen(name) > 0)
|
||||
set_string(name, pe->object, "assembly.culture");
|
||||
|
||||
table_offset += row_size * num_rows;
|
||||
@ -1185,7 +1185,7 @@ void dotnet_parse_tilde_2(
|
||||
string_offset,
|
||||
*(WORD*) (row_ptr + 2 + 2 + 2 + 2 + 4 + index_sizes.blob));
|
||||
|
||||
if (name != NULL)
|
||||
if (name)
|
||||
set_string(name, pe->object, "assembly_refs[%i].name", i);
|
||||
|
||||
row_ptr += row_size;
|
||||
@ -1287,7 +1287,7 @@ void dotnet_parse_tilde_2(
|
||||
string_offset,
|
||||
DOTNET_STRING_INDEX(manifestresource_table->Name));
|
||||
|
||||
if (name != NULL)
|
||||
if (name)
|
||||
set_string(name, pe->object, "resources[%i].name", counter);
|
||||
|
||||
row_ptr += row_size;
|
||||
@ -1564,7 +1564,7 @@ void dotnet_parse_com(PE* pe, ut64 baddr) {
|
||||
// 4. We need to exclude the terminator and the padding, so search for the
|
||||
// first NULL byte.
|
||||
end = (char*) memmem((void*) metadata->Version, metadata->Length, "\0", 1);
|
||||
if (end != NULL)
|
||||
if (end)
|
||||
set_sized_string(metadata->Version,
|
||||
(end - metadata->Version),
|
||||
pe->object,
|
||||
|
@ -3246,7 +3246,7 @@ static int bin_pe_init_security(RBinPEObj *pe) {
|
||||
}
|
||||
free ((void *)claimed_authentihash);
|
||||
}
|
||||
pe->is_signed = pe->cms != NULL;
|
||||
pe->is_signed = pe->cms;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* radare - LGPL - Copyright 2008-2017 nibble, pancake */
|
||||
|
||||
#define R_BIN_PE64 1
|
||||
#include "pe_write.c"
|
||||
#include "pe_write.c"
|
||||
|
@ -1034,7 +1034,7 @@ d_make_comp (struct d_info *di, enum demangle_component_type type,
|
||||
}
|
||||
|
||||
p = d_make_empty (di);
|
||||
if (p != NULL)
|
||||
if (p)
|
||||
{
|
||||
p->type = type;
|
||||
p->u.s_binary.left = left;
|
||||
@ -1078,7 +1078,7 @@ d_make_builtin_type (struct d_info *di,
|
||||
if (type == NULL)
|
||||
return NULL;
|
||||
p = d_make_empty (di);
|
||||
if (p != NULL)
|
||||
if (p)
|
||||
{
|
||||
p->type = DEMANGLE_COMPONENT_BUILTIN_TYPE;
|
||||
p->u.s_builtin.type = type;
|
||||
@ -1094,7 +1094,7 @@ d_make_operator (struct d_info *di, const struct demangle_operator_info *op)
|
||||
struct demangle_component *p;
|
||||
|
||||
p = d_make_empty (di);
|
||||
if (p != NULL)
|
||||
if (p)
|
||||
{
|
||||
p->type = DEMANGLE_COMPONENT_OPERATOR;
|
||||
p->u.s_operator.op = op;
|
||||
@ -1166,7 +1166,7 @@ d_make_template_param (struct d_info *di, int i)
|
||||
struct demangle_component *p;
|
||||
|
||||
p = d_make_empty (di);
|
||||
if (p != NULL)
|
||||
if (p)
|
||||
{
|
||||
p->type = DEMANGLE_COMPONENT_TEMPLATE_PARAM;
|
||||
p->u.s_number.number = i;
|
||||
@ -1182,7 +1182,7 @@ d_make_function_param (struct d_info *di, int i)
|
||||
struct demangle_component *p;
|
||||
|
||||
p = d_make_empty (di);
|
||||
if (p != NULL)
|
||||
if (p)
|
||||
{
|
||||
p->type = DEMANGLE_COMPONENT_FUNCTION_PARAM;
|
||||
p->u.s_number.number = i;
|
||||
@ -1198,7 +1198,7 @@ d_make_sub (struct d_info *di, const char *name, int len)
|
||||
struct demangle_component *p;
|
||||
|
||||
p = d_make_empty (di);
|
||||
if (p != NULL)
|
||||
if (p)
|
||||
{
|
||||
p->type = DEMANGLE_COMPONENT_SUB_STD;
|
||||
p->u.s_string.string = name;
|
||||
@ -1618,7 +1618,7 @@ d_unqualified_name (struct d_info *di)
|
||||
if (peek == 'o' && d_peek_next_char (di) == 'n')
|
||||
d_advance (di, 2);
|
||||
ret = d_operator_name (di);
|
||||
if (ret != NULL && ret->type == DEMANGLE_COMPONENT_OPERATOR)
|
||||
if (ret && ret->type == DEMANGLE_COMPONENT_OPERATOR)
|
||||
{
|
||||
di->expansion += sizeof "operator" + ret->u.s_operator.op->len - 2;
|
||||
if (!strcmp (ret->u.s_operator.op->code, "li"))
|
||||
@ -1910,7 +1910,7 @@ d_make_character (struct d_info *di, int c)
|
||||
{
|
||||
struct demangle_component *p;
|
||||
p = d_make_empty (di);
|
||||
if (p != NULL)
|
||||
if (p)
|
||||
{
|
||||
p->type = DEMANGLE_COMPONENT_CHARACTER;
|
||||
p->u.s_character.character = c;
|
||||
@ -2201,7 +2201,7 @@ d_call_offset (struct d_info *di, int c)
|
||||
static struct demangle_component *
|
||||
d_ctor_dtor_name (struct d_info *di)
|
||||
{
|
||||
if (di->last_name != NULL)
|
||||
if (di->last_name)
|
||||
{
|
||||
if (di->last_name->type == DEMANGLE_COMPONENT_NAME)
|
||||
di->expansion += di->last_name->u.s_name.len;
|
||||
@ -2550,7 +2550,7 @@ cplus_demangle_type (struct d_info *di)
|
||||
a new substitution candidate. However, if the
|
||||
substitution was followed by template arguments, then
|
||||
the whole thing is a substitution candidate. */
|
||||
if (ret != NULL && ret->type == DEMANGLE_COMPONENT_SUB_STD)
|
||||
if (ret && ret->type == DEMANGLE_COMPONENT_SUB_STD)
|
||||
can_subst = 0;
|
||||
}
|
||||
}
|
||||
@ -3902,7 +3902,7 @@ d_substitution (struct d_info *di, int prefix)
|
||||
int len;
|
||||
struct demangle_component *dc;
|
||||
|
||||
if (p->set_last_name != NULL)
|
||||
if (p->set_last_name)
|
||||
di->last_name = d_make_sub (di, p->set_last_name,
|
||||
p->set_last_name_len);
|
||||
if (verbose)
|
||||
@ -4357,7 +4357,7 @@ d_index_template_argument (struct demangle_component *args, int i)
|
||||
return args;
|
||||
|
||||
for (a = args;
|
||||
a != NULL;
|
||||
a;
|
||||
a = d_right (a))
|
||||
{
|
||||
if (a->type != DEMANGLE_COMPONENT_TEMPLATE_ARGLIST)
|
||||
@ -4447,7 +4447,7 @@ d_pack_length (const struct demangle_component *dc)
|
||||
{
|
||||
int count = 0;
|
||||
while (dc && dc->type == DEMANGLE_COMPONENT_TEMPLATE_ARGLIST
|
||||
&& d_left (dc) != NULL)
|
||||
&& d_left (dc))
|
||||
{
|
||||
++count;
|
||||
dc = d_right (dc);
|
||||
@ -4519,7 +4519,7 @@ d_save_scope (struct d_print_info *dpi,
|
||||
scope->container = container;
|
||||
link = &scope->templates;
|
||||
|
||||
for (src = dpi->templates; src != NULL; src = src->next)
|
||||
for (src = dpi->templates; src; src = src->next)
|
||||
{
|
||||
struct d_print_template *dst;
|
||||
|
||||
@ -4695,7 +4695,7 @@ d_print_comp_inner (struct d_print_info *dpi, int options,
|
||||
dpi->modifiers = 0;
|
||||
i = 0;
|
||||
typed_name = d_left (dc);
|
||||
while (typed_name != NULL)
|
||||
while (typed_name)
|
||||
{
|
||||
if (i >= sizeof adpm / sizeof adpm[0])
|
||||
{
|
||||
@ -4993,7 +4993,7 @@ d_print_comp_inner (struct d_print_info *dpi, int options,
|
||||
same CV-qualifier gets pushed on the stack multiple times.
|
||||
We only need to print it once. */
|
||||
|
||||
for (pdpm = dpi->modifiers; pdpm != NULL; pdpm = pdpm->next)
|
||||
for (pdpm = dpi->modifiers; pdpm; pdpm = pdpm->next)
|
||||
{
|
||||
if (! pdpm->printed)
|
||||
{
|
||||
@ -5040,7 +5040,7 @@ d_print_comp_inner (struct d_print_info *dpi, int options,
|
||||
/* This traversal is reentering SUB as a substition.
|
||||
If we are not beneath SUB or DC in the tree then we
|
||||
need to restore SUB's template stack temporarily. */
|
||||
for (dcse = dpi->component_stack; dcse != NULL;
|
||||
for (dcse = dpi->component_stack; dcse;
|
||||
dcse = dcse->parent)
|
||||
{
|
||||
if (dcse->dc == sub
|
||||
@ -5139,10 +5139,10 @@ d_print_comp_inner (struct d_print_info *dpi, int options,
|
||||
dc, dpi->modifiers);
|
||||
|
||||
/* Print return type if present */
|
||||
if (d_left (dc) != NULL && (options & DMGL_RET_POSTFIX) != 0)
|
||||
if (d_left (dc) && (options & DMGL_RET_POSTFIX) != 0)
|
||||
d_print_comp (dpi, options & ~(DMGL_RET_POSTFIX | DMGL_RET_DROP),
|
||||
d_left (dc));
|
||||
else if (d_left (dc) != NULL && (options & DMGL_RET_DROP) == 0)
|
||||
else if (d_left (dc) && (options & DMGL_RET_DROP) == 0)
|
||||
{
|
||||
struct d_print_mod dpm;
|
||||
|
||||
@ -5201,7 +5201,7 @@ d_print_comp_inner (struct d_print_info *dpi, int options,
|
||||
|
||||
i = 1;
|
||||
pdpm = hold_modifiers;
|
||||
while (pdpm != NULL
|
||||
while (pdpm
|
||||
&& (pdpm->mod->type == DEMANGLE_COMPONENT_RESTRICT
|
||||
|| pdpm->mod->type == DEMANGLE_COMPONENT_VOLATILE
|
||||
|| pdpm->mod->type == DEMANGLE_COMPONENT_CONST))
|
||||
@ -5283,9 +5283,9 @@ d_print_comp_inner (struct d_print_info *dpi, int options,
|
||||
|
||||
case DEMANGLE_COMPONENT_ARGLIST:
|
||||
case DEMANGLE_COMPONENT_TEMPLATE_ARGLIST:
|
||||
if (d_left (dc) != NULL)
|
||||
if (d_left (dc))
|
||||
d_print_comp (dpi, options, d_left (dc));
|
||||
if (d_right (dc) != NULL)
|
||||
if (d_right (dc))
|
||||
{
|
||||
size_t len;
|
||||
unsigned long int flush_count;
|
||||
@ -5508,7 +5508,7 @@ d_print_comp_inner (struct d_print_info *dpi, int options,
|
||||
else
|
||||
{
|
||||
d_append_string (dpi, "new ");
|
||||
if (d_left (first) != NULL)
|
||||
if (d_left (first))
|
||||
{
|
||||
d_print_subexpr (dpi, options, first);
|
||||
d_append_char (dpi, ' ');
|
||||
@ -5982,7 +5982,7 @@ d_print_function_type (struct d_print_info *dpi, int options,
|
||||
|
||||
need_paren = 0;
|
||||
need_space = 0;
|
||||
for (p = mods; p != NULL; p = p->next)
|
||||
for (p = mods; p; p = p->next)
|
||||
{
|
||||
if (p->printed)
|
||||
break;
|
||||
@ -6036,7 +6036,7 @@ d_print_function_type (struct d_print_info *dpi, int options,
|
||||
|
||||
d_append_char (dpi, '(');
|
||||
|
||||
if (d_right (dc) != NULL)
|
||||
if (d_right (dc))
|
||||
d_print_comp (dpi, options, d_right (dc));
|
||||
|
||||
d_append_char (dpi, ')');
|
||||
@ -6056,13 +6056,13 @@ d_print_array_type (struct d_print_info *dpi, int options,
|
||||
int need_space;
|
||||
|
||||
need_space = 1;
|
||||
if (mods != NULL)
|
||||
if (mods)
|
||||
{
|
||||
int need_paren;
|
||||
struct d_print_mod *p;
|
||||
|
||||
need_paren = 0;
|
||||
for (p = mods; p != NULL; p = p->next)
|
||||
for (p = mods; p; p = p->next)
|
||||
{
|
||||
if (! p->printed)
|
||||
{
|
||||
@ -6094,7 +6094,7 @@ d_print_array_type (struct d_print_info *dpi, int options,
|
||||
|
||||
d_append_char (dpi, '[');
|
||||
|
||||
if (d_left (dc) != NULL)
|
||||
if (d_left (dc))
|
||||
d_print_comp (dpi, options, d_left (dc));
|
||||
|
||||
d_append_char (dpi, ']');
|
||||
@ -6132,7 +6132,7 @@ d_print_conversion (struct d_print_info *dpi, int options,
|
||||
|
||||
/* For a conversion operator, we need the template parameters from
|
||||
the enclosing template in scope for processing the type. */
|
||||
if (dpi->current_template != NULL)
|
||||
if (dpi->current_template)
|
||||
{
|
||||
dpt.next = dpi->templates;
|
||||
dpi->templates = &dpt;
|
||||
@ -6142,7 +6142,7 @@ d_print_conversion (struct d_print_info *dpi, int options,
|
||||
if (d_left (dc)->type != DEMANGLE_COMPONENT_TEMPLATE)
|
||||
{
|
||||
d_print_comp (dpi, options, d_left (dc));
|
||||
if (dpi->current_template != NULL)
|
||||
if (dpi->current_template)
|
||||
dpi->templates = dpt.next;
|
||||
}
|
||||
else
|
||||
@ -6152,7 +6152,7 @@ d_print_conversion (struct d_print_info *dpi, int options,
|
||||
/* For a templated cast operator, we need to remove the template
|
||||
parameters from scope after printing the operator name,
|
||||
so we need to handle the template printing here. */
|
||||
if (dpi->current_template != NULL)
|
||||
if (dpi->current_template)
|
||||
dpi->templates = dpt.next;
|
||||
|
||||
if (d_last_char (dpi) == '<')
|
||||
@ -6282,7 +6282,7 @@ d_demangle_callback (const char *mangled, int options,
|
||||
d_dump (dc, 0);
|
||||
#endif
|
||||
|
||||
status = (dc != NULL)
|
||||
status = (dc)
|
||||
? cplus_demangle_print_callback (options, dc, callback, opaque)
|
||||
: 0;
|
||||
}
|
||||
@ -6357,14 +6357,14 @@ __cxa_demangle (const char *mangled_name, char *output_buffer,
|
||||
|
||||
if (mangled_name == NULL)
|
||||
{
|
||||
if (status != NULL)
|
||||
if (status)
|
||||
*status = -3;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (output_buffer != NULL && length == NULL)
|
||||
if (output_buffer && length == NULL)
|
||||
{
|
||||
if (status != NULL)
|
||||
if (status)
|
||||
*status = -3;
|
||||
return NULL;
|
||||
}
|
||||
@ -6373,7 +6373,7 @@ __cxa_demangle (const char *mangled_name, char *output_buffer,
|
||||
|
||||
if (demangled == NULL)
|
||||
{
|
||||
if (status != NULL)
|
||||
if (status)
|
||||
{
|
||||
if (alc == 1)
|
||||
*status = -1;
|
||||
@ -6385,7 +6385,7 @@ __cxa_demangle (const char *mangled_name, char *output_buffer,
|
||||
|
||||
if (output_buffer == NULL)
|
||||
{
|
||||
if (length != NULL)
|
||||
if (length)
|
||||
*length = alc;
|
||||
}
|
||||
else
|
||||
@ -6403,7 +6403,7 @@ __cxa_demangle (const char *mangled_name, char *output_buffer,
|
||||
}
|
||||
}
|
||||
|
||||
if (status != NULL)
|
||||
if (status)
|
||||
*status = 0;
|
||||
|
||||
return demangled;
|
||||
@ -6535,7 +6535,7 @@ is_ctor_or_dtor (const char *mangled,
|
||||
to demangle the entire string. */
|
||||
|
||||
ret = 0;
|
||||
while (dc != NULL)
|
||||
while (dc)
|
||||
{
|
||||
switch (dc->type)
|
||||
{
|
||||
@ -6717,7 +6717,7 @@ main (int argc, char *argv[])
|
||||
s = cplus_demangle_v3 (dyn_string_buf (mangled), options);
|
||||
#endif
|
||||
|
||||
if (s != NULL)
|
||||
if (s)
|
||||
{
|
||||
fputs (s, stdout);
|
||||
free (s);
|
||||
@ -6759,7 +6759,7 @@ main (int argc, char *argv[])
|
||||
#endif
|
||||
|
||||
/* If it worked, print the demangled name. */
|
||||
if (s != NULL)
|
||||
if (s)
|
||||
{
|
||||
printf ("%s\n", s);
|
||||
free (s);
|
||||
|
@ -610,7 +610,7 @@ static size_t get_namespace_and_name(const char *buf, STypeCodeStr *type_code_st
|
||||
goto get_namespace_and_name_err;
|
||||
}
|
||||
|
||||
while (curr_pos != NULL) {
|
||||
while (curr_pos) {
|
||||
len = curr_pos - prev_pos;
|
||||
tmp = prev_pos;
|
||||
|
||||
|
@ -27,7 +27,7 @@ static bool r_coff_is_stripped(struct r_bin_coff_obj *obj) {
|
||||
|
||||
static bool load_buffer(RBinFile *bf, void **bin_obj, RBuffer *buf, ut64 loadaddr, Sdb *sdb) {
|
||||
*bin_obj = r_bin_coff_new_buf (buf, bf->rbin->verbose);
|
||||
return *bin_obj != NULL;
|
||||
return *bin_obj;
|
||||
}
|
||||
|
||||
static void destroy(RBinFile *bf) {
|
||||
|
@ -724,7 +724,7 @@ static Sdb *get_sdb(RBinFile *bf) {
|
||||
static bool load_buffer(RBinFile *bf, void **bin_obj, RBuffer *buf, ut64 loadaddr, Sdb *sdb) {
|
||||
RBinDexObj *o = r_bin_dex_new_buf (buf, bf->rbin->verbose);
|
||||
*bin_obj = o;
|
||||
return o != NULL;
|
||||
return o;
|
||||
}
|
||||
|
||||
static ut64 baddr(RBinFile *bf) {
|
||||
|
@ -42,7 +42,7 @@ static char *fsname(RBuffer *b) {
|
||||
static bool check_buffer(RBinFile *bf, RBuffer *b) {
|
||||
r_return_val_if_fail (b, false);
|
||||
char *p = fsname (b);
|
||||
bool hasFs = p != NULL;
|
||||
bool hasFs = p;
|
||||
free (p);
|
||||
return hasFs;
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ static bool check_buffer(RBinFile *bf, RBuffer *b) {
|
||||
static bool load_buffer(RBinFile *bf, void **bin_obj, RBuffer *b, ut64 loadaddr, Sdb *sdb) {
|
||||
r_buf_read_at (b, 0, (ut8*)&loaded_header, sizeof (loaded_header));
|
||||
*bin_obj = &loaded_header;
|
||||
return (*bin_obj != NULL);
|
||||
return (*bin_obj);
|
||||
}
|
||||
|
||||
static ut64 baddr(RBinFile *bf) {
|
||||
|
@ -44,7 +44,7 @@ static RList* entries(RBinFile *bf) {
|
||||
RList *ret = r_list_new ();
|
||||
RBinAddr *ptr = NULL;
|
||||
|
||||
if (bf && bf->buf != NULL) {
|
||||
if (bf && bf->buf) {
|
||||
if (!ret) {
|
||||
return NULL;
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ static ut64 baddr(RBinFile *bf) {
|
||||
static bool check_buffer(RBinFile *bf, RBuffer *b) {
|
||||
ut8 magic[4];
|
||||
if (r_buf_read_at (b, NRO_OFF (magic), magic, sizeof (magic)) == 4) {
|
||||
return fileType (magic) != NULL;
|
||||
return fileType (magic);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ static bool check_buffer(RBinFile *bf, RBuffer *b) {
|
||||
if (r_buf_read_at (b, 0, magic, sizeof (magic)) != 4) {
|
||||
return false;
|
||||
}
|
||||
return fileType (magic) != NULL;
|
||||
return fileType (magic);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ static bool load_buffer(RBinFile *bf, void **bin_obj, RBuffer *b, ut64 loadaddr,
|
||||
const ut8 *buf = r_buf_data (b, &size);
|
||||
r_return_val_if_fail (buf, false);
|
||||
*bin_obj = r_bin_internal_omf_load (buf, size);
|
||||
return *bin_obj != NULL;
|
||||
return *bin_obj;
|
||||
}
|
||||
|
||||
static void destroy(RBinFile *bf) {
|
||||
|
@ -44,7 +44,7 @@ static void destroy(RBin *bin) {
|
||||
}
|
||||
|
||||
static bool load(RBin *bin) {
|
||||
return ((bin->cur->xtr_obj = r_bin_fatmach0_new (bin->file)) != NULL);
|
||||
return ((bin->cur->xtr_obj = r_bin_fatmach0_new (bin->file)));
|
||||
}
|
||||
|
||||
static int size(RBin *bin) {
|
||||
|
@ -134,7 +134,7 @@ static bool check_buffer(RBinFile *bf, RBuffer *b) {
|
||||
}
|
||||
|
||||
static bool load(RBin *bin) {
|
||||
return ((bin->cur->xtr_obj = sep64_xtr_ctx_new (bin->cur->buf)) != NULL);
|
||||
return ((bin->cur->xtr_obj = sep64_xtr_ctx_new (bin->cur->buf)));
|
||||
}
|
||||
|
||||
static void destroy(RBin *bin) {
|
||||
|
@ -14,7 +14,7 @@ static Sdb *get_sdb(RBinFile *bf) {
|
||||
|
||||
static bool load_buffer(RBinFile *bf, void **bin_obj, RBuffer *b, ut64 loadaddr, Sdb *sdb){
|
||||
*bin_obj = r_bin_zimg_new_buf (b);
|
||||
return *bin_obj != NULL;
|
||||
return *bin_obj;
|
||||
}
|
||||
|
||||
static ut64 baddr(RBinFile *bf) {
|
||||
|
@ -241,7 +241,7 @@ static int init_pdb7_root_stream(RPdb *pdb, int *root_page_list, int pages_amoun
|
||||
// pdb_stream->pdb_stream = (R_PDB_STREAM *) malloc(sizeof(R_PDB_STREAM));
|
||||
// init_r_pdb_stream(pdb_stream->pdb_stream, fp, pages, pages_amount, index, size, page_size);
|
||||
// pdb_stream->load = pLoad;
|
||||
// if (pLoad != NULL) {
|
||||
// if (pLoad) {
|
||||
// pLoad(pdb_stream, &(pdb_stream->pdb_stream->stream_file));
|
||||
// }
|
||||
// }
|
||||
|
@ -2032,7 +2032,7 @@ static void get_nesttype_print_type(void *type, char **name) {
|
||||
tmp_name = base_type->type;
|
||||
} else {
|
||||
ti = &t->type_data;
|
||||
if (ti->get_print_type != NULL) {
|
||||
if (ti->get_print_type) {
|
||||
ti->get_print_type (ti, &tmp_name);
|
||||
} else {
|
||||
// TODO: need to investigate why this branch can be...
|
||||
|
@ -234,7 +234,7 @@ R_API bool r_cons_is_utf8(void) {
|
||||
#endif
|
||||
#if R_UTF8_DETECT_LOCALE
|
||||
const char *ctype = setlocale (LC_CTYPE, NULL);
|
||||
if ((ctype != NULL) && (ctype = strchr (ctype, '.')) && ctype++ &&
|
||||
if ((ctype) && (ctype = strchr (ctype, '.')) && ctype++ &&
|
||||
(!r_str_casecmp (ctype, "UTF-8") || !r_str_casecmp (ctype, "UTF8"))) {
|
||||
return true;
|
||||
}
|
||||
|
@ -525,7 +525,7 @@ R_API int r_line_hist_load(const char *file) {
|
||||
free (path);
|
||||
return false;
|
||||
}
|
||||
while (fgets (buf, sizeof (buf), fd) != NULL) {
|
||||
while (fgets (buf, sizeof (buf), fd)) {
|
||||
r_str_trim_tail (buf);
|
||||
r_line_hist_add (buf);
|
||||
}
|
||||
@ -778,7 +778,7 @@ R_API void r_line_autocomplete(void) {
|
||||
if (argc == 1) {
|
||||
const char *end_word = r_sub_str_rchr (I.buffer.data,
|
||||
I.buffer.index, strlen (I.buffer.data), ' ');
|
||||
const char *t = end_word != NULL?
|
||||
const char *t = end_word?
|
||||
end_word: I.buffer.data + I.buffer.index;
|
||||
int largv0 = strlen (r_str_get (argv[0]));
|
||||
size_t len_t = strlen (t);
|
||||
|
@ -2178,7 +2178,7 @@ static char *get_bb_body(RCore *core, RAnalBlock *b, int opts, RAnalFunction *fc
|
||||
if (b->jump > b->addr) {
|
||||
RAnalBlock *jumpbb = r_anal_get_block_at (b->anal, b->jump);
|
||||
if (jumpbb && r_list_contains (jumpbb->fcns, fcn)) {
|
||||
if (emu && core->anal->last_disasm_reg != NULL && !jumpbb->parent_reg_arena) {
|
||||
if (emu && core->anal->last_disasm_reg && !jumpbb->parent_reg_arena) {
|
||||
jumpbb->parent_reg_arena = r_reg_arena_dup (core->anal->reg, core->anal->last_disasm_reg);
|
||||
}
|
||||
if (jumpbb->parent_stackptr == INT_MAX) {
|
||||
@ -2191,7 +2191,7 @@ static char *get_bb_body(RCore *core, RAnalBlock *b, int opts, RAnalFunction *fc
|
||||
if (b->fail > b->addr) {
|
||||
RAnalBlock *failbb = r_anal_get_block_at (b->anal, b->fail);
|
||||
if (failbb && r_list_contains (failbb->fcns, fcn)) {
|
||||
if (emu && core->anal->last_disasm_reg != NULL && !failbb->parent_reg_arena) {
|
||||
if (emu && core->anal->last_disasm_reg && !failbb->parent_reg_arena) {
|
||||
failbb->parent_reg_arena = r_reg_arena_dup (core->anal->reg, core->anal->last_disasm_reg);
|
||||
}
|
||||
if (failbb->parent_stackptr == INT_MAX) {
|
||||
@ -2485,7 +2485,7 @@ static bool get_cgnodes(RAGraph *g, RCore *core, RAnalFunction *fcn) {
|
||||
refs = r_anal_function_get_refs (fcn);
|
||||
r_list_foreach (refs, iter, ref) {
|
||||
title = get_title (ref->addr);
|
||||
if (r_agraph_get_node (g, title) != NULL) {
|
||||
if (r_agraph_get_node (g, title)) {
|
||||
continue;
|
||||
}
|
||||
free (title);
|
||||
@ -4328,7 +4328,7 @@ R_API int r_core_visual_graph(RCore *core, RAGraph *g, RAnalFunction *_fcn, int
|
||||
grd->fs = is_interactive == 1;
|
||||
grd->core = core;
|
||||
grd->follow_offset = _fcn == NULL;
|
||||
grd->fcn = fcn != NULL? &fcn: NULL;
|
||||
grd->fcn = fcn? &fcn: NULL;
|
||||
ret = agraph_refresh (grd);
|
||||
if (!ret || is_interactive != 1) {
|
||||
r_cons_newline ();
|
||||
|
@ -100,7 +100,7 @@ static void __var_retype(RAnal *anal, RAnalVar *var, const char *vname, const ch
|
||||
expand = "unsigned long long";
|
||||
}
|
||||
const char *tmp = strstr (expand, "int");
|
||||
bool is_default = tmp != NULL;
|
||||
bool is_default = tmp;
|
||||
if (!is_default && strncmp (var->type, "void", 4)) {
|
||||
// return since type is already propagated
|
||||
// except for "void *", since "void *" => "char *" is possible
|
||||
@ -764,7 +764,7 @@ repeat:
|
||||
if (prev_dest && (type == R_ANAL_OP_TYPE_MOV || type == R_ANAL_OP_TYPE_STORE)) {
|
||||
char reg[REGNAME_SIZE] = {0};
|
||||
get_src_regname (core, addr, reg, sizeof (reg));
|
||||
bool match = strstr (prev_dest, reg) != NULL;
|
||||
bool match = strstr (prev_dest, reg);
|
||||
if (str_flag && match) {
|
||||
__var_retype (anal, var, NULL, "const char *", false, false);
|
||||
}
|
||||
|
@ -4254,7 +4254,7 @@ R_API int r_core_anal_all(RCore *core) {
|
||||
|
||||
r_cons_break_push (NULL, NULL);
|
||||
/* Symbols (Imports are already analyzed by rabin2 on init) */
|
||||
if ((list = r_bin_get_symbols (core->bin)) != NULL) {
|
||||
if ((list = r_bin_get_symbols (core->bin))) {
|
||||
r_list_foreach (list, iter, symbol) {
|
||||
if (r_cons_is_breaked ()) {
|
||||
break;
|
||||
|
@ -208,7 +208,7 @@ R_API RList *r_core_asm_strsearch(RCore *core, const char *input, ut64 from, ut6
|
||||
if (mode == 'a') { // check for case sensitive
|
||||
matches = !r_str_ncasecmp (opst, tokens[matchcount], strlen (tokens[matchcount]));
|
||||
} else if (!regexp) {
|
||||
matches = strstr (opst, tokens[matchcount]) != NULL;
|
||||
matches = !!strstr (opst, tokens[matchcount]);
|
||||
} else {
|
||||
rx = r_regex_new (tokens[matchcount], "es");
|
||||
matches = r_regex_exec (rx, opst, 0, 0, 0) == 0;
|
||||
|
@ -834,7 +834,7 @@ static int bin_info(RCore *r, PJ *pj, int mode, ut64 laddr) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
bool havecode = is_executable (obj) | (obj->entries != NULL);
|
||||
bool havecode = is_executable (obj) | (!!obj->entries);
|
||||
const char *compiled = get_compile_time (bf->sdb);
|
||||
|
||||
if (IS_MODE_SET (mode)) {
|
||||
@ -1736,6 +1736,13 @@ static int bin_relocs(RCore *r, PJ *pj, int mode, int va) {
|
||||
}
|
||||
relocs = r_bin_get_relocs (r->bin);
|
||||
}
|
||||
if (!relocs) {
|
||||
if (pj) {
|
||||
pj_a (pj);
|
||||
pj_end (pj);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (bin_cache) {
|
||||
if (r_pvector_len (&r->io->cache) == 0) {
|
||||
r_config_set (r->config, "io.cache", "false");
|
||||
@ -1879,10 +1886,10 @@ static int bin_relocs(RCore *r, PJ *pj, int mode, int va) {
|
||||
db = NULL;
|
||||
|
||||
R_TIME_PROFILE_END;
|
||||
if (IS_MODE_JSON (mode) && relocs == NULL) {
|
||||
if (IS_MODE_JSON (mode)) {
|
||||
return true;
|
||||
}
|
||||
return relocs != NULL;
|
||||
return true;
|
||||
}
|
||||
|
||||
#define MYDB 1
|
||||
@ -2155,7 +2162,7 @@ typedef struct {
|
||||
} SymName;
|
||||
|
||||
static void snInit(RCore *r, SymName *sn, RBinSymbol *sym, const char *lang) {
|
||||
int bin_demangle = lang != NULL;
|
||||
bool bin_demangle = !!lang;
|
||||
bool keep_lib = r_config_get_b (r->config, "bin.demangle.libs");
|
||||
if (!r || !sym || !sym->name) {
|
||||
return;
|
||||
@ -2433,14 +2440,12 @@ static int bin_symbols(RCore *r, PJ *pj, int mode, ut64 laddr, int va, ut64 at,
|
||||
pj_kb (pj, "is_imported", symbol->is_imported);
|
||||
pj_end (pj);
|
||||
} else if (IS_MODE_SIMPLE (mode)) {
|
||||
const char *name = sn.demname? sn.demname: r_symbol_name;
|
||||
r_cons_printf ("0x%08"PFMT64x" %d %s%s%s\n",
|
||||
addr, (int)symbol->size,
|
||||
r_str_get (sn.libname), sn.libname ? " " : "",
|
||||
name);
|
||||
const char *n = sn.demname? sn.demname: r_symbol_name;
|
||||
r_cons_printf ("0x%08"PFMT64x" %d %s%s%s\n", addr, (int)symbol->size,
|
||||
r_str_get (sn.libname), sn.libname ? " " : "", n);
|
||||
} else if (IS_MODE_SIMPLEST (mode)) {
|
||||
const char *name = sn.demname? sn.demname: r_symbol_name;
|
||||
r_cons_printf ("%s\n", name);
|
||||
const char *n = sn.demname? sn.demname: r_symbol_name;
|
||||
r_cons_printf ("%s\n", n);
|
||||
} else if (IS_MODE_RAD (mode)) {
|
||||
/* Skip special symbols because we do not flag them and
|
||||
* they shouldn't be printed in the rad format either */
|
||||
@ -2449,8 +2454,8 @@ static int bin_symbols(RCore *r, PJ *pj, int mode, ut64 laddr, int va, ut64 at,
|
||||
}
|
||||
RBinFile *binfile;
|
||||
RBinPlugin *plugin;
|
||||
const char *name = sn.demname? sn.demname: r_symbol_name;
|
||||
if (!name) {
|
||||
const char *n = sn.demname? sn.demname: r_symbol_name;
|
||||
if (!n) {
|
||||
goto next;
|
||||
}
|
||||
if (symbol->is_imported) {
|
||||
@ -2465,8 +2470,8 @@ static int bin_symbols(RCore *r, PJ *pj, int mode, ut64 laddr, int va, ut64 at,
|
||||
}
|
||||
lastfs = 's';
|
||||
}
|
||||
if (r->bin->prefix || *name) { // we don't want unnamed symbol flags
|
||||
char *flagname = construct_symbol_flagname ("sym", sn.libname, name, MAXFLAG_LEN_DEFAULT);
|
||||
if (r->bin->prefix || *n) { // we don't want unnamed symbol flags
|
||||
char *flagname = construct_symbol_flagname ("sym", sn.libname, n, MAXFLAG_LEN_DEFAULT);
|
||||
if (!flagname) {
|
||||
goto next;
|
||||
}
|
||||
@ -2501,7 +2506,7 @@ static int bin_symbols(RCore *r, PJ *pj, int mode, ut64 laddr, int va, ut64 at,
|
||||
} else {
|
||||
const char *bind = r_str_get_fail (symbol->bind, "NONE");
|
||||
const char *type = r_str_get_fail (symbol->type, "NONE");
|
||||
const char *name = r_str_getf (sn.demname? sn.demname: sn.name);
|
||||
const char *n = r_str_getf (sn.demname? sn.demname: sn.name);
|
||||
// const char *fwd = r_str_getf (symbol->forwarder);
|
||||
r_table_add_rowf (table, "dXXssdss",
|
||||
symbol->ordinal,
|
||||
@ -2511,7 +2516,7 @@ static int bin_symbols(RCore *r, PJ *pj, int mode, ut64 laddr, int va, ut64 at,
|
||||
type,
|
||||
symbol->size,
|
||||
r_str_get (symbol->libname),
|
||||
name);
|
||||
n);
|
||||
}
|
||||
next:
|
||||
snFini (&sn);
|
||||
@ -2559,7 +2564,7 @@ static char *build_hash_string(PJ *pj, int mode, const char *chksum, ut8 *data,
|
||||
char *chkstr = NULL, *aux = NULL, *ret = NULL;
|
||||
RList *hashlist = r_str_split_duplist (chksum, ",", true);
|
||||
RListIter *iter;
|
||||
char *hashname;
|
||||
const char *hashname;
|
||||
r_list_foreach (hashlist, iter, hashname) {
|
||||
chkstr = r_hash_to_string (NULL, hashname, data, datalen);
|
||||
if (!chkstr) {
|
||||
|
@ -1222,7 +1222,7 @@ R_API bool r_core_run_script(RCore *core, const char *file) {
|
||||
sdb_query_lines (core->anal->sdb_types, out);
|
||||
free (out);
|
||||
}
|
||||
ret = out != NULL;
|
||||
ret = out;
|
||||
} else {
|
||||
p = r_lang_get_by_extension (core->lang, file);
|
||||
if (p) {
|
||||
@ -3566,7 +3566,7 @@ static int r_core_cmd_subst_i(RCore *core, char *cmd, char *colon, bool *tmpseek
|
||||
op0 = *q;
|
||||
*q = 0;
|
||||
}
|
||||
haveQuote = q != NULL;
|
||||
haveQuote = q;
|
||||
oseek = core->offset;
|
||||
r_core_seek (core, r_num_math (core->num, p + 2), true);
|
||||
if (q) {
|
||||
@ -3998,7 +3998,7 @@ escape_backtick:
|
||||
ptr = NULL;
|
||||
}
|
||||
|
||||
cmd_tmpseek = core->tmpseek = ptr != NULL;
|
||||
cmd_tmpseek = core->tmpseek = ptr;
|
||||
int rc = 0;
|
||||
if (ptr) {
|
||||
char *f, *ptr2 = strchr (ptr + 1, '!');
|
||||
@ -5215,7 +5215,7 @@ R_API int r_core_cmd_foreach(RCore *core, const char *cmd, char *each) {
|
||||
break;
|
||||
}
|
||||
r_cons_flush ();
|
||||
} while (str != NULL);
|
||||
} while (str);
|
||||
free (out);
|
||||
}
|
||||
}
|
||||
|
@ -3566,7 +3566,7 @@ static void __core_cmd_anal_fcn_allstats(RCore *core, const char *input) {
|
||||
RList *dbs = r_list_newf ((RListFree)sdb_free);
|
||||
Sdb *d = sdb_new0 ();
|
||||
ut64 oseek = core->offset;
|
||||
bool isJson = strchr (input, 'j') != NULL;
|
||||
bool isJson = strchr (input, 'j');
|
||||
|
||||
char *inp = r_str_newf ("*%s", input);
|
||||
r_list_foreach (core->anal->fcns, iter, fcn) {
|
||||
@ -4449,14 +4449,14 @@ int cmd_anal_fcn(RCore *core, const char *input) {
|
||||
case 'C': // "afC"
|
||||
if (input[2] == 'c') {
|
||||
RAnalFunction *fcn;
|
||||
if ((fcn = r_anal_get_fcn_in (core->anal, core->offset, 0)) != NULL) {
|
||||
if ((fcn = r_anal_get_fcn_in (core->anal, core->offset, 0))) {
|
||||
r_cons_printf ("%i\n", r_anal_function_complexity (fcn));
|
||||
} else {
|
||||
eprintf ("Error: Cannot find function at 0x08%" PFMT64x "\n", core->offset);
|
||||
}
|
||||
} else if (input[2] == 'l') {
|
||||
RAnalFunction *fcn;
|
||||
if ((fcn = r_anal_get_fcn_in (core->anal, core->offset, 0)) != NULL) {
|
||||
if ((fcn = r_anal_get_fcn_in (core->anal, core->offset, 0))) {
|
||||
r_cons_printf ("%d\n", r_anal_function_loops (fcn));
|
||||
} else {
|
||||
eprintf ("Error: Cannot find function at 0x08%" PFMT64x "\n", core->offset);
|
||||
@ -10579,7 +10579,7 @@ static bool archIsThumbable(RCore *core) {
|
||||
}
|
||||
|
||||
static void _CbInRangeAav(RCore *core, ut64 from, ut64 to, int vsize, void *user) {
|
||||
bool asterisk = user != NULL;
|
||||
bool asterisk = user;
|
||||
int arch_align = r_anal_archinfo (core->anal, R_ANAL_ARCHINFO_ALIGN);
|
||||
bool vinfun = r_config_get_i (core->config, "anal.vinfun");
|
||||
int searchAlign = r_config_get_i (core->config, "search.align");
|
||||
|
@ -934,7 +934,7 @@ R_API bool r_cmd_macro_add(RCmdMacro *mac, const char *oname) {
|
||||
}
|
||||
macro->args = strdup (args);
|
||||
ptr = strchr (macro->name, ' ');
|
||||
if (ptr != NULL) {
|
||||
if (ptr) {
|
||||
*ptr = '\0';
|
||||
macro->nargs = r_str_word_set0 (ptr+1);
|
||||
}
|
||||
|
@ -976,7 +976,7 @@ static int cmd_cmp(void *data, const char *input) {
|
||||
}
|
||||
int col = core->cons->columns > 123;
|
||||
ut8 *b = malloc (core->blocksize);
|
||||
if (b != NULL) {
|
||||
if (b) {
|
||||
memset (b, 0xff, core->blocksize);
|
||||
r_io_read_at (core->io, addr, b, core->blocksize);
|
||||
r_print_hexdiff (core->print, core->offset, block,
|
||||
|
@ -1766,7 +1766,7 @@ static int cmd_debug_map(RCore *core, const char *input) {
|
||||
r_list_foreach (list, iter, map) {
|
||||
if ((!libname ||
|
||||
(addr != UT64_MAX && (addr >= map->addr && addr < map->addr_end)) ||
|
||||
(libname != NULL && (strstr (map->name, libname))))) {
|
||||
(libname && (strstr (map->name, libname))))) {
|
||||
baddr = map->addr;
|
||||
char *res;
|
||||
const char *file = map->file? map->file: map->name;
|
||||
|
@ -1620,7 +1620,7 @@ rep:
|
||||
RListIter *iter;
|
||||
r_list_sort (temp, &cmpflag);
|
||||
r_list_foreach (temp, iter, flag) {
|
||||
if (strstr (flag->name , arg) != NULL) {
|
||||
if (strstr (flag->name , arg)) {
|
||||
if (flag->offset < core->offset) {
|
||||
loff = flag->offset;
|
||||
lmatch = flag->name;
|
||||
|
@ -1121,7 +1121,7 @@ static int cmd_help(void *data, const char *input) {
|
||||
r_str_trim (msg);
|
||||
char *p = strchr (msg, '&');
|
||||
if (p) *p = 0;
|
||||
r_sys_tts (msg, p != NULL);
|
||||
r_sys_tts (msg, p);
|
||||
free (msg);
|
||||
break;
|
||||
}
|
||||
|
@ -1271,7 +1271,7 @@ static int cmd_info(void *data, const char *input) {
|
||||
break;
|
||||
}
|
||||
if (input[2] && input[2] != '*' && input[2] != 'j' && !strstr (input, "qq")) {
|
||||
bool radare2 = strstr (input, "**") != NULL;
|
||||
bool radare2 = strstr (input, "**");
|
||||
int idx = -1;
|
||||
const char * cls_name = NULL;
|
||||
if (radare2) {
|
||||
|
@ -348,7 +348,7 @@ static int cmd_seek(void *data, const char *input) {
|
||||
return 0;
|
||||
}
|
||||
char *ptr;
|
||||
if ((ptr = strstr (input, "+.")) != NULL) {
|
||||
if ((ptr = strstr (input, "+."))) {
|
||||
char *dup = strdup (input);
|
||||
dup[ptr - input] = '\x00';
|
||||
off = r_num_math (core->num, dup + 1);
|
||||
|
@ -1217,7 +1217,7 @@ static int wr_handler_old(void *data, const char *input) {
|
||||
int len = (int)off;
|
||||
if (len > 0) {
|
||||
ut8 *buf = malloc (len);
|
||||
if (buf != NULL) {
|
||||
if (buf) {
|
||||
int i;
|
||||
r_num_irand ();
|
||||
for (i = 0; i < len; i++)
|
||||
|
@ -303,7 +303,7 @@ static bool update_blobs(const RList *ignore, RList *blobs, const RList *nh) {
|
||||
continue;
|
||||
}
|
||||
blob->fhash = r_str_new (nh->tail->data);
|
||||
return blob->fhash != NULL;
|
||||
return blob->fhash;
|
||||
}
|
||||
blob = R_NEW (RvcBlob);
|
||||
if (!blob) {
|
||||
|
@ -947,7 +947,7 @@ R_API bool r_core_visual_hudclasses(RCore *core) {
|
||||
free (res);
|
||||
}
|
||||
r_list_free (list);
|
||||
return res != NULL;
|
||||
return res;
|
||||
}
|
||||
|
||||
static bool hudstuff_append(RFlagItem *fi, void *user) {
|
||||
@ -989,7 +989,7 @@ R_API bool r_core_visual_hudstuff(RCore *core) {
|
||||
free (res);
|
||||
}
|
||||
r_list_free (list);
|
||||
return res != NULL;
|
||||
return res;
|
||||
}
|
||||
|
||||
static bool r_core_visual_config_hud(RCore *core) {
|
||||
|
@ -128,7 +128,7 @@ R_API bool r_crypto_use(RCrypto *cry, const char *algo) {
|
||||
r_list_foreach (cry->plugins, iter, h) {
|
||||
if (h && h->use && h->use (algo)) {
|
||||
cry->h = h;
|
||||
return cry->h != NULL;
|
||||
return cry->h;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
@ -1157,7 +1157,7 @@ R_API int r_debug_continue_kill(RDebug *dbg, int sig) {
|
||||
if (reg->cnum <= dbg->session->cnum) {
|
||||
continue;
|
||||
}
|
||||
has_bp = r_bp_get_in (dbg->bp, reg->data, R_BP_PROT_EXEC) != NULL;
|
||||
has_bp = r_bp_get_in (dbg->bp, reg->data, R_BP_PROT_EXEC);
|
||||
if (has_bp) {
|
||||
eprintf ("hit breakpoint at: 0x%" PFMT64x " cnum: %d\n", reg->data, reg->cnum);
|
||||
r_debug_goto_cnum (dbg, reg->cnum);
|
||||
@ -1409,7 +1409,7 @@ static int r_debug_continue_until_internal(RDebug *dbg, ut64 addr, bool block) {
|
||||
return false;
|
||||
}
|
||||
// Check if there was another breakpoint set at addr
|
||||
bool has_bp = r_bp_get_in (dbg->bp, addr, R_BP_PROT_EXEC) != NULL;
|
||||
bool has_bp = r_bp_get_in (dbg->bp, addr, R_BP_PROT_EXEC);
|
||||
if (!has_bp) {
|
||||
r_bp_add_sw (dbg->bp, addr, dbg->bpsize, R_BP_PROT_EXEC);
|
||||
}
|
||||
@ -1459,7 +1459,7 @@ R_API bool r_debug_continue_back(RDebug *dbg) {
|
||||
if (reg->cnum >= dbg->session->cnum) {
|
||||
continue;
|
||||
}
|
||||
has_bp = r_bp_get_in (dbg->bp, reg->data, R_BP_PROT_EXEC) != NULL;
|
||||
has_bp = r_bp_get_in (dbg->bp, reg->data, R_BP_PROT_EXEC);
|
||||
if (has_bp) {
|
||||
cnum = reg->cnum;
|
||||
eprintf ("hit breakpoint at: 0x%" PFMT64x " cnum: %d\n", reg->data, reg->cnum);
|
||||
|
@ -313,7 +313,7 @@ R_API bool r_debug_reg_set(RDebug *dbg, const char *name, ut64 num) {
|
||||
r_reg_set_value (dbg->reg, ri, num);
|
||||
r_debug_reg_sync (dbg, R_REG_TYPE_ALL, true);
|
||||
}
|
||||
return (ri != NULL);
|
||||
return (ri);
|
||||
}
|
||||
|
||||
R_API ut64 r_debug_reg_get(RDebug *dbg, const char *name) {
|
||||
|
@ -103,14 +103,14 @@ R_API ut8 bfvm_get(BfvmCPU *c) {
|
||||
|
||||
R_API void bfvm_inc(BfvmCPU *c) {
|
||||
ut8 *mem = bfvm_get_ptr (c);
|
||||
if (mem != NULL) {
|
||||
if (mem) {
|
||||
mem[0]++;
|
||||
}
|
||||
}
|
||||
|
||||
R_API void bfvm_dec(BfvmCPU *c) {
|
||||
ut8 *mem = bfvm_get_ptr (c);
|
||||
if (mem != NULL) {
|
||||
if (mem) {
|
||||
mem[0]--;
|
||||
}
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ static void addr_to_string(struct sockaddr_storage *ss, char *buffer, int buflen
|
||||
case AF_INET6:
|
||||
sin6 = (struct sockaddr_in6 *)ss;
|
||||
if (inet_ntop (AF_INET6, &sin6->sin6_addr, buffer2,
|
||||
sizeof (buffer2)) != NULL) {
|
||||
sizeof (buffer2))) {
|
||||
snprintf (buffer, buflen, "%s.%d", buffer2,
|
||||
ntohs (sin6->sin6_port));
|
||||
} else {
|
||||
|
@ -60,7 +60,7 @@ static RList *backtrace_x86_32_anal(RDebug *dbg, ut64 at) {
|
||||
|
||||
eip = r_reg_get_value (reg, r_reg_get (reg, "eip", R_REG_TYPE_GPR));
|
||||
fcn = r_anal_get_fcn_in (dbg->anal, eip, R_ANAL_FCN_TYPE_NULL);
|
||||
if (fcn != NULL) {
|
||||
if (fcn) {
|
||||
frame = R_NEW0 (RDebugFrame);
|
||||
frame->addr = eip;
|
||||
frame->size = 0;
|
||||
|
@ -25,9 +25,9 @@ static HANDLE w32_t2h(pid_t tid) {
|
||||
#endif
|
||||
|
||||
inline static int w32_h2t(HANDLE h) {
|
||||
if (w32_GetThreadId != NULL) // >= Windows Vista
|
||||
if (w32_GetThreadId) // >= Windows Vista
|
||||
return w32_GetThreadId (h);
|
||||
if (w32_GetProcessId != NULL) // >= Windows XP1
|
||||
if (w32_GetProcessId) // >= Windows XP1
|
||||
return w32_GetProcessId (h);
|
||||
return (int)(size_t)h; // XXX broken
|
||||
}
|
||||
@ -362,7 +362,7 @@ int w32_dbg_wait(RDebug *dbg, int pid) {
|
||||
case UNLOAD_DLL_DEBUG_EVENT:
|
||||
//eprintf ("(%d) Unloading library at %p\n", pid, de.u.UnloadDll.lpBaseOfDll);
|
||||
lstLibPtr = (PLIB_ITEM)r_debug_findlib (de.u.UnloadDll.lpBaseOfDll);
|
||||
if (lstLibPtr != NULL) {
|
||||
if (lstLibPtr) {
|
||||
lstLibPtr->hFile = (HANDLE)-1;
|
||||
} else {
|
||||
r_debug_lstLibAdd (pid, de.u.UnloadDll.lpBaseOfDll, (HANDLE)-1, "not cached");
|
||||
|
@ -188,7 +188,7 @@ static int __get_avx(HANDLE th, ut128 xmm[16], ut128 ymm[16]) {
|
||||
ymm[index].Low = 0;
|
||||
xmm[index].Low = 0;
|
||||
}
|
||||
if (newxmm != NULL) {
|
||||
if (newxmm) {
|
||||
for (index = 0; index < nregs; index++) {
|
||||
xmm[index].High = newxmm[index].High;
|
||||
xmm[index].Low = newxmm[index].Low;
|
||||
|
@ -359,7 +359,7 @@ static RList *__get_windows(RDebug *dbg) {
|
||||
}
|
||||
r_list_push (windows, win);
|
||||
}
|
||||
} while (hCurWnd != NULL);
|
||||
} while (hCurWnd);
|
||||
return windows;
|
||||
}
|
||||
|
||||
|
@ -345,7 +345,7 @@ R_API bool r_egg_assemble_asm(REgg *egg, char **asm_list) {
|
||||
}
|
||||
}
|
||||
free (code);
|
||||
bool ret = (asmcode != NULL);
|
||||
bool ret = (asmcode);
|
||||
r_asm_code_free (asmcode);
|
||||
return ret;
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ int main(int argc, char **argv) {
|
||||
Vartype, Typeident, Decls, Args, Body, Comment, Linecomment, Asm, Procedure, CProcedure,
|
||||
Sigdef, Sigbody, Includes, Smallc, NULL);
|
||||
|
||||
if (err != NULL) {
|
||||
if (err) {
|
||||
mpc_err_print (err);
|
||||
mpc_err_delete (err);
|
||||
return 1;
|
||||
|
@ -110,7 +110,7 @@ R_API bool r_io_use_fd(RIO* io, int fd) {
|
||||
r_return_val_if_fail (io, false);
|
||||
if (!io->desc) {
|
||||
io->desc = r_io_desc_get (io, fd);
|
||||
return io->desc != NULL;
|
||||
return io->desc;
|
||||
}
|
||||
if (io->desc->fd != fd) {
|
||||
RIODesc* desc;
|
||||
|
@ -114,7 +114,7 @@ R_API bool r_io_map_exists(RIO *io, RIOMap *map) {
|
||||
// check if a map with specified id exists
|
||||
R_API bool r_io_map_exists_for_id(RIO *io, ut32 id) {
|
||||
r_return_val_if_fail (io && io->maps, false);
|
||||
return r_io_map_get (io, id) != NULL;
|
||||
return r_io_map_get (io, id);
|
||||
}
|
||||
|
||||
R_API RIOMap* r_io_map_get(RIO *io, ut32 id) {
|
||||
|
@ -20,7 +20,7 @@ static const char *r_io_get_individual_schema(const char *file) {
|
||||
static bool r_io_ar_plugin_open(RIO *io, const char *file, bool many) {
|
||||
r_return_val_if_fail (io && file, false);
|
||||
if (many) {
|
||||
return (r_io_get_individual_schema (file) != NULL);
|
||||
return (r_io_get_individual_schema (file));
|
||||
}
|
||||
return !strncmp ("ar://", file, 5) || !strncmp ("lib://", file, 6);
|
||||
}
|
||||
|
@ -178,7 +178,7 @@ static RIODesc *__open(RIO *io, const char *pathname, int rw, int mode) {
|
||||
}
|
||||
mal->size = (ut32)rlen;
|
||||
mal->buf = malloc (mal->size+1);
|
||||
if (mal->buf != NULL) {
|
||||
if (mal->buf) {
|
||||
memcpy (mal->buf, out, rlen);
|
||||
free (out);
|
||||
return r_io_desc_new (io, &r_io_plugin_bfdbg,
|
||||
|
@ -45,7 +45,7 @@ static bool r_io_mmap_refresh_buf(RIOMMapFileObj *mmo) {
|
||||
if (mmo->buf) {
|
||||
r_io_mmap_seek (io, mmo, cur, SEEK_SET);
|
||||
}
|
||||
return mmo->buf != NULL;
|
||||
return mmo->buf;
|
||||
}
|
||||
|
||||
static void r_io_mmap_free(RIOMMapFileObj *mmo) {
|
||||
|
@ -32,7 +32,7 @@ static int __rap_read(RIO *io, RIODesc *fd, ut8 *buf, int count) {
|
||||
static bool __rap_close(RIODesc *fd) {
|
||||
int ret = false;
|
||||
if (RIORAP_IS_VALID (fd)) {
|
||||
if (RIORAP_FD (fd) != NULL) {
|
||||
if (RIORAP_FD (fd)) {
|
||||
RIORap *r = fd->data;
|
||||
if (r && fd->fd != -1) {
|
||||
if (r->fd) {
|
||||
|
@ -262,7 +262,7 @@ RIOZipFileObj* r_io_zip_alloc_zipfileobj(const char *archivename, const char *fi
|
||||
for (i = 0; i < num_entries; i++) {
|
||||
zip_stat_init (&sb);
|
||||
zip_stat_index (zipArch, i, 0, &sb);
|
||||
if (sb.name != NULL) {
|
||||
if (sb.name) {
|
||||
if (strcmp (sb.name, filename) == 0) {
|
||||
zfo = r_io_zip_create_new_file (
|
||||
archivename, filename, &sb,
|
||||
|
@ -289,7 +289,7 @@ beach:
|
||||
free (r2pipe_var);
|
||||
free (r2pipe_paz);
|
||||
free (r2pipe_paz_);
|
||||
return hproc != NULL;
|
||||
return hproc;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
@ -505,7 +505,7 @@ static void load_b(RMagic *ms, int action, const char *data, int *errs, struct r
|
||||
char line[BUFSIZ];
|
||||
size_t lineno = 0;
|
||||
/* read and parse this file */
|
||||
for (ms->line = 1; (data = bgets (line, sizeof (line), data)) != NULL; ms->line++) {
|
||||
for (ms->line = 1; (data = bgets (line, sizeof (line), data)); ms->line++) {
|
||||
size_t len = strlen (line);
|
||||
if (len == 0) { /* null line, garbage, etc */
|
||||
continue;
|
||||
@ -553,7 +553,7 @@ static void load_1(RMagic *ms, int action, const char *file, int *errs, struct r
|
||||
return;
|
||||
}
|
||||
/* read and parse this file */
|
||||
for (ms->line = 1; fgets (line, sizeof (line), f) != NULL; ms->line++) {
|
||||
for (ms->line = 1; fgets (line, sizeof (line), f); ms->line++) {
|
||||
size_t len = strlen (line);
|
||||
if (len == 0) { /* null line, garbage, etc */
|
||||
continue;
|
||||
@ -1983,7 +1983,7 @@ static char *mkdbname(const char *fn, int strip) {
|
||||
int fnlen, extlen;
|
||||
if (strip) {
|
||||
const char *p;
|
||||
if ((p = strrchr (fn, '/')) != NULL) {
|
||||
if ((p = strrchr (fn, '/'))) {
|
||||
fn = ++p;
|
||||
}
|
||||
}
|
||||
|
@ -256,7 +256,7 @@ int file_fsmagic(struct r_magic_set *ms, const char *fn, struct stat *sb) {
|
||||
ms->flags &= R_MAGIC_SYMLINK;
|
||||
p = r_magic_file(ms, buf);
|
||||
ms->flags |= R_MAGIC_SYMLINK;
|
||||
return p != NULL ? 1 : -1;
|
||||
return p ? 1 : -1;
|
||||
} else { /* just print what it points to */
|
||||
if (file_printf (ms, "symbolic link to `%s'", buf) == -1)
|
||||
return -1;
|
||||
|
@ -255,13 +255,13 @@ R_API bool r_magic_load(RMagic* ms, const char *magicfile) {
|
||||
R_API bool r_magic_compile(RMagic *ms, const char *magicfile) {
|
||||
struct mlist *ml = file_apprentice (ms, magicfile, strlen (magicfile), FILE_COMPILE);
|
||||
free_mlist (ml);
|
||||
return ml != NULL;
|
||||
return ml;
|
||||
}
|
||||
|
||||
R_API bool r_magic_check(RMagic *ms, const char *magicfile) {
|
||||
struct mlist *ml = file_apprentice (ms, magicfile, strlen (magicfile), FILE_CHECK);
|
||||
free_mlist (ml);
|
||||
return ml != NULL;
|
||||
return ml;
|
||||
}
|
||||
|
||||
R_API const char* r_magic_descriptor(RMagic *ms, int fd) {
|
||||
|
@ -722,7 +722,7 @@ add_tstr:
|
||||
type_to_str (s1, buf, buf_size, &s->type, varstr);
|
||||
pstrcat (buf, buf_size, "(");
|
||||
sa = s->next;
|
||||
while (sa != NULL) {
|
||||
while (sa) {
|
||||
type_to_str (s1, buf1, sizeof (buf1), &sa->type, NULL);
|
||||
pstrcat (buf, buf_size, buf1);
|
||||
sa = sa->next;
|
||||
@ -1168,7 +1168,7 @@ do_decl:
|
||||
}
|
||||
if (v == 0 && is_structured (&type1)) {
|
||||
ass = type1.ref;
|
||||
while ((ass = ass->next) != NULL) {
|
||||
while ((ass = ass->next)) {
|
||||
ss = sym_push (s1, ass->v, &ass->type, 0, offset + ass->c);
|
||||
if (!ss) {
|
||||
return;
|
||||
@ -2092,7 +2092,7 @@ tok_identifier:
|
||||
s = s1->vtop->type.ref;
|
||||
/* find field */
|
||||
s1->tok |= SYM_FIELD;
|
||||
while ((s = s->next) != NULL) {
|
||||
while ((s = s->next)) {
|
||||
if (s->v == s1->tok) {
|
||||
break;
|
||||
}
|
||||
@ -2923,7 +2923,7 @@ static void func_decl_list(TCCState *s1, Sym *func_sym) {
|
||||
/* find parameter in function parameter list */
|
||||
s = func_sym;
|
||||
found = 0;
|
||||
while ((s = s->next) != NULL) {
|
||||
while ((s = s->next)) {
|
||||
if ((s->v & ~SYM_FIELD) == v) {
|
||||
found = 1;
|
||||
break;
|
||||
@ -3043,7 +3043,7 @@ static int decl0(TCCState *s1, int l, int is_for_loop_init) {
|
||||
/* reject abstract declarators in function definition */
|
||||
sym = type.ref;
|
||||
if (sym) {
|
||||
while ((sym = sym->next) != NULL)
|
||||
while ((sym = sym->next))
|
||||
if (!(sym->v & ~SYM_FIELD)) {
|
||||
expect (s1, "identifier6");
|
||||
}
|
||||
|
@ -2995,7 +2995,7 @@ static void macro_subst(TCCState *s1, TokenString *tok_str, Sym **nested_list,
|
||||
goto no_subst;
|
||||
}
|
||||
s = define_find (s1, t);
|
||||
if (s != NULL) {
|
||||
if (s) {
|
||||
/* if nested substitution, do nothing */
|
||||
if (sym_find2 (*nested_list, t)) {
|
||||
/* and mark it as TOK_NOSUBST, so it doesn't get subst'd again */
|
||||
|
@ -74,7 +74,7 @@ static int replace(int argc, const char *argv[], char *newstr, ADDR_TYPE type) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (i = 0; ops[i].op != NULL; i++) {
|
||||
for (i = 0; ops[i].op; i++) {
|
||||
if (ops[i].narg) {
|
||||
if (argc - 1 != ops[i].narg) {
|
||||
continue;
|
||||
@ -84,7 +84,7 @@ static int replace(int argc, const char *argv[], char *newstr, ADDR_TYPE type) {
|
||||
for (j = k = 0; ops[i].str[j] != '\0'; j++, k++) {
|
||||
if (IS_DIGIT(ops[i].str[j])) {
|
||||
const char *w = argv[ops[i].str[j] - '0'];
|
||||
if (w != NULL) {
|
||||
if (w) {
|
||||
strcpy(newstr + k, w);
|
||||
k += strlen(w) - 1;
|
||||
}
|
||||
|
@ -35,13 +35,13 @@ static int replace(int argc, const char *argv[], char *newstr) {
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
for (i = 0; ops[i].op != NULL; i++) {
|
||||
for (i = 0; ops[i].op; i++) {
|
||||
if (!strcmp (ops[i].op, argv[0])) {
|
||||
if (newstr != NULL) {
|
||||
if (newstr) {
|
||||
for (j = k = 0; ops[i].str[j] != '\0'; j++, k++) {
|
||||
if (ops[i].str[j] >= '0' && ops[i].str[j] <= '9') {
|
||||
const char *w = argv[ops[i].str[j] - '0'];
|
||||
if (w != NULL) {
|
||||
if (w) {
|
||||
strcpy (newstr + k, w);
|
||||
k += strlen (w) - 1;
|
||||
}
|
||||
@ -56,7 +56,7 @@ static int replace(int argc, const char *argv[], char *newstr) {
|
||||
}
|
||||
|
||||
/* TODO: this is slow */
|
||||
if (newstr != NULL) {
|
||||
if (newstr) {
|
||||
newstr[0] = '\0';
|
||||
for (i=0; i<argc; i++) {
|
||||
strcat (newstr, argv[i]);
|
||||
|
@ -100,13 +100,13 @@ static bool replace(int argc, const char *argv[], char *newstr) {
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
for (i = 0; ops[i].op != NULL; i++) {
|
||||
for (i = 0; ops[i].op; i++) {
|
||||
if (!strcmp (ops[i].op, argv[0])) {
|
||||
if (newstr != NULL) {
|
||||
if (newstr) {
|
||||
for (j = k = 0; ops[i].str[j] != '\0'; j++, k++) {
|
||||
if (ops[i].str[j] >= 'A' && ops[i].str[j] <= 'J') {
|
||||
const char *w = argv[ops[i].str[j] - '@'];
|
||||
if (w != NULL) {
|
||||
if (w) {
|
||||
strcpy (newstr + k, w);
|
||||
k += strlen(w) - 1;
|
||||
}
|
||||
@ -121,7 +121,7 @@ static bool replace(int argc, const char *argv[], char *newstr) {
|
||||
}
|
||||
|
||||
/* TODO: this is slow */
|
||||
if (newstr != NULL) {
|
||||
if (newstr) {
|
||||
newstr[0] = '\0';
|
||||
for (i = 0; i < argc; i++) {
|
||||
strcat (newstr, argv[i]);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user