From fc7c6154307fff3da071edbd51d779ad6f1ca3c2 Mon Sep 17 00:00:00 2001 From: janmroczkowski Date: Fri, 29 Sep 2017 13:51:02 +0100 Subject: [PATCH 1/2] Remove unused function identifier --- src/goto-diff/unified_diff.cpp | 3 --- src/goto-diff/unified_diff.h | 1 - 2 files changed, 4 deletions(-) diff --git a/src/goto-diff/unified_diff.cpp b/src/goto-diff/unified_diff.cpp index 911d7aef06e..862fda4d8dd 100644 --- a/src/goto-diff/unified_diff.cpp +++ b/src/goto-diff/unified_diff.cpp @@ -54,7 +54,6 @@ void unified_difft::get_diff( new_fit->second.body; get_diff( - function, old_goto_program, new_goto_program, entry->second, @@ -62,7 +61,6 @@ void unified_difft::get_diff( } void unified_difft::get_diff( - const irep_idt &identifier, const goto_programt &old_goto_program, const goto_programt &new_goto_program, const differencest &differences, @@ -109,7 +107,6 @@ void unified_difft::output_diff( { goto_program_difft diff; get_diff( - identifier, old_goto_program, new_goto_program, differences, diff --git a/src/goto-diff/unified_diff.h b/src/goto-diff/unified_diff.h index 65549c5759e..2ba9f09ae1c 100644 --- a/src/goto-diff/unified_diff.h +++ b/src/goto-diff/unified_diff.h @@ -76,7 +76,6 @@ class unified_difft differencest &differences) const; void get_diff( - const irep_idt &identifier, const goto_programt &old_goto_program, const goto_programt &new_goto_program, const differencest &differences, From f948c2f069b2c7e7a9a8ce4423b8e911d1f905a4 Mon Sep 17 00:00:00 2001 From: janmroczkowski Date: Fri, 29 Sep 2017 14:36:13 +0100 Subject: [PATCH 2/2] Readability improvement --- src/goto-diff/unified_diff.cpp | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/src/goto-diff/unified_diff.cpp b/src/goto-diff/unified_diff.cpp index 862fda4d8dd..804592dc9d1 100644 --- a/src/goto-diff/unified_diff.cpp +++ b/src/goto-diff/unified_diff.cpp @@ -384,15 +384,26 @@ void unified_difft::output(std::ostream &os) const for(const std::pair &p : differences_map) { - goto_functionst::function_mapt::const_iterator f1= - old_goto_functions.function_map.find(p.first); - goto_functionst::function_mapt::const_iterator f2= - new_goto_functions.function_map.find(p.first); + const irep_idt &function=p.first; + + goto_functionst::function_mapt::const_iterator old_fit= + old_goto_functions.function_map.find(function); + goto_functionst::function_mapt::const_iterator new_fit= + new_goto_functions.function_map.find(function); + + const goto_programt &old_goto_program= + old_fit==old_goto_functions.function_map.end() ? + empty : + old_fit->second.body; + const goto_programt &new_goto_program= + new_fit==new_goto_functions.function_map.end() ? + empty : + new_fit->second.body; output_diff( - p.first, - f1==old_goto_functions.function_map.end()?empty:f1->second.body, - f2==new_goto_functions.function_map.end()?empty:f2->second.body, + function, + old_goto_program, + new_goto_program, p.second, os); }