Skip to content

Commit

Permalink
Add ENV{SMHASHER_WORDS} to override /usr/share/dict/words dictionary
Browse files Browse the repository at this point in the history
  • Loading branch information
darkk committed Aug 28, 2024
1 parent 5417b3a commit 7d72787
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion HashMapTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ using namespace std;
std::vector<std::string> HashMapInit(bool verbose) {
std::vector<std::string> words;
std::string line;
std::string filename = "/usr/share/dict/words";
const char* const env_words = getenv("SMHASHER_WORDS");
std::string filename(env_words ? env_words : "/usr/share/dict/words");
int lines = 0, sum = 0;
std::ifstream wordfile(filename.c_str());
if (!wordfile.is_open()) {
Expand Down

0 comments on commit 7d72787

Please sign in to comment.