Skip to content

Commit

Permalink
Fix return types and args
Browse files Browse the repository at this point in the history
  • Loading branch information
wargio authored and XVilka committed May 9, 2023
1 parent 4c51c00 commit cc08a23
Show file tree
Hide file tree
Showing 13 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion librz/bin/p/bin_elf.inc
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ static int check_buffer_aux(RzBuffer *buf) {
#endif

static bool load_buffer(RZ_UNUSED RzBinFile *bf, RzBinObject *obj, RzBuffer *buf, RZ_UNUSED Sdb *sdb) {
rz_return_val_if_fail(obj, NULL);
rz_return_val_if_fail(obj, false);

ELFOBJ *bin = Elf_(rz_bin_elf_new_buf)(buf, &obj->opts);
if (!bin) {
Expand Down
4 changes: 2 additions & 2 deletions librz/config/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ RZ_API RZ_BORROW const char *rz_config_get(RzConfig *cfg, RZ_NONNULL const char
* Returns true in case of success.
*/
RZ_API bool rz_config_toggle(RzConfig *cfg, RZ_NONNULL const char *name) {
rz_return_val_if_fail(cfg && RZ_STR_ISNOTEMPTY(name), NULL);
rz_return_val_if_fail(cfg && RZ_STR_ISNOTEMPTY(name), false);
RzConfigNode *node = rz_config_node_get(cfg, name);
if (!node) {
return false;
Expand Down Expand Up @@ -390,7 +390,7 @@ RZ_API const char *rz_config_node_desc(RzConfigNode *node, RZ_NULLABLE const cha
}

RZ_API bool rz_config_rm(RzConfig *cfg, RZ_NONNULL const char *name) {
rz_return_val_if_fail(RZ_STR_ISNOTEMPTY(name) && cfg, NULL);
rz_return_val_if_fail(RZ_STR_ISNOTEMPTY(name) && cfg, false);
RzConfigNode *node = rz_config_node_get(cfg, name);
if (node) {
ht_pp_delete(cfg->ht, node->name);
Expand Down
2 changes: 1 addition & 1 deletion librz/core/agraph.c
Original file line number Diff line number Diff line change
Expand Up @@ -4903,7 +4903,7 @@ RZ_IPI int rz_core_visual_graph(RzCore *core, RzAGraph *g, RzAnalysisFunction *_
* \return Success
*/
RZ_API bool create_agraph_from_graph_at(RZ_NONNULL RzAGraph *ag, RZ_NONNULL const RzGraph /*<RzGraphNodeInfo *>*/ *g, bool free_on_fail) {
rz_return_val_if_fail(ag && g, NULL);
rz_return_val_if_fail(ag && g, false);
ag->need_reload_nodes = false;
// Cache lookup to build edges
HtPPOptions pointer_options = { 0 };
Expand Down
2 changes: 1 addition & 1 deletion librz/core/cgraph.c
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,7 @@ RZ_API RZ_OWN char *rz_core_graph_to_sdb_str(RZ_NONNULL RzCore *core, RZ_NONNULL
* \brief Convert \p graph to an image, and write it to \p filename.
*/
RZ_API bool rz_core_graph_write_graph(RZ_NONNULL RzCore *core, RZ_NONNULL RzGraph /*<RzGraphNodeInfo *>*/ *graph, RZ_NONNULL const char *filename) {
rz_return_val_if_fail(core && graph && filename, NULL);
rz_return_val_if_fail(core && graph && filename, false);
char *dot_text = rz_core_graph_to_dot_str(core, graph);
if (!dot_text) {
return false;
Expand Down
2 changes: 1 addition & 1 deletion librz/il/definitions/variable.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ RZ_API RZ_OWN RZ_NULLABLE RzILVal *rz_il_var_set_remove_var(RzILVarSet *vs, cons
* \return whether the value was successfully bound
*/
RZ_API bool rz_il_var_set_bind(RzILVarSet *vs, const char *name, RZ_OWN RzILVal *val) {
rz_return_val_if_fail(vs && name && val, NULL);
rz_return_val_if_fail(vs && name && val, false);
RzILVar *var = ht_pp_find(vs->vars, name, NULL);
if (!var || !rz_il_sort_pure_eq(var->sort, rz_il_value_get_sort(val))) {
if (!var) {
Expand Down
4 changes: 2 additions & 2 deletions librz/il/il_vm_eval.c
Original file line number Diff line number Diff line change
Expand Up @@ -318,9 +318,9 @@ static void *eval_pure(RZ_NONNULL RzILVM *vm, RZ_NONNULL RzILOpPure *op, RZ_NONN
}

static bool eval_effect(RZ_NONNULL RzILVM *vm, RZ_NONNULL RzILOpEffect *op) {
rz_return_val_if_fail(vm && op, NULL);
rz_return_val_if_fail(vm && op, false);
RzILOpEffectHandler handler = vm->op_handler_effect_table[op->code];
rz_return_val_if_fail(handler, NULL);
rz_return_val_if_fail(handler, false);
return handler(vm, op);
}

Expand Down
2 changes: 1 addition & 1 deletion librz/il/theory_effect.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ bool rz_il_handler_blk(RzILVM *vm, RzILOpEffect *op) {
}

bool rz_il_handler_repeat(RzILVM *vm, RzILOpEffect *op) {
rz_return_val_if_fail(vm && op, NULL);
rz_return_val_if_fail(vm && op, false);

RzILOpArgsRepeat *op_repeat = &op->op.repeat;
bool res = true;
Expand Down
2 changes: 1 addition & 1 deletion librz/il/theory_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ void *rz_il_handler_pure_unimplemented(RzILVM *vm, RzILOpPure *op, RzILTypePure
}

bool rz_il_handler_effect_unimplemented(RzILVM *vm, RzILOpEffect *op) {
rz_return_val_if_fail(vm && op, NULL);
rz_return_val_if_fail(vm && op, false);
RZ_LOG_ERROR("RzIL: unimplemented op handler (%d).\n", (int)op->code);
return false;
}
4 changes: 2 additions & 2 deletions librz/il/theory_mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ void *rz_il_handler_load(RzILVM *vm, RzILOpBitVector *op, RzILTypePure *type) {
}

bool rz_il_handler_store(RzILVM *vm, RzILOpEffect *op) {
rz_return_val_if_fail(vm && op, NULL);
rz_return_val_if_fail(vm && op, false);

RzILOpArgsStore *op_store = &op->op.store;

Expand Down Expand Up @@ -53,7 +53,7 @@ void *rz_il_handler_loadw(RzILVM *vm, RzILOpBitVector *op, RzILTypePure *type) {
}

bool rz_il_handler_storew(RzILVM *vm, RzILOpEffect *op) {
rz_return_val_if_fail(vm && op, NULL);
rz_return_val_if_fail(vm && op, false);

RzILOpArgsStoreW *op_storew = &op->op.storew;

Expand Down
4 changes: 2 additions & 2 deletions librz/sign/sigdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ RZ_API RZ_OWN RzSigDb *rz_sign_sigdb_load_database(RZ_NONNULL const char *sigdb_
* \return true if the signature entry was correctly added to the database, false otherwise
*/
RZ_API bool rz_sign_sigdb_add_entry(RZ_NONNULL RzSigDb *db, RZ_NONNULL const RzSigDBEntry *entry) {
rz_return_val_if_fail(db && entry, NULL);
rz_return_val_if_fail(db && entry, false);
return ht_pu_insert(db->entries, entry, 1);
}

Expand All @@ -182,7 +182,7 @@ static bool sigdb_move_entry(void *user, const void *k, const ut64 v) {
* \return true if the databases were correctly merged, false otherwise
*/
RZ_API bool rz_sign_sigdb_merge(RZ_NONNULL RzSigDb *db, RZ_NONNULL RzSigDb *db2) {
rz_return_val_if_fail(db && db2, NULL);
rz_return_val_if_fail(db && db2, false);
struct sigdb_move_data_t opt = {
.src = db2,
.dst = db,
Expand Down
2 changes: 1 addition & 1 deletion librz/type/helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ RZ_API RZ_OWN RzType *rz_type_callable(RZ_NONNULL RZ_OWN RzCallable *callable) {
RZ_API bool rz_type_atomic_eq(const RzTypeDB *typedb, RZ_NONNULL const RzType *typ1, RZ_NONNULL const RzType *typ2) {
// We aim to compare only atomic types, we can't compare more complex ones for now
rz_return_val_if_fail(typ1 && typ2, false);
rz_return_val_if_fail(typ1->kind == RZ_TYPE_KIND_IDENTIFIER && typ2 == RZ_TYPE_KIND_IDENTIFIER, false);
rz_return_val_if_fail(typ1->kind == RZ_TYPE_KIND_IDENTIFIER && typ2->kind == RZ_TYPE_KIND_IDENTIFIER, false);
rz_return_val_if_fail(typ1->identifier.kind == RZ_TYPE_IDENTIFIER_KIND_UNSPECIFIED, false);
rz_return_val_if_fail(typ2->identifier.kind == RZ_TYPE_IDENTIFIER_KIND_UNSPECIFIED, false);
rz_return_val_if_fail(typ1->identifier.name, false);
Expand Down
2 changes: 1 addition & 1 deletion subprojects/rzar/ar.c
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ RZ_API RzArFp *ar_open_file(const char *arname, int perm, const char *filename)
return NULL;
}

RzArFp *arf = arfp_new(b, NULL);
RzArFp *arf = arfp_new(b, false);
if (!arf) {
rz_buf_free(b);
return NULL;
Expand Down
4 changes: 2 additions & 2 deletions test/unit/test_type.c
Original file line number Diff line number Diff line change
Expand Up @@ -1118,13 +1118,13 @@ bool test_typedef_loop(void) {
}

static void struct_union_add_member(RzTypeDB *typedb, RzBaseType *btype, const char *member_name, RzType *member_type) {
if (btype->type == RZ_BASE_TYPE_KIND_STRUCT) {
if (btype->kind == RZ_BASE_TYPE_KIND_STRUCT) {
RzTypeStructMember *memb = rz_vector_push(&btype->struct_data.members, NULL);
memb->type = member_type;
memb->name = strdup(member_name);
memb->offset = 0;
memb->size = 0;
} else { // if (btype->type == RZ_BASE_TYPE_KIND_UNION)
} else { // if (btype->kind == RZ_BASE_TYPE_KIND_UNION)
RzTypeUnionMember *memb = rz_vector_push(&btype->union_data.members, NULL);
memb->type = member_type;
memb->name = strdup(member_name);
Expand Down

0 comments on commit cc08a23

Please sign in to comment.