Skip to content

Commit

Permalink
A small change to find_callee. No need to check if find_callee returns
Browse files Browse the repository at this point in the history
NULL. Find_callee will initialize and insert a new node if a matching
node is not found.
  • Loading branch information
bensong04 committed Feb 3, 2024
1 parent 238e583 commit 01fb0fc
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/leaffunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,10 @@ std::string get_fn_ident(leaffn_t* fn_node) {

leaffn_t* find_callee(leaffn_t* fn_node, std::string fn_ident) {
std::unordered_map<std::string, leaffn_t*> callees = fn_node->callees;
leaffn_t* found_callee = callees[fn_ident];
if (found_callee == NULL) { // hopefully true
if (callees[fn_ident] == NULL) { // hopefully true
callees[fn_ident] = new_leaffn(fn_node, fn_ident);
}

return callees[fn_ident];
}

void add_callee(leaffn_t* fn_node, leaffn_t* new_callee) {
Expand Down

0 comments on commit 01fb0fc

Please sign in to comment.