Skip to content

Commit 716f451

Browse files
committed
Separate read_bin_goto_object into two functions
Because it deserialises two separate things and this helps make the functions smaller and separate the two separate steps.
1 parent 417d362 commit 716f451

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

src/goto-programs/read_bin_goto_object.cpp

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,13 @@ Date: June 2006
2020
#include "goto_functions.h"
2121
#include "write_goto_binary.h"
2222

23-
/// read goto binary format
24-
/// \par parameters: input stream, symbol_table, functions
25-
/// \return true on error, false otherwise
26-
static bool read_bin_goto_object(
23+
static void read_bin_symbol_table_object(
2724
std::istream &in,
2825
symbol_table_baset &symbol_table,
2926
goto_functionst &functions,
3027
irep_serializationt &irepconverter)
3128
{
32-
std::size_t count = irepconverter.read_gb_word(in); // # of symbols
29+
const std::size_t count = irepconverter.read_gb_word(in); // # of symbols
3330

3431
for(std::size_t i=0; i<count; i++)
3532
{
@@ -78,8 +75,14 @@ static bool read_bin_goto_object(
7875

7976
symbol_table.add(sym);
8077
}
78+
}
8179

82-
count=irepconverter.read_gb_word(in); // # of functions
80+
static void read_bin_functions_object(
81+
std::istream &in,
82+
goto_functionst &functions,
83+
irep_serializationt &irepconverter)
84+
{
85+
const std::size_t count = irepconverter.read_gb_word(in); // # of functions
8386

8487
for(std::size_t fct_index = 0; fct_index < count; ++fct_index)
8588
{
@@ -166,7 +169,19 @@ static bool read_bin_goto_object(
166169
}
167170

168171
functions.compute_location_numbers();
172+
}
169173

174+
/// read goto binary format
175+
/// \par parameters: input stream, symbol_table, functions
176+
/// \return true on error, false otherwise
177+
static bool read_bin_goto_object(
178+
std::istream &in,
179+
symbol_table_baset &symbol_table,
180+
goto_functionst &functions,
181+
irep_serializationt &irepconverter)
182+
{
183+
read_bin_symbol_table_object(in, symbol_table, functions, irepconverter);
184+
read_bin_functions_object(in, functions, irepconverter);
170185
return false;
171186
}
172187

0 commit comments

Comments
 (0)