[10/17] reader: Simplify logic of get_or_read_and_add_translation_unit

Message ID 20240716145541.473065-11-dodji@redhat.com
State New
Headers
Series Support self comparison of vmlinux & modules using BTF/CTF |

Commit Message

Dodji Seketeli July 16, 2024, 2:55 p.m. UTC
  From: Dodji Seketeli <dodji@redhat.com>

	* src/abg-reader.cc (get_or_read_and_add_translation_unit):
	Simplify logic.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
---
 src/abg-reader.cc | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
  

Patch

diff --git a/src/abg-reader.cc b/src/abg-reader.cc
index a65d62ec..8b4007f5 100644
--- a/src/abg-reader.cc
+++ b/src/abg-reader.cc
@@ -1750,14 +1750,11 @@  get_or_read_and_add_translation_unit(reader& rdr, xmlNodePtr node)
   string tu_path;
   xml::xml_char_sptr path_str = XML_NODE_GET_ATTRIBUTE(node, "path");
 
-  if (path_str)
+  if (corp && !corp->is_empty())
     {
-      tu_path = reinterpret_cast<char*>(path_str.get());
-      ABG_ASSERT(!tu_path.empty());
-
-      if (corp && !corp->is_empty())
-	tu = corp->find_translation_unit(tu_path);
-
+      if (path_str.get())
+	tu_path = reinterpret_cast<char*>(path_str.get());
+      tu = corp->find_translation_unit(tu_path);
       if (tu)
 	return tu;
     }