diff --git a/src/macro/Directives.cc b/src/macro/Directives.cc index fd320e5ca84e16f0f611a238fa0e6589eb7cab77..daa781e8f09f80c2b77e4bbcd3b1e889221a22f8 100644 --- a/src/macro/Directives.cc +++ b/src/macro/Directives.cc @@ -68,14 +68,7 @@ IncludePath::interpret(ostream &output, bool no_line_macro) StringPtr msp = dynamic_pointer_cast<String>(expr->eval()); if (!msp) throw StackTrace("File name does not evaluate to a string"); - size_t last = 0; - size_t next = 0; - while ((next = static_cast<string>(*msp).find(":", last)) != string::npos) - { - path.push_back(static_cast<string>(*msp).substr(last, next-last)); - last = next + 1; - } - path.push_back(static_cast<string>(*msp).substr(last)); + path = *msp; } catch (StackTrace &ex) { diff --git a/src/macro/Directives.hh b/src/macro/Directives.hh index 38048a7a71a7eb78beedda018f00ecaf00b43754..314f33622cfbe02de7efd54cc5539b28429b55b0 100644 --- a/src/macro/Directives.hh +++ b/src/macro/Directives.hh @@ -83,12 +83,12 @@ namespace macro { private: const ExpressionPtr expr; - vector<string> path; + string path; public: IncludePath(const ExpressionPtr expr_arg, Environment &env_arg, const Tokenizer::location location_arg) : Directive(env_arg, move(location_arg)), expr{move(expr_arg)} { } void interpret(ostream &output, bool no_line_macro) override; - inline vector<string> getPath() const { return path; } + inline string getPath() const { return path; } }; diff --git a/src/macro/Driver.cc b/src/macro/Driver.cc index f700b4731b2228f0eb2515154390184a231ec0f6..d24469db9280d96a538b3e961d86e35eb593cfeb 100644 --- a/src/macro/Driver.cc +++ b/src/macro/Driver.cc @@ -85,10 +85,7 @@ Driver::parse(const string &file_arg, const string &basename_arg, istream &modfi auto ipp = dynamic_pointer_cast<IncludePath>(statement); if (ipp) - { - auto p = ipp->getPath(); - paths.insert(paths.end(), p.begin(), p.end()); - } + paths.emplace_back(ipp->getPath()); auto ip = dynamic_pointer_cast<Include>(statement); if (ip)