Skip to content

Commit 8314aab

Browse files
committed
Make string_container static init more resilient
1 parent 4dd5405 commit 8314aab

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/util/string_container.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ Author: Daniel Kroening, [email protected]
1313

1414
#include <cstring>
1515

16-
string_containert string_container;
17-
1816
string_ptrt::string_ptrt(const char *_s):s(_s), len(strlen(_s))
1917
{
2018
}
@@ -87,3 +85,10 @@ unsigned string_containert::get(const std::string &s)
8785

8886
return r;
8987
}
88+
89+
/// Get a reference to the global string container.
90+
string_containert &get_string_container()
91+
{
92+
static string_containert ret;
93+
return ret;
94+
}

src/util/string_container.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ class string_containert
8989
string_vectort string_vector;
9090
};
9191

92-
// an ugly global object
93-
extern string_containert string_container;
92+
string_containert &get_string_container();
9493

9594
#endif // CPROVER_UTIL_STRING_CONTAINER_H

0 commit comments

Comments
 (0)