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 authored and rurban committed Aug 28, 2024
1 parent abab0d7 commit de06b48
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 de06b48

Please sign in to comment.