Skip to content
This repository has been archived by the owner on Jun 8, 2024. It is now read-only.

Commit

Permalink
Do not accidentally copy json results into parseResults.
Browse files Browse the repository at this point in the history
Two problems with this code:
- copying the large'ish json object is expensive
- copying the json object makes local modifications to it dead code
  • Loading branch information
daniel-j-h authored and TheMarex committed Apr 19, 2016
1 parent 9541f0f commit 28ab7ca
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/node_osrm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,7 @@ class Engine final : public Nan::ObjectWrap
static void trip(const Nan::FunctionCallbackInfo<v8::Value> &args);

static void ParseResult(const osrm::engine::Status result_status_code,
osrm::json::Object result);
osrm::json::Object& result);

template <typename BatonType, typename ParamType, typename AsyncType, typename AfterType>
static void Run(const Nan::FunctionCallbackInfo<v8::Value> &args,
Expand Down Expand Up @@ -961,7 +961,7 @@ void Engine::Run(const Nan::FunctionCallbackInfo<v8::Value> &args,
return;
}

void Engine::ParseResult(const osrm::Status result_status, osrm::json::Object result)
void Engine::ParseResult(const osrm::Status result_status, osrm::json::Object& result)
{
const auto code_iter = result.values.find("code");
const auto end_iter = result.values.end();
Expand Down

0 comments on commit 28ab7ca

Please sign in to comment.