From fc36ba5f04f659f485e4ae9d70ad826b5838959d Mon Sep 17 00:00:00 2001 From: Evan Martin Date: Mon, 9 Jan 2012 13:30:09 -0800 Subject: switch node lookup to StringPiece --- src/state.cc | 6 +++--- src/state.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/state.cc b/src/state.cc index 238674e..7e3aae8 100644 --- a/src/state.cc +++ b/src/state.cc @@ -47,16 +47,16 @@ Edge* State::AddEdge(const Rule* rule) { return edge; } -Node* State::GetNode(const string& path) { +Node* State::GetNode(StringPiece path) { Node* node = LookupNode(path); if (node) return node; - node = new Node(path); + node = new Node(path.AsString()); paths_[node->path()] = node; return node; } -Node* State::LookupNode(const string& path) { +Node* State::LookupNode(StringPiece path) { Paths::iterator i = paths_.find(path); if (i != paths_.end()) return i->second; diff --git a/src/state.h b/src/state.h index cdab131..72ced9f 100644 --- a/src/state.h +++ b/src/state.h @@ -40,8 +40,8 @@ struct State { Edge* AddEdge(const Rule* rule); - Node* GetNode(const string& path); - Node* LookupNode(const string& path); + Node* GetNode(StringPiece path); + Node* LookupNode(StringPiece path); Node* SpellcheckNode(const string& path); void AddIn(Edge* edge, const string& path); -- cgit v0.12