From 01fb0fcbfe4b76aa81f5e5b8f235643fe4bc966b Mon Sep 17 00:00:00 2001 From: Ben Song Date: Fri, 2 Feb 2024 21:44:11 -0500 Subject: [PATCH] A small change to find_callee. No need to check if find_callee returns NULL. Find_callee will initialize and insert a new node if a matching node is not found. --- src/leaffunction.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/leaffunction.cpp b/src/leaffunction.cpp index 70269b8..8cc36ad 100644 --- a/src/leaffunction.cpp +++ b/src/leaffunction.cpp @@ -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 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) {