Replace other r_return_* uses and update DEVELOPERS.md ##refactor

This commit is contained in:
satk0 2024-08-05 11:31:58 +00:00 committed by GitHub
parent 361b8b0c15
commit 060d976412
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
122 changed files with 403 additions and 403 deletions

View File

@ -55,7 +55,7 @@ with features.
* `sys/sanitize.sh`: Compile with ASan, the address sanitizer. Provides
detailed backtraces for memory errors.
* `R2_DEBUG_ASSERT=1`: Provides a backtrace when a debug assert (typically a
`r_return_` macro) fails.
`R_RETURN_` macro) fails.
* `R2_DEBUG=1`: Show error messages and crash signal. Used for debugging plugin
loading issues.
@ -195,7 +195,7 @@ if (a == b) {
example of a good name could be `out_buffer:` if the `goto` frees `buffer`.
Avoid using GW-BASIC names like `err1:` and `err2:`.
* Use `r_return_*` macros to check for conditions that are caused by
* Use `R_RETURN_*` macros to check for conditions that are caused by
programming errors or bugs; i.e.: conditions that should **never** happen. Do
not use them when checking for runtime error conditions, such as a `NULL`
value being returned from `malloc()`. Use a standard if statement for these
@ -204,8 +204,8 @@ if (a == b) {
```c
int check(RCore *c, int a, int b) {
/* check for programming errors */
r_return_val_if_fail (c, false);
r_return_val_if_fail (a >= 0, b >= 1, false);
R_RETURN_VAL_IF_FAIL (c, false);
R_RETURN_VAL_IF_FAIL (a >= 0, b >= 1, false);
/* check for runtime errors */
ut8 *buf = calloc (b, sizeof (a));

View File

@ -711,7 +711,7 @@ beach:
}
static void test_result_to_json(PJ *pj, R2RTestResultInfo *result) {
r_return_if_fail (pj && result);
R_RETURN_IF_FAIL (pj && result);
pj_o (pj);
pj_k (pj, "type");
R2RTest *test = result->test;
@ -1269,7 +1269,7 @@ static void replace_cmd_kv_file(const char *path, ut64 line_begin, ut64 line_end
}
static void interact_fix(R2RTestResultInfo *result, RPVector *fixup_results) {
r_return_if_fail (result->test->type == R2R_TEST_TYPE_CMD);
R_RETURN_IF_FAIL (result->test->type == R2R_TEST_TYPE_CMD);
R2RCmdTest *test = result->test->cmd_test;
R2RProcessOutput *out = result->proc_out;
if (test->expect.value && out->out) {
@ -1285,7 +1285,7 @@ static void interact_fix(R2RTestResultInfo *result, RPVector *fixup_results) {
}
static void interact_break(R2RTestResultInfo *result, RPVector *fixup_results) {
r_return_if_fail (result->test->type == R2R_TEST_TYPE_CMD);
R_RETURN_IF_FAIL (result->test->type == R2R_TEST_TYPE_CMD);
R2RCmdTest *test = result->test->cmd_test;
ut64 line_begin, line_end;
if (test->broken.set) {
@ -1298,7 +1298,7 @@ static void interact_break(R2RTestResultInfo *result, RPVector *fixup_results) {
}
static void interact_commands(R2RTestResultInfo *result, RPVector *fixup_results) {
r_return_if_fail (result->test->type == R2R_TEST_TYPE_CMD);
R_RETURN_IF_FAIL (result->test->type == R2R_TEST_TYPE_CMD);
R2RCmdTest *test = result->test->cmd_test;
if (!test->cmds.value) {
return;

View File

@ -20,7 +20,7 @@ R_API void r_anal_set_limits(RAnal *anal, ut64 from, ut64 to) {
}
R_API void r_anal_unset_limits(RAnal *anal) {
r_return_if_fail (anal);
R_RETURN_IF_FAIL (anal);
R_FREE (anal->limit);
}
@ -273,7 +273,7 @@ R_API bool r_anal_set_triplet(RAnal *anal, R_NULLABLE const char *os, R_NULLABLE
// copypasta from core/cbin.c
static void sdb_concat_by_path(Sdb *s, const char *path) {
r_return_if_fail (s && path);
R_RETURN_IF_FAIL (s && path);
Sdb *db = sdb_new (0, path, 0);
if (db) {
sdb_merge (s, db);
@ -349,7 +349,7 @@ R_API ut8 *r_anal_mask(RAnal *anal, int size, const ut8 *data, ut64 at) {
}
R_API void r_anal_trace_bb(RAnal *anal, ut64 addr) {
r_return_if_fail (anal);
R_RETURN_IF_FAIL (anal);
RAnalBlock *bb = r_anal_get_block_at (anal, addr);
if (bb && !bb->traced) {
bb->traced = true;
@ -384,7 +384,7 @@ R_API bool r_anal_op_is_eob(RAnalOp *op) {
}
R_API void r_anal_purge(RAnal *anal) {
r_return_if_fail (anal);
R_RETURN_IF_FAIL (anal);
r_anal_hint_clear (anal);
r_interval_tree_fini (&anal->meta);
r_interval_tree_init (&anal->meta, r_meta_item_free);
@ -764,7 +764,7 @@ R_API void r_anal_remove_import(RAnal *anal, const char *imp) {
}
R_API void r_anal_purge_imports(RAnal *anal) {
r_return_if_fail (anal);
R_RETURN_IF_FAIL (anal);
r_list_purge (anal->imports);
R_DIRTY (anal);
}

View File

@ -53,7 +53,7 @@ R_API void r_anal_block_ref(RAnalBlock *bb) {
// XXX we have R_REF for this
if (bb) {
// 0-refd must already be freed.
r_return_if_fail (bb->ref > 0);
R_RETURN_IF_FAIL (bb->ref > 0);
bb->ref++;
}
}
@ -426,14 +426,14 @@ R_API void r_anal_block_unref(RAnalBlock *bb) {
if (bb->ref < 1) {
return;
}
r_return_if_fail (bb->ref > 0);
R_RETURN_IF_FAIL (bb->ref > 0);
bb->ref--;
// r_return_if_fail (bb->ref >= r_list_length (bb->fcns)); // all of the block's functions must hold a reference to it
// R_RETURN_IF_FAIL (bb->ref >= r_list_length (bb->fcns)); // all of the block's functions must hold a reference to it
if (bb->ref < 1) {
RAnal *anal = bb->anal;
r_rbtree_aug_delete (&anal->bb_tree, &bb->addr, __bb_addr_cmp, NULL, __block_free_rb, NULL, __max_end);
block_free (bb);
// r_return_if_fail (r_list_empty (bb->fcns));
// R_RETURN_IF_FAIL (r_list_empty (bb->fcns));
}
}
@ -775,7 +775,7 @@ R_API bool r_anal_block_was_modified(RAnalBlock *block) {
}
R_API void r_anal_block_update_hash(RAnalBlock *block) {
r_return_if_fail (block);
R_RETURN_IF_FAIL (block);
if (!block->anal->iob.read_at) {
return;
}
@ -983,7 +983,7 @@ static bool automerge_get_predecessors_cb(void *user, ut64 k) {
// Try to find the contiguous predecessors of all given blocks and merge them if possible,
// i.e. if there are no other blocks that have this block as one of their successors
R_API void r_anal_block_automerge(RList *blocks) {
r_return_if_fail (blocks);
R_RETURN_IF_FAIL (blocks);
AutomergeCtx ctx = {
.predecessors = ht_up_new0 (),
.visited_blocks = ht_up_new0 (),

View File

@ -6,7 +6,7 @@
#define DB anal->sdb_cc
R_API void r_anal_cc_del(RAnal *anal, const char *name) {
r_return_if_fail (anal && name);
R_RETURN_IF_FAIL (anal && name);
size_t i;
RStrBuf sb;
sdb_unset (DB, r_strbuf_initf (&sb, "%s", name), 0);
@ -85,7 +85,7 @@ R_API void r_anal_cc_reset(RAnal *anal) {
}
R_API void r_anal_cc_get_json(RAnal *anal, PJ *pj, const char *name) {
r_return_if_fail (anal && pj && name);
R_RETURN_IF_FAIL (anal && pj && name);
r_strf_buffer (64);
int i;
// get cc by name and print the expr
@ -222,7 +222,7 @@ R_API const char *r_anal_cc_self(RAnal *anal, const char *convention) {
}
R_API void r_anal_cc_set_self(RAnal *anal, const char *convention, const char *self) {
r_return_if_fail (anal && convention && self);
R_RETURN_IF_FAIL (anal && convention && self);
if (!r_anal_cc_exist (anal, convention)) {
return;
}
@ -242,7 +242,7 @@ R_API const char *r_anal_cc_error(RAnal *anal, const char *convention) {
}
R_API void r_anal_cc_set_error(RAnal *anal, const char *convention, const char *error) {
r_return_if_fail (anal && convention && error);
R_RETURN_IF_FAIL (anal && convention && error);
if (!r_anal_cc_exist (anal, convention)) {
return;
}
@ -285,7 +285,7 @@ R_API const char *r_anal_cc_default(RAnal *anal) {
}
R_API void r_anal_set_cc_default(RAnal *anal, const char *cc) {
r_return_if_fail (anal && cc);
R_RETURN_IF_FAIL (anal && cc);
sdb_set (DB, "default.cc", cc, 0);
}
@ -295,7 +295,7 @@ R_API const char *r_anal_syscc_default(RAnal *anal) {
}
R_API void r_anal_set_syscc_default(RAnal *anal, const char *cc) {
r_return_if_fail (anal && cc);
R_RETURN_IF_FAIL (anal && cc);
sdb_set (DB, "default.syscc", cc, 0);
}

View File

@ -63,7 +63,7 @@ R_API void r_codemeta_item_free(RCodeMetaItem *mi) {
}
R_API void r_codemeta_item_fini(RCodeMetaItem *mi) {
r_return_if_fail (mi);
R_RETURN_IF_FAIL (mi);
switch (mi->type) {
case R_CODEMETA_TYPE_FUNCTION_NAME:
free (mi->reference.name);
@ -156,7 +156,7 @@ static int cmp_find_min_mid(void *incoming, void *in, void *user) {
#endif
R_API void r_codemeta_add_item(RCodeMeta *code, RCodeMetaItem *mi) {
r_return_if_fail (code && mi);
R_RETURN_IF_FAIL (code && mi);
r_vector_push (&code->annotations, mi);
r_crbtree_insert (code->tree, mi, cmp_ins, NULL);
}

View File

@ -1692,7 +1692,7 @@ R_API bool r_anal_check_fcn(RAnal *anal, ut8 *buf, ut16 bufsz, ut64 addr, ut64 l
}
R_API void r_anal_trim_jmprefs(RAnal *anal, RAnalFunction *fcn) {
r_return_if_fail (anal && fcn);
R_RETURN_IF_FAIL (anal && fcn);
const char *arch = R_UNWRAP4 (anal, arch, session, name);
const bool is_x86 = arch && !strcmp (arch, "x86"); // HACK
@ -1716,7 +1716,7 @@ R_API void r_anal_trim_jmprefs(RAnal *anal, RAnalFunction *fcn) {
}
R_API void r_anal_del_jmprefs(RAnal *anal, RAnalFunction *fcn) {
r_return_if_fail (anal && fcn);
R_RETURN_IF_FAIL (anal && fcn);
RVecAnalRef *refs = r_anal_function_get_refs (fcn);
if (!refs) {
@ -2289,7 +2289,7 @@ static bool can_affect_bp(RAnal *anal, RAnalOp* op) {
* and "pop bp" at the end).
*/
R_API void r_anal_function_check_bp_use(RAnalFunction *fcn) {
r_return_if_fail (fcn);
R_RETURN_IF_FAIL (fcn);
RAnal *anal = fcn->anal;
RListIter *iter;
RAnalBlock *bb;
@ -2522,7 +2522,7 @@ static void calc_reachable_and_remove_block(RList *fcns, RAnalFunction *fcn, RAn
}
R_API void r_anal_update_analysis_range(RAnal *anal, ut64 addr, int size) {
r_return_if_fail (anal);
R_RETURN_IF_FAIL (anal);
RListIter *it, *it2, *tmp;
RAnalBlock *bb;
RAnalFunction *fcn;
@ -2562,7 +2562,7 @@ R_API void r_anal_update_analysis_range(RAnal *anal, ut64 addr, int size) {
}
R_API void r_anal_function_update_analysis(RAnalFunction *fcn) {
r_return_if_fail (fcn);
R_RETURN_IF_FAIL (fcn);
RListIter *it, *it2, *tmp, *tmp2;
RAnalBlock *bb;
RAnalFunction *f;

View File

@ -237,7 +237,7 @@ R_API const char *r_meta_type_tostring(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
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;
@ -635,6 +635,6 @@ R_API int r_meta_space_count_for(RAnal *a, const RSpace *space) {
}
R_API void r_meta_set_data_at(RAnal *a, ut64 addr, ut64 wordsz) {
r_return_if_fail (wordsz);
R_RETURN_IF_FAIL (wordsz);
r_meta_set (a, R_META_TYPE_DATA, addr, wordsz, NULL);
}

View File

@ -300,7 +300,7 @@ static const char *type_tostring(RTypeInfoType type) {
case R_TYPEINFO_TYPE_VMI_CLASS:
return VMI_CLASS_TYPE_INFO_NAME;
default:
r_return_val_if_reached (CLASS_TYPE_INFO_NAME);
R_RETURN_VAL_IF_REACHED (CLASS_TYPE_INFO_NAME);
}
return NULL;
}
@ -668,7 +668,7 @@ static class_type_info *rtti_itanium_type_info_new(RVTableContext *context, ut64
case R_TYPEINFO_TYPE_CLASS:
return rtti_itanium_class_type_info_new (context, rtti_addr, vtable_addr);
default:
r_return_val_if_reached (NULL);
R_RETURN_VAL_IF_REACHED (NULL);
}
return false;
}
@ -690,7 +690,7 @@ static void rtti_itanium_type_info_free(void *info) {
rtti_itanium_class_type_info_free (cti);
return;
default:
r_return_if_reached ();
R_RETURN_IF_REACHED ();
}
}
@ -733,7 +733,7 @@ R_API bool r_anal_rtti_itanium_print_at_vtable(RVTableContext *context, ut64 add
return true;
default:
rtti_itanium_class_type_info_free (cti);
r_return_val_if_reached (false);
R_RETURN_VAL_IF_REACHED (false);
}
return false;
}

View File

@ -32,7 +32,7 @@ static char *get_type_data(Sdb *sdb_types, const char *type, const char *sname)
}
R_API void r_anal_remove_parsed_type(RAnal *anal, const char *name) {
r_return_if_fail (anal && name);
R_RETURN_IF_FAIL (anal && name);
Sdb *TDB = anal->sdb_types;
SdbKv *kv;
SdbListIter *iter;
@ -60,7 +60,7 @@ R_API void r_anal_remove_parsed_type(RAnal *anal, const char *name) {
// RENAME TO r_anal_types_save(); // parses the string and imports the types
R_API void r_anal_save_parsed_type(RAnal *anal, const char *parsed) {
r_return_if_fail (anal && parsed);
R_RETURN_IF_FAIL (anal && parsed);
// First, if any parsed types exist, let's remove them.
char *type = strdup (parsed);
@ -352,7 +352,7 @@ R_API RAnalBaseType *r_anal_get_base_type(RAnal *anal, const char *name) {
}
static void save_struct(const RAnal *anal, const RAnalBaseType *type) {
r_return_if_fail (anal && type && type->name
R_RETURN_IF_FAIL (anal && type && type->name
&& type->kind == R_ANAL_BASE_TYPE_KIND_STRUCT);
char *kind = "struct";
/*
@ -392,8 +392,8 @@ static void save_struct(const RAnal *anal, const RAnalBaseType *type) {
static void save_union(const RAnal *anal, const RAnalBaseType *type) {
r_strf_buffer (KSZ);
r_return_if_fail (anal && type && type->name);
r_return_if_fail (type->kind == R_ANAL_BASE_TYPE_KIND_UNION);
R_RETURN_IF_FAIL (anal && type && type->name);
R_RETURN_IF_FAIL (type->kind == R_ANAL_BASE_TYPE_KIND_UNION);
const char *kind = "union";
/*
C:
@ -427,8 +427,8 @@ static void save_union(const RAnal *anal, const RAnalBaseType *type) {
}
static void save_enum(const RAnal *anal, const RAnalBaseType *type) {
r_return_if_fail (anal && type && type->name);
r_return_if_fail (type->kind == R_ANAL_BASE_TYPE_KIND_ENUM);
R_RETURN_IF_FAIL (anal && type && type->name);
R_RETURN_IF_FAIL (type->kind == R_ANAL_BASE_TYPE_KIND_ENUM);
/*
C:
enum name {case1 = 1, case2 = 2, caseN = 3};
@ -469,8 +469,8 @@ static void save_enum(const RAnal *anal, const RAnalBaseType *type) {
static void save_atomic_type(const RAnal *anal, const RAnalBaseType *type) {
r_strf_buffer (KSZ);
r_return_if_fail (anal && type && type->name);
r_return_if_fail (type->kind == R_ANAL_BASE_TYPE_KIND_ATOMIC);
R_RETURN_IF_FAIL (anal && type && type->name);
R_RETURN_IF_FAIL (type->kind == R_ANAL_BASE_TYPE_KIND_ATOMIC);
/*
C: (cannot define a custom atomic type)
Sdb:
@ -492,7 +492,7 @@ static void save_atomic_type(const RAnal *anal, const RAnalBaseType *type) {
static void save_typedef(const RAnal *anal, const RAnalBaseType *type) {
r_strf_buffer (KSZ);
r_return_if_fail (anal && type && type->name && type->kind == R_ANAL_BASE_TYPE_KIND_TYPEDEF);
R_RETURN_IF_FAIL (anal && type && type->name && type->kind == R_ANAL_BASE_TYPE_KIND_TYPEDEF);
/*
C:
typedef char byte;
@ -511,7 +511,7 @@ static void save_typedef(const RAnal *anal, const RAnalBaseType *type) {
}
R_API void r_anal_base_type_free(RAnalBaseType *type) {
r_return_if_fail (type);
R_RETURN_IF_FAIL (type);
free (type->name);
free (type->type);
@ -563,7 +563,7 @@ R_API RAnalBaseType *r_anal_base_type_new(RAnalBaseTypeKind kind) {
* @param name Name of the type
*/
R_API void r_anal_save_base_type(const RAnal *anal, const RAnalBaseType *type) {
r_return_if_fail (anal && type && type->name);
R_RETURN_IF_FAIL (anal && type && type->name);
// TODO, solve collisions, if there are 2 types with the same name and kind

View File

@ -96,10 +96,10 @@ cleanup:
* @param types List of all types
*/
static void parse_enum(const RAnal *anal, SType *type, RList *types) {
r_return_if_fail (anal && type && types);
R_RETURN_IF_FAIL (anal && type && types);
STypeInfo *type_info = &type->type_data;
// assert all member functions we need info from
r_return_if_fail (type_info->get_members &&
R_RETURN_IF_FAIL (type_info->get_members &&
type_info->get_name &&
type_info->get_utype);
@ -160,10 +160,10 @@ cleanup:
* @param types List of all types
*/
static void parse_structure(const RAnal *anal, SType *type, RList *types) {
r_return_if_fail (anal && type && types);
R_RETURN_IF_FAIL (anal && type && types);
STypeInfo *type_info = &type->type_data;
// assert all member functions we need info from
r_return_if_fail (type_info->get_members &&
R_RETURN_IF_FAIL (type_info->get_members &&
type_info->is_fwdref &&
type_info->get_name &&
type_info->get_val);
@ -223,7 +223,7 @@ cleanup:
* @param types List of all types
*/
static void parse_type(const RAnal *anal, SType *type, RList *types) {
r_return_if_fail (anal && type && types);
R_RETURN_IF_FAIL (anal && type && types);
int is_forward_decl;
if (type->type_data.is_fwdref) {
@ -256,7 +256,7 @@ static void parse_type(const RAnal *anal, SType *type, RList *types) {
* @param pdb PDB information
*/
R_API void r_parse_pdb_types(const RAnal *anal, const RPdb *pdb) {
r_return_if_fail (anal && pdb);
R_RETURN_IF_FAIL (anal && pdb);
RList *plist = pdb->pdb_streams;
// getting the TPI stream from the streams list
STpiStream *tpi_stream = r_list_get_n (plist, ePDB_STREAM_TPI);

View File

@ -231,7 +231,7 @@ static void r_anal_var_proto_free(RAnalVarProt *vp) {
}
R_API void r_anal_var_delete(RAnalVar *var) {
r_return_if_fail (var);
R_RETURN_IF_FAIL (var);
RAnalFunction *fcn = var->fcn;
size_t i;
for (i = 0; i < r_pvector_length (&fcn->vars); i++) {
@ -245,7 +245,7 @@ R_API void r_anal_var_delete(RAnalVar *var) {
}
R_API void r_anal_function_delete_vars_by_kind(RAnalFunction *fcn, RAnalVarKind kind) {
r_return_if_fail (fcn);
R_RETURN_IF_FAIL (fcn);
size_t i;
for (i = 0; i < r_pvector_length (&fcn->vars);) {
RAnalVar *var = r_pvector_at (&fcn->vars, i);
@ -259,7 +259,7 @@ R_API void r_anal_function_delete_vars_by_kind(RAnalFunction *fcn, RAnalVarKind
}
R_API void r_anal_function_delete_all_vars(RAnalFunction *fcn) {
r_return_if_fail (fcn);
R_RETURN_IF_FAIL (fcn);
if (fcn->vars.v.len > 0) {
void **it;
r_pvector_foreach (&fcn->vars, it) {
@ -270,7 +270,7 @@ R_API void r_anal_function_delete_all_vars(RAnalFunction *fcn) {
}
R_API void r_anal_function_delete_unused_vars(RAnalFunction *fcn) {
r_return_if_fail (fcn);
R_RETURN_IF_FAIL (fcn);
void **v;
RPVector *vars_clone = (RPVector *)r_vector_clone ((RVector *)&fcn->vars);
r_pvector_foreach (vars_clone, v) {
@ -283,7 +283,7 @@ R_API void r_anal_function_delete_unused_vars(RAnalFunction *fcn) {
}
R_API void r_anal_function_delete_var(RAnalFunction *fcn, RAnalVar *var) {
r_return_if_fail (fcn && var);
R_RETURN_IF_FAIL (fcn && var);
r_pvector_remove_data (&fcn->vars, var);
var_free (var);
}
@ -364,7 +364,7 @@ bad_serial:
}
static inline void sanitize_var_serial(char *name, bool colon) {
r_return_if_fail (name);
R_RETURN_IF_FAIL (name);
for (; *name; name++) {
switch (*name) {
case ':':
@ -653,7 +653,7 @@ R_API RAnalVar *r_anal_var_get_dst_var(RAnalVar *var) {
}
R_API void r_anal_var_set_access(RAnalVar *var, const char *reg, ut64 access_addr, int access_type, st64 stackptr) {
r_return_if_fail (var);
R_RETURN_IF_FAIL (var);
st64 offset = access_addr - var->fcn->addr;
// accesses are stored ordered by offset, use binary search to get the matching existing or the index to insert a new one
@ -688,7 +688,7 @@ R_API void r_anal_var_set_access(RAnalVar *var, const char *reg, ut64 access_add
}
R_API void r_anal_var_remove_access_at(RAnalVar *var, ut64 address) {
r_return_if_fail (var);
R_RETURN_IF_FAIL (var);
st64 offset = address - var->fcn->addr;
size_t index;
r_vector_lower_bound (&var->accesses, offset, index, ACCESS_CMP);
@ -705,7 +705,7 @@ R_API void r_anal_var_remove_access_at(RAnalVar *var, ut64 address) {
}
R_API void r_anal_var_clear_accesses(RAnalVar *var) {
r_return_if_fail (var);
R_RETURN_IF_FAIL (var);
RAnalFunction *fcn = var->fcn;
if (fcn->inst_vars) {
// remove all inverse references to the var's accesses
@ -924,7 +924,7 @@ static void extract_arg(RAnal *anal, RAnalFunction *fcn, RAnalOp *op, const char
const st64 maxstackframe = 1024 * 8;
RAnalValue *val = NULL;
r_return_if_fail (anal && fcn && op && reg);
R_RETURN_IF_FAIL (anal && fcn && op && reg);
r_vector_foreach (&op->srcs, val) {
if (val && val->reg && !strcmp (reg, val->reg)) {
@ -1196,7 +1196,7 @@ static bool is_used_like_arg(const char *regname, const char *opsreg, const char
R_API void r_anal_extract_rarg(RAnal *anal, RAnalOp *op, RAnalFunction *fcn, int *reg_set, int *count) {
int i, argc = 0;
r_return_if_fail (anal && op && fcn);
R_RETURN_IF_FAIL (anal && op && fcn);
RAnalValue *src = r_vector_at (&op->srcs, 0);
RAnalValue *dst = r_vector_at (&op->dsts, 0);
const char *opsreg = src ? get_regname (anal, src) : NULL;
@ -1404,7 +1404,7 @@ R_API void r_anal_extract_rarg(RAnal *anal, RAnalOp *op, RAnalFunction *fcn, int
}
R_API void r_anal_extract_vars(RAnal *anal, RAnalFunction *fcn, RAnalOp *op) {
r_return_if_fail (anal && fcn && op);
R_RETURN_IF_FAIL (anal && fcn && op);
const char *BP = anal->reg->name[R_REG_NAME_BP];
if (BP) {
@ -1567,7 +1567,7 @@ static int var_comparator(const RAnalVar *a, const RAnalVar *b) {
}
R_API void r_anal_var_list_show(RAnal *anal, RAnalFunction *fcn, int kind, int mode, PJ *pj) {
r_return_if_fail (anal && fcn);
R_RETURN_IF_FAIL (anal && fcn);
bool newstack = anal->opt.var_newstack;
RList *list = r_anal_var_list (anal, fcn, kind);
RAnalVar *var;

View File

@ -179,7 +179,7 @@ static bool vtable_is_addr_vtable_start(RVTableContext *context, RBinSection *se
if (context->abi == R_ANAL_CPP_ABI_ITANIUM) {
return vtable_is_addr_vtable_start_itanium (context, section, curAddress);
}
r_return_val_if_reached (false);
R_RETURN_VAL_IF_REACHED (false);
return false;
}

View File

@ -240,7 +240,7 @@ R_API bool r_anal_xrefs_init(RAnal *anal) {
}
R_API void r_anal_xrefs_free(RAnal *anal) {
r_return_if_fail (anal);
R_RETURN_IF_FAIL (anal);
ref_manager_free (anal->rm);
}
@ -471,7 +471,7 @@ static void r_anal_xrefs_list_plaintext(RAnal *anal, RVecAnalRef *anal_refs) {
}
R_API void r_anal_xrefs_list(RAnal *anal, int rad, const char *arg) {
r_return_if_fail (anal && anal->rm);
R_RETURN_IF_FAIL (anal && anal->rm);
RVecAnalRef *anal_refs = ref_manager_get_refs (anal->rm, UT64_MAX);
if (!anal_refs) {

View File

@ -20,7 +20,7 @@ R_API void r_arch_config_free(RArchConfig *r) {
}
R_API void r_arch_config_use(RArchConfig *config, R_NULLABLE const char *arch) {
r_return_if_fail (config);
R_RETURN_IF_FAIL (config);
if (arch && !strcmp (arch, "null")) {
return;
}
@ -34,7 +34,7 @@ R_API bool r_arch_config_iseq(RArchConfig *a, RArchConfig *b) {
}
R_API void r_arch_config_set_cpu(RArchConfig *config, R_NULLABLE const char *cpu) {
r_return_if_fail (config);
R_RETURN_IF_FAIL (config);
// R_LOG_DEBUG ("RArch.CPU (%s)", cpu);
free (config->cpu);
config->cpu = R_STR_ISNOTEMPTY (cpu) ? strdup (cpu) : NULL;

View File

@ -40,7 +40,7 @@ R_API char *r_arch_platform_set(RArch *arch, const char *name) {
// TODO return list or char *
R_API void r_arch_platform_list(RArch *arch) {
r_return_if_fail (arch);
R_RETURN_IF_FAIL (arch);
RListIter *iter;
char *item;
char *root = getroot ();

View File

@ -265,7 +265,7 @@ static void dalvik_math_op(RAnalOp* op, const ut8* data, int len, RAnalOpMask ma
}
static int dalvik_disassemble(RArchSession *as, RAnalOp *op, ut64 addr, const ut8 *buf, int len, int size) {
r_return_val_if_fail (as && op && buf && len > 0, -1);
R_RETURN_VAL_IF_FAIL (as && op && buf && len > 0, -1);
int vA, vB, vC, vD, vE, vF, vG, vH, payload = 0;
char str[1024], *strasm = NULL;

View File

@ -322,7 +322,7 @@ static inline bool op_set_nfo(HtUP *c, RAnalOp *op) {
static void set_cf_info(RArchSession *s, RAnalOp *op) {
// TODO: check if file has changed
HtUP *cache = (HtUP *)s->user;
r_return_if_fail (cache);
R_RETURN_IF_FAIL (cache);
if (!op_set_nfo (cache, op)) {
if (parse_control_flow (s, op->addr)) {

View File

@ -521,7 +521,7 @@ static void own(struct state *s)
}
if (s->s_nop) {
r_return_if_fail (!s->s_nopd);
R_RETURN_IF_FAIL (!s->s_nopd);
s->s_nopd = d;
} else {
last->d_next = d;
@ -561,7 +561,7 @@ static void own(struct state *s)
}
if (l) {
print_label(s, l);
r_return_if_fail (!l->l_next);
R_RETURN_IF_FAIL (!l->l_next);
}
output(s, "\n\tENDMOD\n");

View File

@ -16,7 +16,7 @@ R_API void r_asm_code_free(RAsmCode *acode) {
}
R_API void r_asm_code_set_equ(RAsmCode *code, const char *key, const char *value) {
r_return_if_fail (code && key && value);
R_RETURN_IF_FAIL (code && key && value);
if (!code->equs) {
code->equs = ht_pp_new0 ();
}

View File

@ -21,7 +21,7 @@ R_API void r_asm_op_init(RAnalOp *op) {
}
R_DEPRECATE R_API void r_asm_op_fini(RAnalOp *op) {
r_return_if_fail (op);
R_RETURN_IF_FAIL (op);
r_anal_op_fini (op);
}
@ -63,7 +63,7 @@ R_API int r_asm_op_get_size(RAnalOp *op) {
}
R_API void r_asm_op_set_asm(RAnalOp *op, const char *str) {
r_return_if_fail (op && str);
R_RETURN_IF_FAIL (op && str);
r_anal_op_set_mnemonic (op, op->addr, str);
}
@ -99,6 +99,6 @@ R_API int r_asm_op_set_hexbuf(RAnalOp *op, const ut8 *buf, int len) {
}
R_DEPRECATE R_API void r_asm_op_set_buf(RAnalOp *op, const ut8 *buf, int len) {
r_return_if_fail (op && buf && len >= 0);
R_RETURN_IF_FAIL (op && buf && len >= 0);
r_anal_op_set_bytes (op, op->addr, buf, len);
}

View File

@ -313,7 +313,7 @@ R_API bool r_asm_use(RAsm *a, const char *name) {
// R2_600
// XXX this is r_arch
R_DEPRECATE R_API void r_asm_set_cpu(RAsm *a, const char *cpu) {
r_return_if_fail (a);
R_RETURN_IF_FAIL (a);
r_arch_config_set_cpu (a->config, cpu);
}

View File

@ -226,6 +226,6 @@ R_API bool r_parse_subvar(RParse *p, R_NULLABLE RAnalFunction *f, ut64 addr, int
/* setters */
R_API void r_parse_set_user_ptr(RParse *p, void *user) {
r_return_if_fail (p && user);
R_RETURN_IF_FAIL (p && user);
p->user = user;
}

View File

@ -30,7 +30,7 @@ static int reloc_cmp(void *incoming, void *in, void *user) {
}
static void object_delete_items(RBinObject *o) {
r_return_if_fail (o);
R_RETURN_IF_FAIL (o);
ut32 i = 0;
r_strpool_free (o->pool);
ht_up_free (o->addr2klassmethod);
@ -568,7 +568,7 @@ R_API bool r_bin_object_delete(RBin *bin, ut32 bf_id) {
}
R_IPI void r_bin_object_filter_strings(RBinObject *bo) {
r_return_if_fail (bo && bo->strings);
R_RETURN_IF_FAIL (bo && bo->strings);
RList *strings = bo->strings;
RBinString *ptr;

View File

@ -1683,7 +1683,7 @@ R_API void r_bin_dwarf_free_debug_info(RBinDwarfDebugInfo *inf) {
static void print_attr_value(const RBinDwarfAttrValue *val, PrintfCallback print) {
size_t i;
r_return_if_fail(val);
R_RETURN_IF_FAIL (val);
switch (val->attr_form) {
case DW_FORM_block:
@ -1776,7 +1776,7 @@ static void print_debug_info(const RBinDwarfDebugInfo *inf, PrintfCallback print
RBinDwarfDie *dies;
RBinDwarfAttrValue *values;
r_return_if_fail (inf);
R_RETURN_IF_FAIL (inf);
for (i = 0; i < inf->count; i++) {
print ("\n");
@ -2800,7 +2800,7 @@ static bool sort_loclists(void *user, const ut64 key, const void *value) {
}
R_API void r_bin_dwarf_print_loc(HtUP /*<offset, RBinDwarfLocList*/ *loc_table, int addr_size, PrintfCallback print) {
r_return_if_fail (loc_table && print);
R_RETURN_IF_FAIL (loc_table && print);
print ("\nContents of the .debug_loc section:\n");
RList /*<RBinDwarfLocList *>*/ *sort_list = r_list_new ();
/* sort the table contents by offset and print sorted

View File

@ -3358,7 +3358,7 @@ const RVector* Elf_(load_libs)(ELFOBJ *eo) {
}
static void create_section_from_phdr(ELFOBJ *eo, const char *name, ut64 addr, ut64 sz) {
r_return_if_fail (eo);
R_RETURN_IF_FAIL (eo);
if (!addr || addr == UT64_MAX) {
return;
}

View File

@ -270,7 +270,7 @@ R_IPI RList *r_bin_le_get_libs(RBinLEObj *bin) {
* TODO: Don't do this
*/
static void __create_iter_sections(RList *l, RBinLEObj *bin, RBinSection *sec, LE_object_page_entry *page, ut64 vaddr, int cur_page) {
r_return_if_fail (l && bin && sec && page);
R_RETURN_IF_FAIL (l && bin && sec && page);
LE_image_header *h = bin->header;
if (h->pageshift > ST16_MAX || h->pageshift < 0) {
// early quit before using an invalid offset

View File

@ -2249,7 +2249,7 @@ void *MACH0_(mach0_free)(struct MACH0_(obj_t) *mo) {
}
void MACH0_(opts_set_default)(struct MACH0_(opts_t) *options, RBinFile *bf) {
r_return_if_fail (options && bf && bf->rbin);
R_RETURN_IF_FAIL (options && bf && bf->rbin);
options->bf = bf;
options->header_at = 0;
options->symbols_off = 0;
@ -3648,7 +3648,7 @@ static bool walk_bind_chains_callback(void * context, RFixupEventDetails * event
}
static void walk_bind_chains(struct MACH0_(obj_t) *mo, RSkipList *relocs) {
r_return_if_fail (mo && mo->fixups_offset);
R_RETURN_IF_FAIL (mo && mo->fixups_offset);
ut8 *imports = NULL;

View File

@ -1929,7 +1929,7 @@ error:
}
void MACH0_(get_category_t)(RBinFile *bf, RBinClass *klass, mach0_ut p, const RSkipList *relocs, objc_cache_opt_info *oi) {
r_return_if_fail (bf && bf->bo && bf->bo->info);
R_RETURN_IF_FAIL (bf && bf->bo && bf->bo->info);
struct MACH0_(SCategory) c = {0};
const int size = sizeof (struct MACH0_(SCategory));

View File

@ -982,7 +982,7 @@ static char *get_enum_base_type_name(STypeInfo *type_info) {
* @param printf Print function
*/
static void print_struct(const char *name, const int size, const RList *members, PrintfCallback printf) {
r_return_if_fail (name && printf);
R_RETURN_IF_FAIL (name && printf);
printf ("struct %s { // size 0x%x\n", name, size);
RListIter *member_iter = r_list_iterator (members);
@ -1015,7 +1015,7 @@ static void print_struct(const char *name, const int size, const RList *members,
* @param printf Print function
*/
static void print_union(const char *name, const int size, const RList *members, PrintfCallback printf) {
r_return_if_fail (name && printf);
R_RETURN_IF_FAIL (name && printf);
printf ("union %s { // size 0x%x\n", name, size);
RListIter *member_iter = r_list_iterator (members);
@ -1048,7 +1048,7 @@ static void print_union(const char *name, const int size, const RList *members,
* @param printf Print function
*/
static void print_enum(const char *name, const char *type, const RList *members, PrintfCallback printf) {
r_return_if_fail (name && printf);
R_RETURN_IF_FAIL (name && printf);
printf ("enum %s { // type: %s\n", name, type);
RListIter *member_iter = r_list_iterator (members);
@ -1074,7 +1074,7 @@ static void print_enum(const char *name, const char *type, const RList *members,
* @param types List of types
*/
static void print_types_regular(const RPdb *pdb, const RList *types) {
r_return_if_fail (pdb && types);
R_RETURN_IF_FAIL (pdb && types);
RListIter *it = r_list_iterator (types);
while (r_list_iter_next (it)) {
@ -1131,7 +1131,7 @@ static void print_types_regular(const RPdb *pdb, const RList *types) {
* @param types List of types
*/
static void print_types_json(const RPdb *pdb, PJ *pj, const RList *types) {
r_return_if_fail (pdb && types && pj);
R_RETURN_IF_FAIL (pdb && types && pj);
RListIter *it = r_list_iterator (types);
@ -1250,7 +1250,7 @@ static void print_types_json(const RPdb *pdb, PJ *pj, const RList *types) {
* @param types List of types
*/
static void print_types_format(const RPdb *pdb, const RList *types) {
r_return_if_fail (pdb && types);
R_RETURN_IF_FAIL (pdb && types);
RListIter *it = r_list_iterator (types);
bool to_free_name = false;
while (r_list_iter_next (it)) {

View File

@ -1672,7 +1672,7 @@ static void get_array_print_type(void *type, char **name) {
SType *t = 0;
ti->get_element_type (ti, (void **)&t);
r_return_if_fail (t); // t == NULL indicates malformed PDB ?
R_RETURN_IF_FAIL (t); // t == NULL indicates malformed PDB ?
if (t->type_data.leaf_type == eLF_SIMPLE_TYPE) {
need_to_free = false;
SLF_SIMPLE_TYPE *base_type = t->type_data.type_info;
@ -1705,7 +1705,7 @@ static void get_pointer_print_type(void *type, char **name) {
int need_to_free = 1;
ti->get_utype (ti, (void **)&t);
r_return_if_fail (t); // t == NULL indicates malformed PDB ?
R_RETURN_IF_FAIL (t); // t == NULL indicates malformed PDB ?
if (t->type_data.leaf_type == eLF_SIMPLE_TYPE) {
need_to_free = false;
SLF_SIMPLE_TYPE *base_type = t->type_data.type_info;
@ -1830,7 +1830,7 @@ static void get_enum_print_type(void *type, char **name) {
int need_to_free = 1;
ti->get_utype (ti, (void **)&t);
r_return_if_fail (t); // This shouldn't happen?, TODO explore this situation
R_RETURN_IF_FAIL (t); // This shouldn't happen?, TODO explore this situation
if (t->type_data.leaf_type == eLF_SIMPLE_TYPE) { // BaseType
need_to_free = 0;
SLF_SIMPLE_TYPE *base_type = t->type_data.type_info;

View File

@ -438,7 +438,7 @@ static RCFValueDict *r_cf_value_dict_new(void) {
}
void r_cf_value_dict_free (RCFValueDict *dict) {
r_return_if_fail (dict);
R_RETURN_IF_FAIL (dict);
if (dict->pairs) {
r_list_free (dict->pairs);

View File

@ -107,7 +107,7 @@ static cache_img_t *read_cache_images(RBuffer *cache_buf, cache_hdr_t *hdr, ut64
}
static void match_bin_entries(RDyldCache *cache, void *entries, ut64 entries_count, bool has_large_entries) {
r_return_if_fail (cache && cache->bin_by_pa && entries);
R_RETURN_IF_FAIL (cache && cache->bin_by_pa && entries);
ut32 i;
for (i = 0; i < entries_count; i++) {
@ -867,7 +867,7 @@ error:
}
static void populate_cache_maps(RDyldCache *cache) {
r_return_if_fail (cache && cache->buf);
R_RETURN_IF_FAIL (cache && cache->buf);
ut32 i;
size_t n_maps = 0;

View File

@ -18,7 +18,7 @@ static bool add_sdb_bin_obj(const char *key, RBinJavaObj *bin_obj) {
}
static void add_bin_obj_to_sdb(RBinJavaObj *bj) {
r_return_if_fail (bj);
R_RETURN_IF_FAIL (bj);
char *jvcname = r_bin_java_build_obj_key (bj);
add_sdb_bin_obj (jvcname, bj);
bj->AllJavaBinObjs = bj->kv; // XXX that was a global.. so this must be inside bin->sdb namespace

View File

@ -40,7 +40,7 @@ static void destroy(RBinFile *bf) {
}
static void header(RBinFile *bf) {
r_return_if_fail (bf && bf->rbin && bf->bo && bf->bo->bin_obj);
R_RETURN_IF_FAIL (bf && bf->rbin && bf->bo && bf->bo->bin_obj);
RBin *rbin = bf->rbin;
RBinLEObj *bin = bf->bo->bin_obj;
LE_image_header *h = bin->header;

View File

@ -172,7 +172,7 @@ static RList *relocs(RBinFile *bf) {
}
static void header(RBinFile *bf) {
r_return_if_fail (bf && bf->bo && bf->rbin);
R_RETURN_IF_FAIL (bf && bf->bo && bf->rbin);
QnxObj *bin = bf->bo->bin_obj;
RBin *rbin = bf->rbin;
rbin->cb_printf ("QNX file header:\n");

View File

@ -402,7 +402,7 @@ static void destroy(RBinFile *bf) {
}
static void header(RBinFile *bf) {
r_return_if_fail (bf && bf->bo);
R_RETURN_IF_FAIL (bf && bf->bo);
RCoreSymCacheElement *element = bf->bo->bin_obj;
if (!element) {

View File

@ -2037,7 +2037,7 @@ static ut64 iterate_rebase_list(RBuffer *cache_buf, ut64 multiplier, ut64 start_
}
static void swizzle_io_read(RKernelCacheObj *obj, RIO *io) {
r_return_if_fail (io && io->desc && io->desc->plugin);
R_RETURN_IF_FAIL (io && io->desc && io->desc->plugin);
RIOPlugin *plugin = io->desc->plugin;
obj->original_io_read = plugin->read;
plugin->read = &kernelcache_io_read;

View File

@ -20,7 +20,7 @@ R_API char *r_config_node_tostring(RConfigNode *node) {
}
R_API void r_config_node_purge_options(RConfigNode *node) {
r_return_if_fail (node);
R_RETURN_IF_FAIL (node);
if (node->options) {
r_list_purge (node->options);
} else {
@ -29,7 +29,7 @@ R_API void r_config_node_purge_options(RConfigNode *node) {
}
R_API void r_config_node_add_option(RConfigNode *node, const char *option) {
r_return_if_fail (node && option);
R_RETURN_IF_FAIL (node && option);
if (!node->options) {
node->options = r_list_newf (free);
}
@ -63,7 +63,7 @@ R_API void r_config_node_free(void *n) {
}
static void config_print_value_json(RConfig *cfg, PJ *pj, RConfigNode *node) {
r_return_if_fail (cfg && node);
R_RETURN_IF_FAIL (cfg && node);
const char *val = node->value;
if (!val) {
val = "0";
@ -108,7 +108,7 @@ static void config_print_value_json(RConfig *cfg, PJ *pj, RConfigNode *node) {
}
static void config_print_node(RConfig *cfg, RConfigNode *node, PJ *pj, const char *pfx, const char *sfx, bool verbose) {
r_return_if_fail (cfg && node && pfx && sfx);
R_RETURN_IF_FAIL (cfg && node && pfx && sfx);
char *option;
RListIter *iter;
@ -164,7 +164,7 @@ static void config_print_node(RConfig *cfg, RConfigNode *node, PJ *pj, const cha
}
R_API void r_config_list(RConfig *cfg, const char *str, int rad) {
r_return_if_fail (cfg);
R_RETURN_IF_FAIL (cfg);
RConfigNode *node;
RListIter *iter;
const char *sfx = "";

View File

@ -63,7 +63,7 @@ R_API RConfigHold* r_config_hold_new(RConfig *cfg) {
}
R_API void r_config_hold_restore(RConfigHold *h) {
r_return_if_fail (h);
R_RETURN_IF_FAIL (h);
RListIter *iter;
RConfigHolder *hc;
RConfig *cfg = h->cfg;

View File

@ -171,7 +171,7 @@ static bool attribute_delete_cb(void *user, const ut64 key, const void *value) {
}
R_API void r_cons_canvas_clear(RConsCanvas *c) {
r_return_if_fail (c && c->b);
R_RETURN_IF_FAIL (c && c->b);
int y;
for (y = 0; y < c->h; y++) {
memset (c->b[y], '\n', c->bsize[y]);

View File

@ -113,7 +113,7 @@ static RConsStack *cons_stack_dump(bool recreate) {
}
static void cons_stack_load(RConsStack *data, bool free_current) {
r_return_if_fail (data);
R_RETURN_IF_FAIL (data);
if (free_current) {
// double free
free (C->buffer);
@ -1467,7 +1467,7 @@ R_API void r_cons_memset(char ch, int len) {
}
R_API void r_cons_print(const char *str) {
r_return_if_fail (str);
R_RETURN_IF_FAIL (str);
if (!I || I->null) {
return;
}

View File

@ -462,7 +462,7 @@ static char *preprocess_filter_expr(char *cmd, const char *quotes) {
}
R_API void r_cons_grep_parsecmd(char *cmd, const char *quotestr) {
r_return_if_fail (cmd && quotestr);
R_RETURN_IF_FAIL (cmd && quotestr);
char *ptr = preprocess_filter_expr (cmd, quotestr);
if (ptr) {
r_str_trim (cmd);
@ -1221,7 +1221,7 @@ R_API int r_cons_grep_line(char *buf, int len) {
}
R_API void r_cons_grep(const char *grep) {
r_return_if_fail (grep);
R_RETURN_IF_FAIL (grep);
r_cons_grep_expression (grep);
r_cons_grepbuf ();
}

View File

@ -67,7 +67,7 @@ R_API void r_line_completion_fini(RLineCompletion *completion) {
}
R_API void r_line_completion_push(RLineCompletion *completion, const char *str) {
r_return_if_fail (completion && str);
R_RETURN_IF_FAIL (completion && str);
if (completion->quit) {
return;
}
@ -83,7 +83,7 @@ R_API void r_line_completion_push(RLineCompletion *completion, const char *str)
}
R_API void r_line_completion_set(RLineCompletion *completion, int argc, const char **argv) {
r_return_if_fail (completion && (argc >= 0));
R_RETURN_IF_FAIL (completion && (argc >= 0));
r_line_completion_clear (completion);
if (argc > completion->args_limit) {
argc = completion->args_limit;
@ -100,7 +100,7 @@ R_API void r_line_completion_set(RLineCompletion *completion, int argc, const ch
}
R_API void r_line_completion_clear(RLineCompletion *completion) {
r_return_if_fail (completion);
R_RETURN_IF_FAIL (completion);
completion->quit = false;
r_pvector_clear (&completion->args);
}

View File

@ -44,7 +44,7 @@ R_API ut8 r_cons_pixel_get(RConsPixel *p, int x, int y) {
return 0;
}
R_API void r_cons_pixel_set(RConsPixel *p, int x, int y, ut8 v) {
r_return_if_fail (p);
R_RETURN_IF_FAIL (p);
if (x < 0 || x >= p->w) {
return;
}
@ -58,7 +58,7 @@ R_API void r_cons_pixel_set(RConsPixel *p, int x, int y, ut8 v) {
}
R_API void r_cons_pixel_sets(RConsPixel *p, int x, int y, const char *s) {
r_return_if_fail (p && s);
R_RETURN_IF_FAIL (p && s);
RRune ch;
int cols = 0;
int h = 0;
@ -87,7 +87,7 @@ R_API void r_cons_pixel_sets(RConsPixel *p, int x, int y, const char *s) {
}
R_API void r_cons_pixel_fill(RConsPixel *p, int _x, int _y, int w, int h, int v) {
r_return_if_fail (p);
R_RETURN_IF_FAIL (p);
int x, y;
for (x = _x; x < _x+w; x++) {
for (y = _y; y < _y+h; y++) {
@ -159,7 +159,7 @@ static inline void cons_pixel_paint(RConsPixel *p, int sx, int sy, int x, int y,
}
R_API void r_cons_pixel_flush(RConsPixel *p, int sx, int sy) {
r_return_if_fail (p);
R_RETURN_IF_FAIL (p);
int rows, cols = r_cons_get_size (&rows);
size_t x, y;
for (y = 0; y + 4 < p->h; y += 4) {

View File

@ -1796,7 +1796,7 @@ static void fix_back_edge_dummy_nodes(RAGraph *g, RANode *from, RANode *to) {
RGraphNode *gv = NULL;
RListIter *it;
int i;
r_return_if_fail (g && from && to);
R_RETURN_IF_FAIL (g && from && to);
const RList *neighbours = r_graph_get_neighbours (g->graph, to->gnode);
graph_foreach_anode (neighbours, it, gv, v) {
tmp = v;
@ -4011,7 +4011,7 @@ R_API RANode *r_agraph_get_node(const RAGraph *g, const char *title) {
}
R_API void r_agraph_add_edge(const RAGraph *g, RANode *a, RANode *b, bool highlight) {
r_return_if_fail (g && a && b);
R_RETURN_IF_FAIL (g && a && b);
r_graph_add_edge (g->graph, a->gnode, b->gnode);
if (highlight) {
ut64 aa = r_num_get (NULL, a->title);
@ -4027,7 +4027,7 @@ R_API void r_agraph_add_edge(const RAGraph *g, RANode *a, RANode *b, bool highli
}
R_API void r_agraph_add_edge_at(const RAGraph *g, RANode *a, RANode *b, int nth) {
r_return_if_fail (g && a && b);
R_RETURN_IF_FAIL (g && a && b);
if (a->title && b->title) {
char *k = r_str_newf ("agraph.nodes.%s.neighbours", a->title);
sdb_array_insert (g->db, k, nth, b->title, 0);
@ -4037,7 +4037,7 @@ R_API void r_agraph_add_edge_at(const RAGraph *g, RANode *a, RANode *b, int nth)
}
R_API void r_agraph_del_edge(const RAGraph *g, RANode *a, RANode *b) {
r_return_if_fail (g && a && b);
R_RETURN_IF_FAIL (g && a && b);
if (a->title && b->title) {
char *k = r_str_newf ("agraph.nodes.%s.neighbours", a->title);
sdb_array_remove (g->db, k, b->title, 0);
@ -4047,7 +4047,7 @@ R_API void r_agraph_del_edge(const RAGraph *g, RANode *a, RANode *b) {
}
R_API void r_agraph_reset(RAGraph *g) {
r_return_if_fail (g);
R_RETURN_IF_FAIL (g);
agraph_free_nodes (g);
r_graph_reset (g->graph);
r_agraph_set_title (g, NULL);
@ -4381,7 +4381,7 @@ static char *get_graph_string(RCore *core, RAGraph *g) {
}
static void nextword(RCore *core, RAGraph *g, const char *word) {
r_return_if_fail (core && core->graph && g && g->can && word);
R_RETURN_IF_FAIL (core && core->graph && g && g->can && word);
if (R_STR_ISEMPTY (word)) {
return;
}

View File

@ -190,7 +190,7 @@ static R_MUSTUSE char *function_name(RCore *core, const char *name, ut64 addr) {
}
static void printFunctionCommands(RCore *core, fcn_t* fcn, const char *name) {
r_return_if_fail (core && fcn);
R_RETURN_IF_FAIL (core && fcn);
RListIter *fcn_iter;
bb_t *cur = NULL;
char *_name = function_name (core, name, fcn->addr);
@ -204,7 +204,7 @@ static void printFunctionCommands(RCore *core, fcn_t* fcn, const char *name) {
}
static void createFunction(RCore *core, fcn_t* fcn, const char *name) {
r_return_if_fail (core && fcn);
R_RETURN_IF_FAIL (core && fcn);
RListIter *fcn_iter;
bb_t *cur = NULL;

View File

@ -128,7 +128,7 @@ static void print_format_values(RCore *core, const char *fmt, bool onstack, ut64
/* This function display list of arg with some colors */
R_API void r_core_print_func_args(RCore *core) {
r_return_if_fail (core && core->anal && core->anal->reg);
R_RETURN_IF_FAIL (core && core->anal && core->anal->reg);
bool color = r_config_get_i (core->config, "scr.color");

View File

@ -708,7 +708,7 @@ static void load_types_from(RCore *core, const char *fmt, ...) {
}
R_API void r_core_anal_type_init(RCore *core) {
r_return_if_fail (core && core->anal);
R_RETURN_IF_FAIL (core && core->anal);
int bits = core->rasm->config->bits;
Sdb *types = core->anal->sdb_types;
// make sure they are empty this is initializing
@ -730,7 +730,7 @@ R_API void r_core_anal_type_init(RCore *core) {
}
R_API void r_core_anal_cc_init(RCore *core) {
r_return_if_fail (core);
R_RETURN_IF_FAIL (core);
char *anal_arch = strdup (r_config_get (core->config, "anal.arch"));
if (anal_arch && !strcmp (anal_arch, "r2ghidra")) {
free (anal_arch);

View File

@ -408,7 +408,7 @@ static bool cb_analarch(void *user, void *data) {
}
static void update_archdecoder_options(RCore *core, RConfigNode *node) {
r_return_if_fail (core && core->anal && core->anal->arch && node);
R_RETURN_IF_FAIL (core && core->anal && core->anal->arch && node);
r_config_node_purge_options (node);
RListIter *it;
RArchPlugin *ap;
@ -617,7 +617,7 @@ static bool cb_asmassembler(void *user, void *data) {
}
static void update_cmdpdc_options(RCore *core, RConfigNode *node) {
r_return_if_fail (core && core->rasm && node);
R_RETURN_IF_FAIL (core && core->rasm && node);
RListIter *iter;
r_config_node_purge_options (node);
char *opts = r_core_cmd_str (core, "e cmd.pdc=?");
@ -632,7 +632,7 @@ static void update_cmdpdc_options(RCore *core, RConfigNode *node) {
static void update_asmcpu_options(RCore *core, RConfigNode *node) {
RListIter *iter;
r_return_if_fail (core && core->rasm);
R_RETURN_IF_FAIL (core && core->rasm);
const char *arch = r_config_get (core->config, "asm.arch");
if (!arch || !*arch) {
return;

View File

@ -2093,7 +2093,7 @@ static void load_table_asciiart(RCore *core, RTable *t, RList *lines) {
}
static void load_table(RCore *core, RTable *t, char *data) {
r_return_if_fail (core && t && data);
R_RETURN_IF_FAIL (core && t && data);
if (*data == '[') {
load_table_json (core, t, data);
} else {

View File

@ -813,7 +813,7 @@ static void cmd_fd_dot(RCore *core, const char *input) {
}
static void print_function_labels_for(RAnalFunction *fcn, int rad, PJ *pj) {
r_return_if_fail (fcn && (rad != 'j' || pj));
R_RETURN_IF_FAIL (fcn && (rad != 'j' || pj));
bool json = rad == 'j';
if (json) {
pj_o (pj);
@ -826,7 +826,7 @@ static void print_function_labels_for(RAnalFunction *fcn, int rad, PJ *pj) {
}
static void print_function_labels(RCore *core, RAnalFunction *fcn, int rad) {
r_return_if_fail (core || fcn);
R_RETURN_IF_FAIL (core || fcn);
RAnal *anal = core->anal;
PJ *pj = NULL;
bool json = rad == 'j';

View File

@ -475,7 +475,7 @@ static void cmd_open_bin(RCore *core, const char *input) {
static void map_list(RCore *core, int mode, RPrint *print, int fd) {
RIO *io = core->io;
ut64 off = core->offset;
r_return_if_fail (io && print && print->cb_printf);
R_RETURN_IF_FAIL (io && print && print->cb_printf);
PJ *pj = NULL;
if (mode == 'j') {
pj = r_core_pj_new (core);

View File

@ -2213,7 +2213,7 @@ static void cmd_print_format(RCore *core, const char *_input, const ut8* block,
* that are 4 chars long. */
#define append(x, y) if (x && y) { strcat (x, y); x += strlen (y); }
static void annotated_hexdump(RCore *core, const char *str, int len) {
r_return_if_fail (core);
R_RETURN_IF_FAIL (core);
if (!str || len < 1) {
return;
}
@ -3170,7 +3170,7 @@ static void printraw(RCore *core, int len, int mode) {
static void _handle_call(RCore *core, char *line, char **str) {
// XXX: rewrite this function
r_return_if_fail (core && line && str);
R_RETURN_IF_FAIL (core && line && str);
if (core->rasm && core->rasm->config && !strcmp (core->rasm->config->arch, "x86")) {
*str = strstr (line, "call ");
} else if (core->rasm && core->rasm->config && !strcmp (core->rasm->config->arch, "arm")) {

View File

@ -461,7 +461,7 @@ struct ctxSearchCB {
};
static void apply_name(RCore *core, RAnalFunction *fcn, RSignItem *it, bool rad) {
r_return_if_fail (core && fcn && it && it->name);
R_RETURN_IF_FAIL (core && fcn && it && it->name);
const char *name = it->realname? it->realname: it->name;
if (rad) {
char *tmp = r_name_filter_dup (name);
@ -639,7 +639,7 @@ static bool searchRange(RCore *core, ut64 from, ut64 to, bool rad, struct ctxSea
static void search_add_to_types(RCore *c, RSignSearchMetrics *sm, RSignType t, const char *str, unsigned int *i) {
unsigned int count = *i;
r_return_if_fail (count < sizeof (sm->stypes) / sizeof (RSignType) - 1);
R_RETURN_IF_FAIL (count < sizeof (sm->stypes) / sizeof (RSignType) - 1);
if (r_config_get_i (c->config, str)) {
sm->stypes[count++] = t;
sm->stypes[count] = 0;

View File

@ -205,7 +205,7 @@ R_API char* r_core_add_asmqjmp(RCore *core, ut64 addr) {
* multiletter shortcut of the form XYWZu and returned (see r_core_get_asmqjmps
* for more info). Otherwise, the shortcut is the string representation of pos. */
R_API void r_core_set_asmqjmps(RCore *core, char *str, size_t len, int pos) {
r_return_if_fail (core && str && pos > 0);
R_RETURN_IF_FAIL (core && str && pos > 0);
if (core->is_asmqjmps_letter) {
int i, j = 0;
pos --;
@ -1179,7 +1179,7 @@ static void autocomplete_mount_point(RLineCompletion *completion, RCore *core, c
}
static void autocomplete_ms_path(RLineCompletion *completion, RCore *core, const char *str, const char *path) {
r_return_if_fail (completion && core && str && path);
R_RETURN_IF_FAIL (completion && core && str && path);
char *dirname = NULL , *basename = NULL;
char *pwd = strdup (core->rfs->cwd? (const char *)core->rfs->cwd: ".");
int n = 0;
@ -1520,7 +1520,7 @@ static void autocomplete_default(R_NULLABLE RCore *core, RLineCompletion *comple
}
static void autocomplete_evals(RCore *core, RLineCompletion *completion, const char *str) {
r_return_if_fail (str);
R_RETURN_IF_FAIL (str);
RConfigNode *bt;
RListIter *iter;
const char *tmp = strrchr (str, ' ');
@ -1536,7 +1536,7 @@ static void autocomplete_evals(RCore *core, RLineCompletion *completion, const c
}
static void autocomplete_project(RCore *core, RLineCompletion *completion, const char* str) {
r_return_if_fail (str);
R_RETURN_IF_FAIL (str);
char *foo, *projects_path = r_file_abspath (r_config_get (core->config, "dir.projects"));
RList *list = r_sys_dir (projects_path);
RListIter *iter;
@ -1555,7 +1555,7 @@ static void autocomplete_project(RCore *core, RLineCompletion *completion, const
}
static void autocomplete_minus(RCore *core, RLineCompletion *completion, const char *str) {
r_return_if_fail (str);
R_RETURN_IF_FAIL (str);
int length = strlen (str);
int i;
@ -1570,7 +1570,7 @@ static void autocomplete_minus(RCore *core, RLineCompletion *completion, const c
}
static void autocomplete_breakpoints(RCore *core, RLineCompletion *completion, const char *str) {
r_return_if_fail (str);
R_RETURN_IF_FAIL (str);
RListIter *iter;
RBreakpoint *bp = core->dbg->bp;
RBreakpointItem *b;
@ -1591,14 +1591,14 @@ static bool add_argv(RFlagItem *fi, void *user) {
}
static void autocomplete_flags(RCore *core, RLineCompletion *completion, const char* str) {
r_return_if_fail (str);
R_RETURN_IF_FAIL (str);
int n = strlen (str);
r_flag_foreach_prefix (core->flags, str, n, add_argv, completion);
}
// TODO: Should be refactored
static void autocomplete_sdb(RCore *core, RLineCompletion *completion, const char *str) {
r_return_if_fail (core && completion && str);
R_RETURN_IF_FAIL (core && completion && str);
char *pipe = strchr (str, '>');
Sdb *sdb = core->sdb;
char *lpath = NULL, *p1 = NULL, *out = NULL, *p2 = NULL;
@ -1670,7 +1670,7 @@ static void autocomplete_sdb(RCore *core, RLineCompletion *completion, const cha
}
static void autocomplete_zignatures(RCore *core, RLineCompletion *completion, const char* msg) {
r_return_if_fail (msg);
R_RETURN_IF_FAIL (msg);
int length = strlen (msg);
RSpaces *zs = &core->anal->zign_spaces;
RSpace *s;
@ -1688,7 +1688,7 @@ static void autocomplete_zignatures(RCore *core, RLineCompletion *completion, co
}
static void autocomplete_flagspaces(RCore *core, RLineCompletion *completion, const char* msg) {
r_return_if_fail (msg);
R_RETURN_IF_FAIL (msg);
int length = strlen (msg);
RFlag *flag = core->flags;
RSpaceIter *it;
@ -1705,7 +1705,7 @@ static void autocomplete_flagspaces(RCore *core, RLineCompletion *completion, co
}
static void autocomplete_functions(RCore *core, RLineCompletion *completion, const char* str) {
r_return_if_fail (str);
R_RETURN_IF_FAIL (str);
RListIter *iter;
RAnalFunction *fcn;
int n = strlen (str);
@ -1719,7 +1719,7 @@ static void autocomplete_functions(RCore *core, RLineCompletion *completion, con
}
static void autocomplete_vars(RCore *core, RLineCompletion *completion, const char* str) {
r_return_if_fail (str);
R_RETURN_IF_FAIL (str);
RAnalFunction *fcn = r_anal_get_fcn_in (core->anal, core->offset, 0);
if (!fcn) {
return;
@ -1737,7 +1737,7 @@ static void autocomplete_vars(RCore *core, RLineCompletion *completion, const ch
}
static void autocomplete_macro(RCore *core, RLineCompletion *completion, const char *str) {
r_return_if_fail (core && core->rcmd && completion && str);
R_RETURN_IF_FAIL (core && core->rcmd && completion && str);
RCmdMacroItem *item;
RListIter *iter;
size_t n = strlen (str);
@ -1754,7 +1754,7 @@ static void autocomplete_macro(RCore *core, RLineCompletion *completion, const c
}
static void autocomplete_file(RLineCompletion *completion, const char *str) {
r_return_if_fail (completion && str);
R_RETURN_IF_FAIL (completion && str);
char *pipe = strchr (str, '>');
if (pipe) {
str = r_str_trim_head_ro (pipe + 1);
@ -1764,7 +1764,7 @@ static void autocomplete_file(RLineCompletion *completion, const char *str) {
}
static void autocomplete_ms_file(RCore* core, RLineCompletion *completion, const char *str) {
r_return_if_fail (str);
R_RETURN_IF_FAIL (str);
char *pipe = strchr (str, '>');
char *path = strdup ((core->rfs->cwd && *core->rfs->cwd) ? (const char *)core->rfs->cwd: "/");
if (pipe) {
@ -1776,7 +1776,7 @@ static void autocomplete_ms_file(RCore* core, RLineCompletion *completion, const
}
static void autocomplete_charsets(RCore *core, RLineCompletion *completion, const char *str) {
r_return_if_fail (str);
R_RETURN_IF_FAIL (str);
int len = strlen (str);
char *name;
RListIter *iter;
@ -1790,7 +1790,7 @@ static void autocomplete_charsets(RCore *core, RLineCompletion *completion, cons
}
static void autocomplete_theme(RCore *core, RLineCompletion *completion, const char *str) {
r_return_if_fail (str);
R_RETURN_IF_FAIL (str);
int len = strlen (str);
char *theme;
RListIter *iter;
@ -2955,7 +2955,7 @@ static RFlagItem *core_flg_fcn_set(RFlag *f, const char *name, ut64 addr, ut32 s
}
R_API void r_core_autocomplete_reload(RCore *core) {
r_return_if_fail (core);
R_RETURN_IF_FAIL (core);
r_core_autocomplete_free (core->autocomplete);
__init_autocomplete (core);
}

View File

@ -8,7 +8,7 @@ static RCorePlugin *cmd_static_plugins[] = {
};
R_API void r_core_plugin_fini(RCmd *cmd) {
r_return_if_fail (cmd);
R_RETURN_IF_FAIL (cmd);
if (cmd->plist) {
RListIter *iter;
RCorePlugin *plugin;

View File

@ -30,13 +30,13 @@ R_API void r_core_undo_free(RCoreUndo *cu) {
}
R_API void r_core_undo_push(RCore *core, RCoreUndo *cu) {
r_return_if_fail (core && cu);
R_RETURN_IF_FAIL (core && cu);
r_list_append (core->undos, cu);
core->undoindex ++;
}
R_API void r_core_undo_pop(RCore *core) {
r_return_if_fail (core);
R_RETURN_IF_FAIL (core);
RCoreUndo *undo = r_list_pop (core->undos);
if (undo) {
r_core_cmd0 (core, undo->revert);

View File

@ -1646,7 +1646,7 @@ static void ds_show_xrefs(RDisasmState *ds) {
}
static void ds_atabs_option(RDisasmState *ds) {
r_return_if_fail (ds);
R_RETURN_IF_FAIL (ds);
int n, i = 0, word = 0;
bool comma = false;
int brackets = 0;
@ -4635,7 +4635,7 @@ static inline bool is_filtered_flag(RDisasmState *ds, const char *name) {
/* convert numeric value in opcode to ascii char or number */
static void ds_print_ptr(RDisasmState *ds, int len, int idx) {
r_return_if_fail (ds);
R_RETURN_IF_FAIL (ds);
RCore *core = ds->core;
const bool be = R_ARCH_CONFIG_IS_BIG_ENDIAN (core->rasm->config);
ut64 p = ds->analop.ptr;

View File

@ -1229,7 +1229,7 @@ static GH (RTcache)* GH (tcache_new) (RCore *core) {
}
static void GH (tcache_free) (GH (RTcache)* tcache) {
r_return_if_fail (tcache);
R_RETURN_IF_FAIL (tcache);
tcache->type == NEW
? free (tcache->RHeapTcache.heap_tcache)
: free (tcache->RHeapTcache.heap_tcache_pre_230);
@ -1265,7 +1265,7 @@ static GHT GH (tcache_get_entry) (GH (RTcache)* tcache, int index) {
}
static void GH (tcache_print) (RCore *core, GH (RTcache)* tcache, bool demangle) {
r_return_if_fail (core && tcache);
R_RETURN_IF_FAIL (core && tcache);
GHT tcache_fd = GHT_MAX;
GHT tcache_tmp = GHT_MAX;
RConsPrintablePalette *pal = &r_cons_singleton ()->context->pal;
@ -1305,7 +1305,7 @@ static void GH (tcache_print) (RCore *core, GH (RTcache)* tcache, bool demangle)
}
static void GH (print_tcache_instance)(RCore *core, GHT m_arena, MallocState *main_arena, bool demangle) {
r_return_if_fail (core && core->dbg && core->dbg->maps);
R_RETURN_IF_FAIL (core && core->dbg && core->dbg->maps);
const bool tcache = r_config_get_b (core->config, "dbg.glibc.tcache");
if (!tcache || m_arena == GHT_MAX) {
@ -1373,7 +1373,7 @@ static void GH (print_tcache_instance)(RCore *core, GHT m_arena, MallocState *ma
static void GH(print_heap_segment)(RCore *core, MallocState *main_arena,
GHT m_arena, GHT m_state, GHT global_max_fast, int format_out) {
r_return_if_fail (core && main_arena);
R_RETURN_IF_FAIL (core && main_arena);
if (!core->dbg || !core->dbg->maps) {
return;
}

View File

@ -245,7 +245,7 @@ static bool GetNextHeapBlock(PDEBUG_HEAP_INFORMATION heapInfo, PHeapBlock hb) {
}
static void free_extra_info(PDEBUG_HEAP_INFORMATION heap) {
r_return_if_fail (heap);
R_RETURN_IF_FAIL (heap);
HeapBlock hb;
if (GetFirstHeapBlock (heap, &hb)) {
do {

View File

@ -265,7 +265,7 @@ R_API void r_core_project_execute_cmds(RCore *core, const char *prjfile) {
char *str = r_core_project_notes_file (core, prjfile);
char *data = r_file_slurp (str, NULL);
free (str);
r_return_if_fail (data);
R_RETURN_IF_FAIL (data);
Output out;
out.fout = NULL;
out.cout = r_strbuf_new (NULL);

View File

@ -555,19 +555,19 @@ R_API void r_core_task_sync_begin(RCoreTaskScheduler *scheduler) {
/* end running stuff synchronously, initially started with r_core_task_sync_begin() */
R_API void r_core_task_sync_end(RCoreTaskScheduler *scheduler) {
r_return_if_fail (scheduler);
R_RETURN_IF_FAIL (scheduler);
task_end (scheduler->main_task);
}
/* To be called from within a task.
* Begin sleeping and schedule other tasks until r_core_task_sleep_end() is called. */
R_API void r_core_task_sleep_begin(RCoreTask *task) {
r_return_if_fail (task);
R_RETURN_IF_FAIL (task);
r_core_task_schedule (task, R_CORE_TASK_STATE_SLEEPING);
}
R_API void r_core_task_sleep_end(RCoreTask *task) {
r_return_if_fail (task);
R_RETURN_IF_FAIL (task);
task_wakeup (task);
}

View File

@ -4511,7 +4511,7 @@ static void show_cursor(RCore *core) {
}
R_IPI void visual_refresh(RCore *core) {
r_return_if_fail (core);
R_RETURN_IF_FAIL (core);
char *cmd_str = NULL;
r_print_set_cursor (core->print, core->print->cur_enabled, core->print->ocur, core->print->cur);
core->cons->blankline = true;

View File

@ -59,7 +59,7 @@ static char *__core_visual_tab_string(RCore *core, const char *kolor) {
}
static void visual_tabset(RCore *core, RCoreVisualTab *tab) {
r_return_if_fail (core && tab);
R_RETURN_IF_FAIL (core && tab);
r_core_seek (core, tab->offset, true);
core->visual.printidx = tab->printidx;
@ -88,7 +88,7 @@ static void visual_tabset(RCore *core, RCoreVisualTab *tab) {
}
static void visual_tabget(RCore *core, RCoreVisualTab *tab) {
r_return_if_fail (core && tab);
R_RETURN_IF_FAIL (core && tab);
tab->offset = core->offset;
tab->printidx = core->visual.printidx;

View File

@ -3,7 +3,7 @@
#include <r_core.h>
R_API void r_core_vmark_reset(RCore *core) {
r_return_if_fail (core);
R_RETURN_IF_FAIL (core);
size_t i;
for (i = 0; i < UT8_MAX; i++) {
core->marks[i].addr = UT64_MAX;
@ -63,7 +63,7 @@ R_API bool r_core_vmark_dump(RCore *core, int mode) {
}
R_API void r_core_vmark_set(RCore *core, ut8 ch, ut64 addr, int x, int y) {
r_return_if_fail (core);
R_RETURN_IF_FAIL (core);
VisualMark *vm = &core->marks[ch];
vm->addr = addr;
vm->x = x;
@ -71,12 +71,12 @@ R_API void r_core_vmark_set(RCore *core, ut8 ch, ut64 addr, int x, int y) {
}
R_API void r_core_vmark_del(RCore *core, ut8 ch) {
r_return_if_fail (core);
R_RETURN_IF_FAIL (core);
core->marks[ch].addr = UT64_MAX;
}
R_API void r_core_vmark(RCore *core, ut8 ch) {
r_return_if_fail (core);
R_RETURN_IF_FAIL (core);
if (IS_DIGIT (ch)) {
ch += ASCII_MAX + 1;
}
@ -84,7 +84,7 @@ R_API void r_core_vmark(RCore *core, ut8 ch) {
}
R_API void r_core_vmark_seek(RCore *core, ut8 ch, RAGraph *g) {
r_return_if_fail (core);
R_RETURN_IF_FAIL (core);
VisualMark *vm = &core->marks[ch];
if (vm->addr != UT64_MAX) {
r_core_seek (core, vm->addr, true);

View File

@ -180,14 +180,14 @@ static int cmpname(const void *_a, const void *_b) {
}
static void __sort(RCoreVisualViewGraph *status, RList *list) {
r_return_if_fail (status && list);
R_RETURN_IF_FAIL (status && list);
RListComparator cmp = (status->cur_sort == SORT_ADDRESS)? cmpaddr: cmpname;
list->sorted = false;
r_list_sort (list, cmp);
}
static void __toggleSort(RCoreVisualViewGraph *status) {
r_return_if_fail (status);
R_RETURN_IF_FAIL (status);
status->cur_sort = (status->cur_sort == SORT_ADDRESS)? SORT_NAME: SORT_ADDRESS;
__sort (status, status->mainCol);
__sort (status, status->refsCol);

View File

@ -139,7 +139,7 @@ static void render(SlidesState *state, RCore *core, RList *list, int mode, int p
}
static void render_title(int page, int mode, int total) {
r_return_if_fail (page >= 0 && mode >= 0 && total >= 0);
R_RETURN_IF_FAIL (page >= 0 && mode >= 0 && total >= 0);
r_cons_gotoxy (0, 0);
r_cons_printf ("%s%s%s\r [r2slides] [%s:%d/%d]",
Color_BLACK, Color_BGYELLOW, R_CONS_CLEAR_LINE,
@ -147,7 +147,7 @@ static void render_title(int page, int mode, int total) {
}
R_API void r_core_visual_slides(RCore *core, const char *file) {
r_return_if_fail (core && file);
R_RETURN_IF_FAIL (core && file);
if (!r_config_get_b (core->config, "scr.interactive")) {
R_LOG_ERROR ("Requires scr.interactive=true");
return;

View File

@ -466,7 +466,7 @@ static void SHA256_Transform(RSha256Context *context, const ut32 *data) {
#endif /* SHA2_UNROLL_TRANSFORM */
R_IPI void r_sha256_update(RSha256Context *context, const ut8 *data, size_t len) {
r_return_if_fail (context);
R_RETURN_IF_FAIL (context);
if (!data || len == 0) {
return;
}
@ -504,7 +504,7 @@ R_IPI void r_sha256_update(RSha256Context *context, const ut8 *data, size_t len)
}
R_IPI void r_sha256_final(ut8 digest[R_SHA256_DIGEST_LENGTH], RSha256Context *context) {
r_return_if_fail (context);
R_RETURN_IF_FAIL (context);
ut32 *d = (ut32 *) digest;
unsigned int usedspace;
@ -932,7 +932,7 @@ R_IPI char *r_sha512_data(const ut8 *data, size_t len, char digest[R_SHA512_DIGE
/*** SHA-384: *********************************************************/
R_IPI void r_sha384_init(RSha384Context *context) {
r_return_if_fail (context);
R_RETURN_IF_FAIL (context);
memcpy (context->state, sha384_initial_hash_value, R_SHA512_DIGEST_LENGTH);
memset (context->buffer, 0, R_SHA384_BLOCK_LENGTH);
context->bitcount[0] = context->bitcount[1] = 0;

View File

@ -209,7 +209,7 @@ static bool esilbreak_reg_write(REsil *esil, const char *regname, ut64 *num) {
}
R_API void r_debug_esil_prestep(RDebug *d, int p) {
r_return_if_fail (d);
R_RETURN_IF_FAIL (d);
prestep = p;
}

View File

@ -256,7 +256,7 @@ static void print_debug_maps_ascii_art(RDebug *dbg, RList *maps, ut64 addr, int
}
R_API void r_debug_map_list_visual(RDebug *dbg, ut64 addr, const char *input, int colors) {
r_return_if_fail (dbg);
R_RETURN_IF_FAIL (dbg);
int i;
for (i = 0; i < 2; i++) { // Iterate over dbg::maps and dbg::maps_user
RList *maps = (i == 0) ? dbg->maps : dbg->maps_user;

View File

@ -9,7 +9,7 @@
typedef RList* (*RDebugFrameCallback)(RDebug *dbg, ut64 at);
static void prepend_current_pc(RDebug *dbg, RList *list) {
r_return_if_fail (dbg);
R_RETURN_IF_FAIL (dbg);
if (!list) {
return;
}

View File

@ -289,7 +289,7 @@ static RTable *__create_window_table(void) {
}
static void __add_window_to_table(RTable *tbl, window *win) {
r_return_if_fail (tbl && win);
R_RETURN_IF_FAIL (tbl && win);
char *handle = r_str_newf ("0x%08"PFMT64x, (ut64)win->h);
char *pid = r_str_newf ("%lu", win->pid);
char *tid = r_str_newf ("%lu", win->tid);

View File

@ -129,7 +129,7 @@ R_API void r_egg_free(REgg *egg) {
}
R_API void r_egg_reset(REgg *egg) {
r_return_if_fail (egg);
R_RETURN_IF_FAIL (egg);
r_egg_lang_include_init (egg);
// TODO: use r_list_purge instead of free/new here
r_buf_free (egg->src);
@ -223,7 +223,7 @@ R_API bool r_egg_include(REgg *egg, const char *file, int format) {
}
R_API void r_egg_load(REgg *egg, const char *code, int format) {
r_return_if_fail (egg && code);
R_RETURN_IF_FAIL (egg && code);
switch (format) {
case 'a': // assembly
r_buf_append_bytes (egg->buf, (const ut8 *)code, strlen (code));
@ -235,7 +235,7 @@ R_API void r_egg_load(REgg *egg, const char *code, int format) {
}
R_API void r_egg_syscall(REgg *egg, const char *arg, ...) {
r_return_if_fail (egg);
R_RETURN_IF_FAIL (egg);
RSyscallItem *item = r_syscall_get (egg->syscall,
r_syscall_get_num (egg->syscall, arg), -1);
if (!strcmp (arg, "close")) {
@ -319,7 +319,7 @@ R_API void r_egg_if(REgg *egg, const char *reg, char cmp, int v) {
}
R_API void r_egg_printf(REgg *egg, const char *fmt, ...) {
r_return_if_fail (egg && fmt);
R_RETURN_IF_FAIL (egg && fmt);
va_list ap;
int len;
char buf[1024];

View File

@ -22,7 +22,7 @@ static REsilHandler *_get_syscall(REsil *esil, ut32 sysc_num) {
}
R_API void r_esil_handlers_init(REsil *esil) {
r_return_if_fail (esil);
R_RETURN_IF_FAIL (esil);
esil->interrupts = dict_new (sizeof (ut32), free);
if (!esil->interrupts) {
return;
@ -67,7 +67,7 @@ R_API REsilHandlerCB r_esil_get_interrupt(REsil *esil, ut32 intr_num) {
}
R_API void r_esil_del_interrupt(REsil *esil, ut32 intr_num) {
r_return_if_fail (esil && esil->interrupts);
R_RETURN_IF_FAIL (esil && esil->interrupts);
if (intr_num == 0) {
R_FREE (esil->intr0)
} else {
@ -94,7 +94,7 @@ R_API REsilHandlerCB r_esil_get_syscall(REsil *esil, ut32 sysc_num) {
}
R_API void r_esil_del_syscall(REsil *esil, ut32 sysc_num) {
r_return_if_fail (esil && esil->syscalls);
R_RETURN_IF_FAIL (esil && esil->syscalls);
if (sysc_num == 0) {
R_FREE (esil->sysc0)
} else {

View File

@ -10,7 +10,7 @@ static REsilPlugin *esil_static_plugins[] = {
};
R_API void r_esil_plugins_init(REsil *esil) {
r_return_if_fail (esil);
R_RETURN_IF_FAIL (esil);
esil->plugins = r_list_new ();
esil->active_plugins = r_list_new ();
size_t i = 0;
@ -21,7 +21,7 @@ R_API void r_esil_plugins_init(REsil *esil) {
}
R_API void r_esil_plugins_fini(REsil *esil) {
r_return_if_fail (esil);
R_RETURN_IF_FAIL (esil);
if (!esil->plugins || !esil->active_plugins) {
return;
}
@ -43,7 +43,7 @@ R_API bool r_esil_plugin_add(REsil *esil, REsilPlugin *plugin) {
}
R_API void r_esil_plugin_del(REsil *esil, const char *name) {
r_return_if_fail (esil && esil->plugins && name);
R_RETURN_IF_FAIL (esil && esil->plugins && name);
r_esil_plugin_deactivate(esil, name);
RListIter *iter;
REsilPlugin *ep;
@ -105,7 +105,7 @@ R_API bool r_esil_plugin_activate(REsil *esil, const char *name) {
}
R_API void r_esil_plugin_deactivate(REsil *esil, const char *name) {
r_return_if_fail (esil && esil->active_plugins && name);
R_RETURN_IF_FAIL (esil && esil->active_plugins && name);
RListIter *iter;
REsilActivePlugin *eap;
r_list_foreach (esil->active_plugins, iter, eap) {

View File

@ -104,7 +104,7 @@ R_API void r_esil_trace_free(REsilTrace *trace) {
}
static void add_reg_change(REsilTrace *trace, RRegItem *ri, ut64 data) {
r_return_if_fail (trace && ri);
R_RETURN_IF_FAIL (trace && ri);
ut64 addr = ri->offset | (ri->arena << 16);
RVector *vreg = ht_up_find (trace->registers, addr, NULL);
if (!vreg) {
@ -120,7 +120,7 @@ static void add_reg_change(REsilTrace *trace, RRegItem *ri, ut64 data) {
}
static void add_mem_change(REsilTrace *trace, ut64 addr, ut8 data) {
r_return_if_fail (trace);
R_RETURN_IF_FAIL (trace);
RVector *vmem = ht_up_find (trace->memory, addr, NULL);
if (!vmem) {
vmem = r_vector_new (sizeof (REsilMemChange), NULL, NULL);
@ -290,7 +290,7 @@ static bool trace_hook_mem_write(REsil *esil, ut64 addr, const ut8 *buf, int len
}
R_API void r_esil_trace_op(REsil *esil, RAnalOp *op) {
r_return_if_fail (esil && op);
R_RETURN_IF_FAIL (esil && op);
const char *expr = r_strbuf_get (&op->esil);
if (!esil->trace) {
esil->trace = r_esil_trace_new (esil);
@ -435,7 +435,7 @@ static void print_access(PrintfCallback p, int idx, REsilTraceAccess *a, int for
}
R_API void r_esil_trace_list(REsil *esil, int format) {
r_return_if_fail (esil && esil->anal);
R_RETURN_IF_FAIL (esil && esil->anal);
D {
ut32 vec_idx = RVecAccess_length (&esil->trace->db.accesses);
int i;

View File

@ -33,7 +33,7 @@ R_API RList *r_flag_tags_list(RFlag *f, const char *name) {
R_API void r_flag_tags_reset(RFlag *f, const char *name) {
// TODO: use name
r_return_if_fail (f);
R_RETURN_IF_FAIL (f);
sdb_reset (f->tags);
}

View File

@ -290,7 +290,7 @@ R_API RFSFile* r_fs_open(RFS* fs, const char* p, bool create) {
// NOTE: close doesnt free
R_API void r_fs_close(RFS* fs, RFSFile* file) {
r_return_if_fail (fs && file);
R_RETURN_IF_FAIL (fs && file);
R_FREE (file->data);
if (file->p && file->p->close) {
file->p->close (file);
@ -686,7 +686,7 @@ R_API char* r_fs_name(RFS* fs, ut64 offset) {
}
R_API void r_fs_view(RFS* fs, int view) {
r_return_if_fail (fs);
R_RETURN_IF_FAIL (fs);
fs->view = view;
}

View File

@ -140,9 +140,9 @@ R_API void r_assert_log(RLogLevel level, const char *origin, const char *fmt, ..
}
#endif
#define R_RETURN_IF_FAIL(x) r_return_if_fail(x)
#define R_RETURN_VAL_IF_FAIL(x,y) r_return_val_if_fail(x,y)
#define R_RETURN_IF_REACHED() r_return_if_reached()
#define R_RETURN_VAL_IF_REACHED(x) r_return_val_if_reached(x)
#define R_RETURN_IF_FAIL(x) r_return_if_fail (x)
#define R_RETURN_VAL_IF_FAIL(x,y) r_return_val_if_fail (x,y)
#define R_RETURN_IF_REACHED() r_return_if_reached ()
#define R_RETURN_VAL_IF_REACHED(x) r_return_val_if_reached (x)
#endif

View File

@ -174,7 +174,7 @@ extern "C" {
typedef int (*R_VEC_CMP(vec_type))(type const *a, type const *b); \
typedef int (*R_VEC_FIND_CMP(vec_type))(type const *a, const void *b); \
static inline R_MAYBE_UNUSED void R_VEC_FUNC(vec_type, init)(vec_type *vec) { \
r_return_if_fail (vec); \
R_RETURN_IF_FAIL (vec); \
memset (vec, 0, sizeof (vec_type)); \
} \
static inline R_MAYBE_UNUSED R_MUSTUSE vec_type *R_VEC_FUNC(vec_type, new)(void) { \
@ -185,7 +185,7 @@ extern "C" {
return vec; \
} \
static inline R_MAYBE_UNUSED void R_VEC_FUNC(vec_type, swap)(vec_type *vec_a, vec_type *vec_b) { \
r_return_if_fail (vec_a && vec_b); \
R_RETURN_IF_FAIL (vec_a && vec_b); \
if (R_LIKELY (vec_a != vec_b)) { \
const vec_type tmp = *vec_a; \
*vec_a = *vec_b; \
@ -193,7 +193,7 @@ extern "C" {
} \
} \
static inline R_MAYBE_UNUSED void R_VEC_FUNC(vec_type, clear)(vec_type *vec) { \
r_return_if_fail (vec); \
R_RETURN_IF_FAIL (vec); \
R_MAYBE_GENERATE(has_fini, \
type *iter; \
R_VEC_FOREACH (vec, iter) { \
@ -203,7 +203,7 @@ extern "C" {
vec->_end = vec->_start; \
} \
static inline R_MAYBE_UNUSED void R_VEC_FUNC(vec_type, fini)(vec_type *vec) { \
r_return_if_fail (vec); \
R_RETURN_IF_FAIL (vec); \
R_MAYBE_GENERATE(has_fini, \
type *iter; \
R_VEC_FOREACH (vec, iter) { \
@ -308,7 +308,7 @@ extern "C" {
return true; \
} \
static inline R_MAYBE_UNUSED void R_VEC_FUNC(vec_type, shrink_to_fit)(vec_type *vec) { \
r_return_if_fail (vec); \
R_RETURN_IF_FAIL (vec); \
const ut64 num_elems = R_VEC_FUNC (vec_type, length) (vec); \
const ut64 capacity = R_VEC_CAPACITY (vec); \
if (num_elems != capacity) { \
@ -326,7 +326,7 @@ extern "C" {
} \
} \
static inline R_MAYBE_UNUSED void R_VEC_FUNC(vec_type, push_back)(vec_type *vec, type const *value) { \
r_return_if_fail (vec && value); \
R_RETURN_IF_FAIL (vec && value); \
const ut64 num_elems = R_VEC_FUNC(vec_type, length) (vec); \
const ut64 capacity = R_VEC_CAPACITY (vec); \
if (R_UNLIKELY (num_elems == capacity)) { \
@ -349,7 +349,7 @@ extern "C" {
return ptr; \
} \
static inline R_MAYBE_UNUSED void R_VEC_FUNC(vec_type, push_front)(vec_type *vec, type *value) { \
r_return_if_fail (vec && value); \
R_RETURN_IF_FAIL (vec && value); \
const ut64 num_elems = R_VEC_FUNC(vec_type, length) (vec); \
const ut64 capacity = R_VEC_CAPACITY (vec); \
if (R_UNLIKELY (num_elems == capacity)) { \
@ -373,7 +373,7 @@ extern "C" {
return vec->_start; \
} \
static inline R_MAYBE_UNUSED void R_VEC_FUNC(vec_type, append)(vec_type *vec, const vec_type *values, R_VEC_COPY(vec_type) copy_fn) { \
r_return_if_fail (vec && values); \
R_RETURN_IF_FAIL (vec && values); \
const ut64 num_elems = R_VEC_FUNC(vec_type, length) (vec); \
const ut64 capacity = R_VEC_CAPACITY (vec); \
const ut64 num_values = R_VEC_FUNC(vec_type, length) (values); \
@ -393,7 +393,7 @@ extern "C" {
} \
} \
static inline R_MAYBE_UNUSED void R_VEC_FUNC(vec_type, remove)(vec_type *vec, ut64 index) { \
r_return_if_fail (vec && vec->_start != vec->_end && index < (ut64)(size_t)(vec->_start - vec->_end)); \
R_RETURN_IF_FAIL (vec && vec->_start != vec->_end && index < (ut64)(size_t)(vec->_start - vec->_end)); \
type *ptr = R_VEC_FUNC(vec_type, at) (vec, index); \
const ut64 num_elems_after = vec->_end - ptr; \
R_MAYBE_GENERATE(has_fini, fini_fn (ptr)); \
@ -404,13 +404,13 @@ extern "C" {
R_VEC_FUNC(vec_type, remove) (vec, 0); \
} \
static inline R_MAYBE_UNUSED void R_VEC_FUNC(vec_type, pop_back)(vec_type *vec) { \
r_return_if_fail (vec && vec->_start != vec->_end); \
R_RETURN_IF_FAIL (vec && vec->_start != vec->_end); \
type *last = vec->_end - 1; \
R_MAYBE_GENERATE(has_fini, fini_fn (last)); \
vec->_end = last; \
} \
static inline R_MAYBE_UNUSED void R_VEC_FUNC(vec_type, erase_back)(vec_type *vec, type *iter) { \
r_return_if_fail (vec && iter >= vec->_start && iter <= vec->_end); \
R_RETURN_IF_FAIL (vec && iter >= vec->_start && iter <= vec->_end); \
if (iter == vec->_end) { \
return; \
} \
@ -468,7 +468,7 @@ extern "C" {
return first; \
} \
static inline R_MAYBE_UNUSED void R_VEC_FUNC(vec_type, sort)(vec_type *vec, R_VEC_CMP(vec_type) cmp_fn) { \
r_return_if_fail (vec && cmp_fn); \
R_RETURN_IF_FAIL (vec && cmp_fn); \
if (R_VEC_FUNC(vec_type, empty) (vec)) { \
return; \
} \
@ -476,7 +476,7 @@ extern "C" {
(int (*)(const void *, const void *)) cmp_fn); \
} \
static inline R_MAYBE_UNUSED void R_VEC_FUNC(vec_type, uniq)(vec_type *vec, R_VEC_CMP(vec_type) cmp_fn) { \
r_return_if_fail (vec && cmp_fn); \
R_RETURN_IF_FAIL (vec && cmp_fn); \
if (vec->_start == vec->_end) { \
return; \
} \

View File

@ -242,7 +242,7 @@ static inline void *r_pvector_at(const RPVector *vec, size_t index) {
}
static inline void r_pvector_set(RPVector *vec, size_t index, void *e) {
r_return_if_fail (vec && index < vec->v.len);
R_RETURN_IF_FAIL (vec && index < vec->v.len);
((void **)vec->v.a)[index] = e;
}

View File

@ -13,7 +13,7 @@ R_API RIO* r_io_new(void) {
}
R_API void r_io_init(RIO* io) {
r_return_if_fail (io);
R_RETURN_IF_FAIL (io);
io->addrbytes = 1;
io->overlay = true;
io->cb_printf = printf;
@ -174,7 +174,7 @@ R_API bool r_io_reopen(RIO* io, int fd, int perm, int mode) {
#endif
R_API void r_io_close_all(RIO* io) {
r_return_if_fail (io);
R_RETURN_IF_FAIL (io);
r_io_desc_fini (io);
r_io_map_fini (io);
ls_free (io->plugins);
@ -468,7 +468,7 @@ R_API ut64 r_io_v2p(RIO *io, ut64 va) {
}
R_API void r_io_bind(RIO *io, RIOBind *bnd) {
r_return_if_fail (io && bnd);
R_RETURN_IF_FAIL (io && bnd);
bnd->io = io;
bnd->init = true;
@ -571,7 +571,7 @@ static bool drain_cb(void *user, void *data, ut32 id) {
}
R_API void r_io_drain_overlay(RIO *io) {
r_return_if_fail (io);
R_RETURN_IF_FAIL (io);
r_id_storage_foreach (io->maps, drain_cb, NULL);
}
@ -654,7 +654,7 @@ R_API void *r_io_ptrace_func(RIO *io, void *(*func)(void *), void *user) {
#endif
R_API void r_io_fini(RIO* io) {
r_return_if_fail (io);
R_RETURN_IF_FAIL (io);
r_io_bank_fini (io);
r_io_map_fini (io);
r_io_desc_cache_fini_all (io);

View File

@ -31,7 +31,7 @@ R_API RIOBank *r_io_bank_new(const char *name) {
}
R_API void r_io_bank_clear(RIOBank *bank) {
r_return_if_fail (bank);
R_RETURN_IF_FAIL (bank);
while (!r_queue_is_empty (bank->todo)) {
free (r_queue_dequeue (bank->todo));
}
@ -51,7 +51,7 @@ R_API void r_io_bank_free(RIOBank *bank) {
}
R_API void r_io_bank_init(RIO *io) {
r_return_if_fail (io);
R_RETURN_IF_FAIL (io);
r_io_bank_fini (io);
io->banks = r_id_storage_new (0, UT32_MAX);
}
@ -62,7 +62,7 @@ static bool _bank_free_cb(void *user, void *data, ut32 id) {
}
R_API void r_io_bank_fini(RIO *io) {
r_return_if_fail (io);
R_RETURN_IF_FAIL (io);
if (io->banks) {
r_id_storage_foreach (io->banks, _bank_free_cb, NULL);
r_id_storage_free (io->banks);
@ -1057,7 +1057,7 @@ R_API RIOMap *r_io_bank_get_map_at(RIO *io, const ut32 bankid, ut64 addr) {
// deletes map with mapid from bank with bankid
R_API void r_io_bank_del_map(RIO *io, const ut32 bankid, const ut32 mapid) {
r_return_if_fail (io);
R_RETURN_IF_FAIL (io);
// no need to check for mapref here, since this is "just" deleting
RIOBank *bank = r_io_bank_get (io, bankid);
RIOMap *map = r_io_map_get (io, mapid); //is this needed?
@ -1078,7 +1078,7 @@ R_API void r_io_bank_del_map(RIO *io, const ut32 bankid, const ut32 mapid) {
}
R_API void r_io_bank_del(RIO *io, const ut32 bankid) {
r_return_if_fail (io);
R_RETURN_IF_FAIL (io);
r_id_storage_delete (io->banks, bankid);
if (io->bank == bankid) {
io->bank = r_io_bank_first (io);
@ -1087,7 +1087,7 @@ R_API void r_io_bank_del(RIO *io, const ut32 bankid) {
// merges nearby submaps, that have a map ref to the same map, and free unneeded tree nodes
R_API void r_io_bank_drain(RIO *io, const ut32 bankid) {
r_return_if_fail (io);
R_RETURN_IF_FAIL (io);
RIOBank *bank = r_io_bank_get (io, bankid);
if (!bank || !bank->drain_me) {
return;

View File

@ -51,14 +51,14 @@ static void _io_cache_item_free(void *data) {
}
R_API void r_io_cache_init(RIO *io) {
r_return_if_fail (io);
R_RETURN_IF_FAIL (io);
io->cache.layers = r_list_newf (iocache_layer_free);
io->cache.mode = R_PERM_R | R_PERM_W;
r_io_cache_push (io);
}
R_API void r_io_cache_fini(RIO *io) {
r_return_if_fail (io);
R_RETURN_IF_FAIL (io);
r_list_free (io->cache.layers);
}
@ -77,7 +77,7 @@ R_API bool r_io_cache_empty(RIO *io) {
}
R_API void r_io_cache_reset(RIO *io) {
r_return_if_fail (io);
R_RETURN_IF_FAIL (io);
ut32 mode = io->cache.mode;
r_io_cache_fini (io);
r_io_cache_init (io);
@ -340,7 +340,7 @@ R_API int r_io_cache_invalidate(RIO *io, ut64 from, ut64 to, bool many) {
// this uses closed boundary input
R_API void r_io_cache_commit(RIO *io, ut64 from, ut64 to, bool many) {
r_return_if_fail (io && from <= to);
R_RETURN_IF_FAIL (io && from <= to);
RListIter *iter;
RIOCacheLayer *layer;
r_list_foreach (io->cache.layers, iter, layer) {
@ -427,7 +427,7 @@ static void list(RIO *io, RIOCacheLayer *layer, PJ *pj, int rad) {
}
R_API void r_io_cache_list(RIO *io, int rad, bool many) {
r_return_if_fail (io);
R_RETURN_IF_FAIL (io);
if (r_list_empty (io->cache.layers)) {
return;
}

View File

@ -424,7 +424,7 @@ static bool desc_fini_cb(void* user, void* data, ut32 id) {
//closes all descs and frees all descs and io->files
R_IPI void r_io_desc_fini(RIO* io) {
r_return_if_fail (io);
R_RETURN_IF_FAIL (io);
if (io->files) {
r_id_storage_foreach (io->files, desc_fini_cb, io);
r_id_storage_free (io->files);

View File

@ -103,7 +103,7 @@ static bool _map_free_cb(void *user, void *data, ut32 id) {
}
R_API void r_io_map_init(RIO* io) {
r_return_if_fail (io);
R_RETURN_IF_FAIL (io);
if (io->maps) {
r_id_storage_foreach (io->maps, _map_free_cb, NULL);
r_id_storage_free (io->maps);
@ -259,7 +259,7 @@ R_API void r_io_map_reset(RIO* io) {
}
R_API void r_io_map_del(RIO *io, ut32 id) {
r_return_if_fail (io && io->maps);
R_RETURN_IF_FAIL (io && io->maps);
RIOMap *map = (RIOMap *)r_id_storage_get (io->maps, id);
if (!map) {
return;
@ -329,7 +329,7 @@ R_API bool r_io_map_priorize_for_fd(RIO *io, int fd) {
//may fix some inconsistencies in io->maps
R_API void r_io_map_cleanup(RIO* io) {
r_return_if_fail (io);
R_RETURN_IF_FAIL (io);
//remove all maps if no descs exist
if (!io->files) {
r_io_map_fini (io);
@ -345,7 +345,7 @@ static bool _clear_banks_cb(void *user, void *data, ut32 id) {
}
R_API void r_io_map_fini(RIO* io) {
r_return_if_fail (io);
R_RETURN_IF_FAIL (io);
if (io->banks) {
r_id_storage_foreach (io->banks, _clear_banks_cb, NULL);
}
@ -357,13 +357,13 @@ R_API void r_io_map_fini(RIO* io) {
}
R_API void r_io_map_set_name(RIOMap* map, const char* name) {
r_return_if_fail (map && name);
R_RETURN_IF_FAIL (map && name);
free (map->name);
map->name = strdup (name);
}
R_API void r_io_map_del_name(RIOMap* map) {
r_return_if_fail (map);
R_RETURN_IF_FAIL (map);
R_FREE (map->name);
}
@ -493,7 +493,7 @@ static int _overlay_chunk_find(void *incoming, void *in, void *user) {
}
R_API void r_io_map_read_from_overlay(RIOMap *map, ut64 addr, ut8 *buf, int len) {
r_return_if_fail (map && buf);
R_RETURN_IF_FAIL (map && buf);
if (!map->overlay || len < 1 || addr > r_io_map_to (map)) {
return;
}
@ -676,7 +676,7 @@ R_IPI bool io_map_get_overlay_intersects(RIOMap *map, RQueue *q, ut64 addr, int
}
R_API void r_io_map_drain_overlay(RIOMap *map) {
r_return_if_fail (map);
R_RETURN_IF_FAIL (map);
if (!map->overlay || map->overlay->size < 2) {
return;
}

View File

@ -31,7 +31,7 @@ static inline ut64 _io_malloc_off(RIODesc *desc) {
}
static inline void _io_malloc_set_off(RIODesc *desc, ut64 off) {
r_return_if_fail (desc);
R_RETURN_IF_FAIL (desc);
RIOMalloc *mal = (RIOMalloc*)desc->data;
mal->offset = off;
}

View File

@ -71,7 +71,7 @@ const ut64 cleanup_masks[] = {
};
static void pcache_kv_free(HtUPKv *kv) {
r_return_if_fail (kv);
R_RETURN_IF_FAIL (kv);
free (kv->value);
}

View File

@ -93,7 +93,7 @@ static bool plugin_manager_init(QjsPluginManager *pm, RCore *core, JSRuntime *rt
}
static void plugin_manager_add_core_plugin(QjsPluginManager *pm, const char *name, JSContext *ctx, JSValue func) {
r_return_if_fail (pm);
R_RETURN_IF_FAIL (pm);
QjsCorePlugin *cp = RVecCorePlugin_emplace_back (&pm->core_plugins);
if (cp) {
@ -192,7 +192,7 @@ static bool plugin_manager_remove_core_plugin(QjsPluginManager *pm, const char *
static void plugin_manager_add_arch_plugin(QjsPluginManager *pm, const char *name,
const char *arch, JSContext *ctx, JSValue decode_func) {
r_return_if_fail (pm);
R_RETURN_IF_FAIL (pm);
QjsArchPlugin *ap = RVecArchPlugin_emplace_back (&pm->arch_plugins);
if (ap) {

View File

@ -938,7 +938,7 @@ static char *get_graph_commands(RCore *c, ut64 off) {
}
static void __generate_graph(RCore *c, ut64 off) {
r_return_if_fail (c);
R_RETURN_IF_FAIL (c);
char *ptr = get_graph_commands (c, off);
char *str = ptr;
r_cons_break_push (NULL, NULL);

View File

@ -130,7 +130,7 @@ R_API bool r_reg_set_bytes(RReg *reg, int type, const ut8 *buf, const int len) {
}
R_API void r_reg_fit_arena(RReg *reg) {
r_return_if_fail (reg);
R_RETURN_IF_FAIL (reg);
RRegArena *arena;
RListIter *iter;
RRegItem *r;
@ -200,7 +200,7 @@ R_API void r_reg_arena_free(RRegArena *ra) {
}
R_API void r_reg_arena_swap(RReg *reg, int copy) {
r_return_if_fail (reg);
R_RETURN_IF_FAIL (reg);
/* XXX: swap current arena to head(previous arena) */
int i;
for (i = 0; i < R_REG_TYPE_LAST; i++) {
@ -221,7 +221,7 @@ R_API void r_reg_arena_swap(RReg *reg, int copy) {
}
R_API void r_reg_arena_pop(RReg *reg) {
r_return_if_fail (reg);
R_RETURN_IF_FAIL (reg);
RRegArena *a;
int i;
for (i = 0; i < R_REG_TYPE_LAST; i++) {
@ -268,7 +268,7 @@ R_API int r_reg_arena_push(RReg *reg) {
}
R_API void r_reg_arena_zero(RReg *reg) {
r_return_if_fail (reg);
R_RETURN_IF_FAIL (reg);
int i;
for (i = 0; i < R_REG_TYPE_LAST; i++) {
RRegArena *a = reg->regset[i].arena;
@ -296,7 +296,7 @@ R_API ut8 *r_reg_arena_peek(RReg *reg, int *size) {
}
R_API void r_reg_arena_poke(RReg *reg, const ut8 *ret, int len) {
r_return_if_fail (reg && ret);
R_RETURN_IF_FAIL (reg && ret);
RRegSet *regset = r_reg_regset_get (reg, R_REG_TYPE_GPR);
if (!ret || !regset || !regset->arena || !regset->arena->bytes) {
return;
@ -356,7 +356,7 @@ R_API int r_reg_arena_set_bytes(RReg *reg, const char *str) {
}
R_API void r_reg_arena_shrink(RReg *reg) {
r_return_if_fail (reg);
R_RETURN_IF_FAIL (reg);
int i;
const size_t bytes_size = 1024;
for (i = 0; i < R_REG_TYPE_LAST; i++) {

View File

@ -220,7 +220,7 @@ R_API RRegFlags *r_reg_cond_retrieve(RReg *r, RRegFlags *f) {
}
R_API void r_reg_cond_apply(RReg *r, RRegFlags *f) {
r_return_if_fail (r && f);
R_RETURN_IF_FAIL (r && f);
r_reg_cond_set (r, "sign", f->s);
r_reg_cond_set (r, "zero", f->z);
r_reg_cond_set (r, "carry", f->c);

View File

@ -205,7 +205,7 @@ R_API const char *r_reg_get_role(int role) {
}
R_API void r_reg_free_internal(RReg *reg, bool init) {
r_return_if_fail (reg);
R_RETURN_IF_FAIL (reg);
ut32 i;
R_FREE (reg->reg_profile_str);
R_FREE (reg->reg_profile_cmt);
@ -251,7 +251,7 @@ static int regcmp(RRegItem *a, RRegItem *b) {
}
R_API void r_reg_reindex(RReg *reg) {
r_return_if_fail (reg);
R_RETURN_IF_FAIL (reg);
int i, index;
RListIter *iter;
RRegItem *r;
@ -349,7 +349,7 @@ R_API RRegItem *r_reg_item_clone(RRegItem *r) {
// TODO rename regset to reggroup . R_API void r_reg_group_copy(RRegGroup *d, RRegGroup *s) ..
R_API void r_reg_set_copy(RRegSet *d, RRegSet *s) {
r_return_if_fail (d && s);
R_RETURN_IF_FAIL (d && s);
d->cur = NULL; // TODO. not yet implemented
d->arena = r_reg_arena_clone (s->arena);
d->maskregstype = s->maskregstype;

View File

@ -109,7 +109,7 @@ R_API RRunProfile *r_run_new(R_NULLABLE const char *str) {
}
R_API void r_run_reset(RRunProfile *p) {
r_return_if_fail (p);
R_RETURN_IF_FAIL (p);
int i;
for (i = 0; i < R_RUN_PROFILE_NARGS; i++) {
R_FREE (p->_args[i]);

View File

@ -119,7 +119,7 @@ R_API RSocketHTTPRequest *r_socket_http_accept(RSocket *s, RSocketHTTPOptions *s
}
R_API void r_socket_http_response(RSocketHTTPRequest *rs, int code, const char *out, int len, const char *headers) {
r_return_if_fail (rs);
R_RETURN_IF_FAIL (rs);
const char *strcode = \
code==200?"ok":
code==301?"Moved permanently":

View File

@ -18,7 +18,7 @@ R_API RRealloc *r_realloc = realloc;
R_API RFree *r_free = free;
R_API void r_alloc_hooks(RMalloc m, RCalloc c, RRealloc r, RFree f) {
r_return_if_fail (m && c && r && f);
R_RETURN_IF_FAIL (m && c && r && f);
r_malloc = m;
r_calloc = c;
r_realloc = r;
@ -33,7 +33,7 @@ static RRealloc *_r_realloc = realloc;
static RFree *_r_free = free;
R_API void r_alloc_hooks(RMalloc m, RCalloc c, RRealloc r, RFree f) {
r_return_if_fail (m && c && r && f);
R_RETURN_IF_FAIL (m && c && r && f);
_r_malloc = m;
_r_calloc = c;
_r_realloc = r;

View File

@ -32,7 +32,7 @@ R_API void r_big_fini(RNumBig *b) {
}
R_API void r_big_from_int(RNumBig *b, st64 n) {
r_return_if_fail (b);
R_RETURN_IF_FAIL (b);
_r_big_zero_out (b);
b->sign = (n < 0)? -1: 1;
@ -58,7 +58,7 @@ R_API void r_big_from_int(RNumBig *b, st64 n) {
}
static void r_big_from_unsigned(RNumBig *b, ut64 v) {
r_return_if_fail (b);
R_RETURN_IF_FAIL (b);
_r_big_zero_out (b);
@ -107,8 +107,8 @@ R_API st64 r_big_to_int(RNumBig *b) {
}
R_API void r_big_from_hexstr(RNumBig *n, const char *str) {
r_return_if_fail (n);
r_return_if_fail (str);
R_RETURN_IF_FAIL (n);
R_RETURN_IF_FAIL (str);
int nbytes = strlen (str);
_r_big_zero_out (n);
@ -123,7 +123,7 @@ R_API void r_big_from_hexstr(RNumBig *n, const char *str) {
str += 2;
nbytes -= 2;
}
r_return_if_fail (nbytes > 0);
R_RETURN_IF_FAIL (nbytes > 0);
R_BIG_DTYPE tmp;
int i = nbytes - (2 * R_BIG_WORD_SIZE); /* index into string */
@ -194,8 +194,8 @@ R_API char *r_big_to_hexstr(RNumBig *b) {
}
R_API void r_big_assign(RNumBig *dst, RNumBig *src) {
r_return_if_fail (dst);
r_return_if_fail (src);
R_RETURN_IF_FAIL (dst);
R_RETURN_IF_FAIL (src);
memcpy (dst, src, sizeof (RNumBig));
}
@ -236,9 +236,9 @@ static void r_big_sub_inner(RNumBig *c, RNumBig *a, RNumBig *b) {
}
R_API void r_big_add(RNumBig *c, RNumBig *a, RNumBig *b) {
r_return_if_fail (a);
r_return_if_fail (b);
r_return_if_fail (c);
R_RETURN_IF_FAIL (a);
R_RETURN_IF_FAIL (b);
R_RETURN_IF_FAIL (c);
if (a->sign >= 0 && b->sign >= 0) {
r_big_add_inner (c, a, b);
@ -261,9 +261,9 @@ R_API void r_big_add(RNumBig *c, RNumBig *a, RNumBig *b) {
}
R_API void r_big_sub(RNumBig *c, RNumBig *a, RNumBig *b) {
r_return_if_fail (a);
r_return_if_fail (b);
r_return_if_fail (c);
R_RETURN_IF_FAIL (a);
R_RETURN_IF_FAIL (b);
R_RETURN_IF_FAIL (c);
if (a->sign >= 0 && b->sign >= 0) {
r_big_sub_inner (c, a, b);
@ -286,9 +286,9 @@ R_API void r_big_sub(RNumBig *c, RNumBig *a, RNumBig *b) {
}
R_API void r_big_mul(RNumBig *c, RNumBig *a, RNumBig *b) {
r_return_if_fail (a);
r_return_if_fail (b);
r_return_if_fail (c);
R_RETURN_IF_FAIL (a);
R_RETURN_IF_FAIL (b);
R_RETURN_IF_FAIL (c);
RNumBig *row = r_big_new ();
RNumBig *tmp = r_big_new ();
@ -322,10 +322,10 @@ R_API void r_big_mul(RNumBig *c, RNumBig *a, RNumBig *b) {
}
R_API void r_big_div(RNumBig *c, RNumBig *a, RNumBig *b) {
r_return_if_fail (a);
r_return_if_fail (b);
r_return_if_fail (c);
r_return_if_fail (!r_big_is_zero (b));
R_RETURN_IF_FAIL (a);
R_RETURN_IF_FAIL (b);
R_RETURN_IF_FAIL (c);
R_RETURN_IF_FAIL (!r_big_is_zero (b));
RNumBig *current = r_big_new ();
RNumBig *denom = r_big_new ();
@ -376,10 +376,10 @@ R_API void r_big_mod(RNumBig *c, RNumBig *a, RNumBig *b) {
/*
Take divmod and throw away div part
*/
r_return_if_fail (a);
r_return_if_fail (b);
r_return_if_fail (c);
r_return_if_fail (!r_big_is_zero (b));
R_RETURN_IF_FAIL (a);
R_RETURN_IF_FAIL (b);
R_RETURN_IF_FAIL (c);
R_RETURN_IF_FAIL (!r_big_is_zero (b));
RNumBig *tmp = r_big_new ();
@ -398,10 +398,10 @@ R_API void r_big_divmod(RNumBig *c, RNumBig *d, RNumBig *a, RNumBig *b) {
example:
mod(8, 3) = 8 - ((8 / 3) * 3) = 2
*/
r_return_if_fail (a);
r_return_if_fail (b);
r_return_if_fail (c);
r_return_if_fail (!r_big_is_zero (b));
R_RETURN_IF_FAIL (a);
R_RETURN_IF_FAIL (b);
R_RETURN_IF_FAIL (c);
R_RETURN_IF_FAIL (!r_big_is_zero (b));
RNumBig *tmp = r_big_new ();
@ -418,11 +418,11 @@ R_API void r_big_divmod(RNumBig *c, RNumBig *d, RNumBig *a, RNumBig *b) {
}
R_API void r_big_and(RNumBig *c, RNumBig *a, RNumBig *b) {
r_return_if_fail (a);
r_return_if_fail (b);
r_return_if_fail (c);
r_return_if_fail (a->sign > 0);
r_return_if_fail (b->sign > 0);
R_RETURN_IF_FAIL (a);
R_RETURN_IF_FAIL (b);
R_RETURN_IF_FAIL (c);
R_RETURN_IF_FAIL (a->sign > 0);
R_RETURN_IF_FAIL (b->sign > 0);
int i;
for (i = 0; i < R_BIG_ARRAY_SIZE; i++) {
@ -431,11 +431,11 @@ R_API void r_big_and(RNumBig *c, RNumBig *a, RNumBig *b) {
}
R_API void r_big_or(RNumBig *c, RNumBig *a, RNumBig *b) {
r_return_if_fail (a);
r_return_if_fail (b);
r_return_if_fail (c);
r_return_if_fail (a->sign > 0);
r_return_if_fail (b->sign > 0);
R_RETURN_IF_FAIL (a);
R_RETURN_IF_FAIL (b);
R_RETURN_IF_FAIL (c);
R_RETURN_IF_FAIL (a->sign > 0);
R_RETURN_IF_FAIL (b->sign > 0);
int i;
for (i = 0; i < R_BIG_ARRAY_SIZE; i++) {
@ -444,11 +444,11 @@ R_API void r_big_or(RNumBig *c, RNumBig *a, RNumBig *b) {
}
R_API void r_big_xor(RNumBig *c, RNumBig *a, RNumBig *b) {
r_return_if_fail (a);
r_return_if_fail (b);
r_return_if_fail (c);
r_return_if_fail (a->sign > 0);
r_return_if_fail (b->sign > 0);
R_RETURN_IF_FAIL (a);
R_RETURN_IF_FAIL (b);
R_RETURN_IF_FAIL (c);
R_RETURN_IF_FAIL (a->sign > 0);
R_RETURN_IF_FAIL (b->sign > 0);
int i;
for (i = 0; i < R_BIG_ARRAY_SIZE; i++) {
@ -457,10 +457,10 @@ R_API void r_big_xor(RNumBig *c, RNumBig *a, RNumBig *b) {
}
R_API void r_big_lshift(RNumBig *b, RNumBig *a, size_t nbits) {
r_return_if_fail (a);
r_return_if_fail (b);
r_return_if_fail (a->sign > 0);
r_return_if_fail (b->sign > 0);
R_RETURN_IF_FAIL (a);
R_RETURN_IF_FAIL (b);
R_RETURN_IF_FAIL (a->sign > 0);
R_RETURN_IF_FAIL (b->sign > 0);
r_big_assign (b, a);
/* Handle shift in multiples of word-size */
@ -481,10 +481,10 @@ R_API void r_big_lshift(RNumBig *b, RNumBig *a, size_t nbits) {
}
R_API void r_big_rshift(RNumBig *b, RNumBig *a, size_t nbits) {
r_return_if_fail (a);
r_return_if_fail (b);
r_return_if_fail (a->sign > 0);
r_return_if_fail (b->sign > 0);
R_RETURN_IF_FAIL (a);
R_RETURN_IF_FAIL (b);
R_RETURN_IF_FAIL (a->sign > 0);
R_RETURN_IF_FAIL (b->sign > 0);
r_big_assign (b, a);
/* Handle shift in multiples of word-size */
@ -539,7 +539,7 @@ R_API int r_big_is_zero(RNumBig *a) {
}
R_API void r_big_inc(RNumBig *a) {
r_return_if_fail (a);
R_RETURN_IF_FAIL (a);
RNumBig *tmp = r_big_new ();
r_big_from_int (tmp, 1);
@ -549,7 +549,7 @@ R_API void r_big_inc(RNumBig *a) {
}
R_API void r_big_dec(RNumBig *a) {
r_return_if_fail (a);
R_RETURN_IF_FAIL (a);
RNumBig *tmp = r_big_new ();
r_big_from_int (tmp, 1);
@ -559,10 +559,10 @@ R_API void r_big_dec(RNumBig *a) {
}
R_API void r_big_powm(RNumBig *c, RNumBig *a, RNumBig *b, RNumBig *m) {
r_return_if_fail (a);
r_return_if_fail (b);
r_return_if_fail (c);
r_return_if_fail (m);
R_RETURN_IF_FAIL (a);
R_RETURN_IF_FAIL (b);
R_RETURN_IF_FAIL (c);
R_RETURN_IF_FAIL (m);
RNumBig *bcopy = r_big_new ();
RNumBig *acopy = r_big_new ();
@ -587,8 +587,8 @@ R_API void r_big_powm(RNumBig *c, RNumBig *a, RNumBig *b, RNumBig *m) {
}
R_API void r_big_isqrt(RNumBig *b, RNumBig *a) {
r_return_if_fail (a);
r_return_if_fail (b);
R_RETURN_IF_FAIL (a);
R_RETURN_IF_FAIL (b);
RNumBig *tmp = r_big_new ();
RNumBig *low = r_big_new ();
@ -623,8 +623,8 @@ R_API void r_big_isqrt(RNumBig *b, RNumBig *a) {
/* Private / Static functions. */
static void _rshift_word(RNumBig *a, int nwords) {
/* Naive method: */
r_return_if_fail (a);
r_return_if_fail (nwords >= 0);
R_RETURN_IF_FAIL (a);
R_RETURN_IF_FAIL (nwords >= 0);
size_t i;
if (nwords >= R_BIG_ARRAY_SIZE) {
@ -643,8 +643,8 @@ static void _rshift_word(RNumBig *a, int nwords) {
}
static void _lshift_word(RNumBig *a, int nwords) {
r_return_if_fail (a);
r_return_if_fail (nwords >= 0);
R_RETURN_IF_FAIL (a);
R_RETURN_IF_FAIL (nwords >= 0);
int i;
/* Shift whole words */
@ -658,7 +658,7 @@ static void _lshift_word(RNumBig *a, int nwords) {
}
static void _lshift_one_bit(RNumBig *a) {
r_return_if_fail (a);
R_RETURN_IF_FAIL (a);
int i;
for (i = (R_BIG_ARRAY_SIZE - 1); i > 0; i--) {
@ -668,7 +668,7 @@ static void _lshift_one_bit(RNumBig *a) {
}
static void _rshift_one_bit(RNumBig *a) {
r_return_if_fail (a);
R_RETURN_IF_FAIL (a);
int i;
for (i = 0; i < (R_BIG_ARRAY_SIZE - 1); i++) {
@ -678,7 +678,7 @@ static void _rshift_one_bit(RNumBig *a) {
}
static void _r_big_zero_out(RNumBig *a) {
r_return_if_fail (a);
R_RETURN_IF_FAIL (a);
size_t i;
for (i = 0; i < R_BIG_ARRAY_SIZE; i++) {

View File

@ -84,7 +84,7 @@ R_API void r_charset_free(RCharset *c) {
}
R_API void r_charset_close(RCharset *c) {
r_return_if_fail (c);
R_RETURN_IF_FAIL (c);
c->loaded = false;
}

View File

@ -15,7 +15,7 @@ static const char debruijn_charset[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmn
// lnp = lyndon prefix
static void de_bruijn_seq(int pnl_len_t, int lnp_len_p, int order,
int maxlen, int size, int* pnl_a, char* sequence, const char* charset) {
r_return_if_fail (charset && sequence);
R_RETURN_IF_FAIL (charset && sequence);
if (strlen (sequence) == maxlen) {
return;
}

Some files were not shown because too many files have changed in this diff Show More