Skip to content

Commit

Permalink
Do not try to get search path every time
Browse files Browse the repository at this point in the history
  • Loading branch information
tobbi committed Feb 2, 2014
1 parent 394d459 commit 3ac835b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/lisp/parser.cpp
Expand Up @@ -36,7 +36,8 @@ Parser::Parser(bool translate) :
dictionary_manager(0),
dictionary(0),
token(),
obst()
obst(),
searchpath()
{
if(translate) {
dictionary_manager = new tinygettext::DictionaryManager();
Expand All @@ -46,13 +47,15 @@ Parser::Parser(bool translate) :
}

obstack_init(&obst);
searchpath = PHYSFS_getSearchPath();
}

Parser::~Parser()
{
obstack_free(&obst, NULL);
delete lexer;
delete dictionary_manager;
delete searchpath;
}

static std::string dirname(const std::string& filename)
Expand All @@ -78,7 +81,6 @@ Parser::parse(const std::string& filename)

if(dictionary_manager) {
std::string rel_dir = dirname (filename);
char **searchpath = PHYSFS_getSearchPath();
for(char** i = searchpath; *i != NULL; i++)
{
std::string abs_dir = std::string (*i) + PHYSFS_getDirSeparator () + rel_dir;
Expand Down
1 change: 1 addition & 0 deletions src/lisp/parser.hpp
Expand Up @@ -60,6 +60,7 @@ class Parser
tinygettext::DictionaryManager* dictionary_manager;
tinygettext::Dictionary* dictionary;
Lexer::TokenType token;
char** searchpath;

struct obstack obst;

Expand Down

0 comments on commit 3ac835b

Please sign in to comment.