Skip to content

Commit

Permalink
Check diff APIs nullability
Browse files Browse the repository at this point in the history
  • Loading branch information
astralia authored Nov 13, 2024
1 parent 95191c4 commit cb4bce0
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions libr/anal/diff.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,11 @@ R_API void r_anal_diff_setup_i(RAnal *anal, int doops, int thbb, int thfcn) {

// Fingerprint function basic block
R_API int r_anal_diff_fingerprint_bb(RAnal *anal, RAnalBlock *bb) {
R_RETURN_VAL_IF_FAIL (anal && bb, 0);
RAnalOp *op;
ut8 *buf;
int oplen, idx = 0;

if (!anal) {
return 0;
}
if (anal->cur && anal->cur->fingerprint_bb) {
return (anal->cur->fingerprint_bb (anal, bb));
}
Expand Down Expand Up @@ -97,10 +95,11 @@ static int bb_sort_by_addr(const void *x, const void *y) {
}

R_API size_t r_anal_diff_fingerprint_fcn(RAnal *anal, RAnalFunction *fcn) {
R_RETURN_VAL_IF_FAIL (anal && fcn, 0);
RAnalBlock *bb;
RListIter *iter;

if (anal && anal->cur && anal->cur->fingerprint_fcn) {
if (anal->cur && anal->cur->fingerprint_fcn) {
return (anal->cur->fingerprint_fcn (anal, fcn));
}

Expand All @@ -119,13 +118,11 @@ R_API size_t r_anal_diff_fingerprint_fcn(RAnal *anal, RAnalFunction *fcn) {
}

R_API bool r_anal_diff_bb(RAnal *anal, RAnalFunction *fcn, RAnalFunction *fcn2) {
R_RETURN_VAL_IF_FAIL (anal && fcn && fcn2, false);
RAnalBlock *bb, *bb2, *mbb, *mbb2;
RListIter *iter, *iter2;
double t, ot;

if (!anal || !fcn || !fcn2) {
return false;
}
if (anal->cur && anal->cur->diff_bb) {
return (anal->cur->diff_bb (anal, fcn, fcn2));
}
Expand Down Expand Up @@ -368,9 +365,11 @@ R_API int r_anal_diff_fcn(RAnal *anal, RList *fcns, RList *fcns2) {
return true;
}

// R2_600 UNUSED
R_API int r_anal_diff_eval(RAnal *anal) {
if (anal && anal->cur && anal->cur->diff_eval) {
R_RETURN_VAL_IF_FAIL (anal, false);
if (anal->cur && anal->cur->diff_eval) {
return (anal->cur->diff_eval (anal));
}
return true; // XXX: shouldn't this be false?
return false;
}

0 comments on commit cb4bce0

Please sign in to comment.