From: Tobias Markus Date: Sun, 2 Feb 2014 00:12:35 +0000 (+0100) Subject: Do not try to get search path every time X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=3ac835b0dc9517e534829c8ffdec12b580d1927a;p=supertux.git Do not try to get search path every time --- diff --git a/src/lisp/parser.cpp b/src/lisp/parser.cpp index e6a4198bd..8bc9005ec 100644 --- a/src/lisp/parser.cpp +++ b/src/lisp/parser.cpp @@ -36,7 +36,8 @@ Parser::Parser(bool translate) : dictionary_manager(0), dictionary(0), token(), - obst() + obst(), + searchpath() { if(translate) { dictionary_manager = new tinygettext::DictionaryManager(); @@ -46,6 +47,7 @@ Parser::Parser(bool translate) : } obstack_init(&obst); + searchpath = PHYSFS_getSearchPath(); } Parser::~Parser() @@ -53,6 +55,7 @@ Parser::~Parser() obstack_free(&obst, NULL); delete lexer; delete dictionary_manager; + delete searchpath; } static std::string dirname(const std::string& filename) @@ -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; diff --git a/src/lisp/parser.hpp b/src/lisp/parser.hpp index 7bb9903e2..47c4fcdf4 100644 --- a/src/lisp/parser.hpp +++ b/src/lisp/parser.hpp @@ -60,6 +60,7 @@ private: tinygettext::DictionaryManager* dictionary_manager; tinygettext::Dictionary* dictionary; Lexer::TokenType token; + char** searchpath; struct obstack obst;