Remove assert() calls (#4230)
This commit is contained in:
parent
39e4e74c4e
commit
0867fd9d3d
9 changed files with 13 additions and 14 deletions
|
|
@ -112,7 +112,7 @@ static const char **SR = registers + 32;
|
|||
|
||||
RzAnalysisILConfig *v810_il_config(RzAnalysis *a) {
|
||||
rz_return_val_if_fail(a, NULL);
|
||||
assert(RZ_STR_EQ(SR[0], "EIPC"));
|
||||
rz_return_val_if_fail(RZ_STR_EQ(SR[0], "EIPC"), NULL);
|
||||
|
||||
RzAnalysisILConfig *cfg = rz_analysis_il_config_new(32, false, 32);
|
||||
cfg->reg_bindings = registers;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
#include <rz_analysis.h>
|
||||
#include <rz_hash.h>
|
||||
#include <rz_util/ht_uu.h>
|
||||
#include <assert.h>
|
||||
|
||||
#define unwrap(rbnode) ((rbnode) ? container_of(rbnode, RzAnalysisBlock, _rb) : NULL)
|
||||
|
||||
|
|
@ -38,7 +37,7 @@ static int __bb_addr_cmp(const void *incoming, const RBNode *in_tree, void *user
|
|||
#define D if (analysis && analysis->verbose)
|
||||
|
||||
RZ_API void rz_analysis_block_ref(RzAnalysisBlock *bb) {
|
||||
assert(bb->ref > 0); // 0-refd must already be freed.
|
||||
rz_return_if_fail(bb->ref > 0); // 0-refd must already be freed.
|
||||
bb->ref++;
|
||||
}
|
||||
|
||||
|
|
@ -376,12 +375,12 @@ RZ_API void rz_analysis_block_unref(RzAnalysisBlock *bb) {
|
|||
if (!bb) {
|
||||
return;
|
||||
}
|
||||
assert(bb->ref > 0);
|
||||
rz_return_if_fail(bb->ref > 0);
|
||||
bb->ref--;
|
||||
assert(bb->ref >= rz_list_length(bb->fcns)); // all of the block's functions must hold a reference to it
|
||||
rz_return_if_fail(bb->ref >= rz_list_length(bb->fcns)); // all of the block's functions must hold a reference to it
|
||||
if (bb->ref < 1) {
|
||||
RzAnalysis *analysis = bb->analysis;
|
||||
assert(!bb->fcns || rz_list_empty(bb->fcns));
|
||||
rz_return_if_fail(!bb->fcns || rz_list_empty(bb->fcns));
|
||||
rz_rbtree_aug_delete(&analysis->bb_tree, &bb->addr, __bb_addr_cmp, NULL, __block_free_rb, NULL, __max_end);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
inline static const char *ARMCondCodeToString(arm_cc cc) {
|
||||
switch (cc) {
|
||||
default:
|
||||
assert(0 && "Unknown condition code");
|
||||
rz_warn_if_reached();
|
||||
return "";
|
||||
case ARM_CC_EQ:
|
||||
return "eq";
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ inline static arm_cc ARMCC_getOppositeCondition(arm_cc cc) {
|
|||
switch (cc) {
|
||||
default:
|
||||
// llvm_unreachable("Unknown condition code");
|
||||
assert(0);
|
||||
rz_warn_if_reached();
|
||||
return ARM_CC_INVALID;
|
||||
case ARM_CC_EQ:
|
||||
return ARM_CC_NE;
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ static LuaInstruction encode_instruction(ut8 opcode, const char *arg_start, ut16
|
|||
if (has_param_flag(flag, PARAM_Bx)) {
|
||||
SETARG_Bx(instruction, args[cur_cnt++]);
|
||||
}
|
||||
assert(cur_cnt == arg_num);
|
||||
rz_return_val_if_fail(cur_cnt == arg_num, -1);
|
||||
|
||||
return instruction;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ static LuaInstruction encode_instruction(ut8 opcode, const char *arg_start, ut16
|
|||
return instruction;
|
||||
}
|
||||
}
|
||||
assert(cur_cnt == arg_num);
|
||||
rz_return_val_if_fail(cur_cnt == arg_num, -1);
|
||||
|
||||
return instruction;
|
||||
}
|
||||
|
|
@ -281,4 +281,4 @@ bool lua54_assembly(const char *input, st32 input_size, LuaInstruction *instruct
|
|||
|
||||
*instruction_p = instruction;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ typedef struct arm_cs_context_t {
|
|||
inline static const char *ARMCondCodeToString(arm_cc cc) {
|
||||
switch (cc) {
|
||||
default:
|
||||
assert(0 && "Unknown condition code");
|
||||
rz_warn_if_reached();
|
||||
return "";
|
||||
case ARM_CC_EQ:
|
||||
return "eq";
|
||||
|
|
|
|||
|
|
@ -542,7 +542,7 @@ bool v13_v14_foreach_cb(void *user, const char *k, const char *v) {
|
|||
Sdb *fn_db = user;
|
||||
if (rz_str_startswith(k, "0x")) {
|
||||
RzJson *fn_j = rz_json_parse((char *)v);
|
||||
assert(fn_j->type == RZ_JSON_OBJECT);
|
||||
rz_return_val_if_fail(fn_j->type == RZ_JSON_OBJECT, false);
|
||||
|
||||
PJ *j = pj_new();
|
||||
pj_o(j);
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ static st64 score(RzRune *buff, const int len) {
|
|||
}
|
||||
|
||||
ut8 i = compute_index(c1, c2);
|
||||
assert(i < 49);
|
||||
rz_return_val_if_fail(i < 49, ST64_MIN);
|
||||
ut8 y = LATIN1[i];
|
||||
if (y == 0) {
|
||||
score += -100;
|
||||
|
|
|
|||
Loading…
Reference in a new issue