From f463a6c794b73a6f5958780e47de6e461ae1b4c5 Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Mon, 11 Feb 2019 15:18:29 +0000 Subject: [PATCH] Revert "Use uniform initializer syntax everywhere" This reverts commit 49b41704e01e2fa62d38541f7de2eba1f12e9ab9. --- zuul-preview/main.cc | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/zuul-preview/main.cc b/zuul-preview/main.cc index 9159802..79e655d 100644 --- a/zuul-preview/main.cc +++ b/zuul-preview/main.cc @@ -26,9 +26,9 @@ using namespace std; vector split(const string &in) { - istringstream stream{in}; - vector parts{}; - string part{}; + istringstream stream(in); + vector parts; + string part; while (getline(stream, part, '.')) { parts.push_back(part); } @@ -56,11 +56,11 @@ public: // If the entry is present, it is moved to the head of the queue. optional get(const string &key) { - auto location{map.find(key)}; + auto location = map.find(key); if (location == map.end()) return {}; - auto val{*(location->second)}; + auto val = *(location->second); queue.erase(location->second); queue.push_front(val); //cout << "get push " << val.second << endl; @@ -71,12 +71,12 @@ public: // recently used entry. void put(const string &key, const string &value) { - auto location{map.find(key)}; + auto location = map.find(key); if (location != map.end()) return; if (queue.size() == size) { - auto last{queue.back()}; + auto last = queue.back(); //cout << "put pop " << last.second << endl; queue.pop_back(); map.erase(last.first); @@ -91,7 +91,7 @@ public: int main(int, char**) { - web::http::client::http_client client{"https://zuul.opendev.org"}; + web::http::client::http_client client("https://zuul.opendev.org"); string hostname; Cache cache{2}; @@ -104,20 +104,20 @@ int main(int, char**) // site.688b70499b9a41a08f498ed6e932960c.openstack // site.dbefc23dcc594577a8bfa4db4f9b0a8f.openstack - auto val{cache.get(hostname)}; + auto val = cache.get(hostname); if (val.has_value()) { cout << val.value() << endl; continue; } - auto parts{split(hostname)}; + auto parts = split(hostname); if (parts.size() < 3) { cout << "not enough args" << endl; continue; } - auto artifact{parts[0]}; - auto buildid{parts[1]}; - auto tenant{parts[2]}; + auto artifact = parts[0]; + auto buildid = parts[1]; + auto tenant = parts[2]; /* cout << artifact << endl << buildid << endl @@ -126,13 +126,13 @@ int main(int, char**) // 75031cad206c4014ad7a3387091d15ab try { - web::uri_builder uri{"/api/tenant/" + tenant + "/build"}; + auto uri = web::uri_builder("/api/tenant/" + tenant + "/build"); uri.append_path(buildid); - auto response{client.request( - web::http::methods::GET, uri.to_string()).get()}; + auto response = client.request( + web::http::methods::GET, uri.to_string()).get(); // body is a web::json::value // cout << response.status_code() << endl; - auto body{response.extract_json().get()}; + auto body = response.extract_json().get(); //cout << body.serialize() << endl; // TODO: use artifact