From: Aki Tuomi Date: Sun, 22 Oct 2023 15:50:35 +0000 (+0300) Subject: ws-api: Constify some variables X-Git-Tag: auth-4.9.0-alpha1~42^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=70c1c68e3b4dd6694d564fc6dff1915d38f8eeac;p=thirdparty%2Fpdns.git ws-api: Constify some variables --- diff --git a/pdns/ws-api.cc b/pdns/ws-api.cc index 4bba973f7d..955c5964fb 100644 --- a/pdns/ws-api.cc +++ b/pdns/ws-api.cc @@ -120,18 +120,18 @@ void apiDiscovery(HttpRequest* /* req */, HttpResponse* resp) { } void apiDiscoveryV1(HttpRequest* /* req */, HttpResponse* resp) { - Json version1 = Json::object { + const Json& version1 = Json::object { { "server_url", "/api/v1/servers{/server}" }, { "api_features", Json::array {} } }; - Json doc = Json::array { std::move(version1) }; + const Json& doc = Json::array { version1 }; resp->setJsonBody(doc); } void apiServer(HttpRequest* /* req */ , HttpResponse* resp) { - Json doc = Json::array {getServerDetail()}; + const Json& doc = Json::array {getServerDetail()}; resp->setJsonBody(doc); } @@ -140,7 +140,7 @@ void apiServerDetail(HttpRequest* /* req */, HttpResponse* resp) { } void apiServerConfig(HttpRequest* /* req */, HttpResponse* resp) { - vector items = ::arg().list(); + const vector& items = ::arg().list(); string value; Json::array doc; for(const string& item : items) { @@ -162,7 +162,7 @@ void apiServerStatistics(HttpRequest* req, HttpResponse* resp) { Json::array doc; string name = req->getvars["statistic"]; if (!name.empty()) { - auto stat = productServerStatisticsFetch(name); + const auto& stat = productServerStatisticsFetch(name); if (!stat) { throw ApiException("Unknown statistic name"); }