diff options
author | Casey Bodley <cbodley@redhat.com> | 2015-11-04 22:39:45 +0100 |
---|---|---|
committer | Yehuda Sadeh <yehuda@redhat.com> | 2016-02-12 01:13:28 +0100 |
commit | a1816d975edd2c2e5025f9ab6757753164d45276 (patch) | |
tree | 7d94123b6f075e8d17a24b41daed07108c808de7 /src/rgw/rgw_rest_conn.cc | |
parent | rgw: move RGWPostRESTResourceCR to rgw_cr_rest.h (diff) | |
download | ceph-a1816d975edd2c2e5025f9ab6757753164d45276.tar.xz ceph-a1816d975edd2c2e5025f9ab6757753164d45276.zip |
rgw: use insert to copy containers in rgw_rest_conn
Signed-off-by: Casey Bodley <cbodley@redhat.com>
Diffstat (limited to 'src/rgw/rgw_rest_conn.cc')
-rw-r--r-- | src/rgw/rgw_rest_conn.cc | 29 |
1 files changed, 8 insertions, 21 deletions
diff --git a/src/rgw/rgw_rest_conn.cc b/src/rgw/rgw_rest_conn.cc index a08a049198f..d4b4939fdd9 100644 --- a/src/rgw/rgw_rest_conn.cc +++ b/src/rgw/rgw_rest_conn.cc @@ -171,10 +171,7 @@ int RGWRESTConn::get_resource(const string& resource, list<pair<string, string> > params; if (extra_params) { - list<pair<string, string> >::iterator iter = extra_params->begin(); - for (; iter != extra_params->end(); ++iter) { - params.push_back(*iter); - } + params.insert(params.end(), extra_params->begin(), extra_params->end()); } params.push_back(pair<string, string>(RGW_SYS_PARAM_PREFIX "zonegroup", zone_group)); @@ -185,10 +182,7 @@ int RGWRESTConn::get_resource(const string& resource, map<string, string> headers; if (extra_headers) { - for (map<string, string>::iterator iter = extra_headers->begin(); - iter != extra_headers->end(); ++iter) { - headers[iter->first] = iter->second; - } + headers.insert(extra_params->begin(), extra_params->end()); } ret = req.get_resource(key, headers, resource, mgr); @@ -221,11 +215,10 @@ RGWRESTReadResource::RGWRESTReadResource(RGWRESTConn *_conn, const string& _resource, list<pair<string, string> >& _params, list<pair<string, string> > *extra_headers, - RGWHTTPManager *_mgr) : cct(_conn->get_ctx()), conn(_conn), resource(_resource), cb(bl), - mgr(_mgr), req(cct, conn->get_url(), &cb, NULL, NULL) { - for (list<pair<string, string> >::iterator iter = _params.begin(); iter != _params.end(); ++iter) { - params.push_back(*iter); - } + RGWHTTPManager *_mgr) + : cct(_conn->get_ctx()), conn(_conn), resource(_resource), params(_params), + cb(bl), mgr(_mgr), req(cct, conn->get_url(), &cb, NULL, NULL) +{ init_common(extra_headers); } @@ -234,10 +227,7 @@ void RGWRESTReadResource::init_common(list<pair<string, string> > *extra_headers params.push_back(pair<string, string>(RGW_SYS_PARAM_PREFIX "zonegroup", conn->get_zonegroup())); if (extra_headers) { - for (list<pair<string, string> >::iterator iter = extra_headers->begin(); - iter != extra_headers->end(); ++iter) { - headers[iter->first] = iter->second; - } + headers.insert(extra_headers->begin(), extra_headers->end()); } req.set_params(¶ms); @@ -285,10 +275,7 @@ RGWRESTPostResource::RGWRESTPostResource(RGWRESTConn *_conn, params.push_back(pair<string, string>(RGW_SYS_PARAM_PREFIX "zonegroup", conn->get_zonegroup())); if (extra_headers) { - for (list<pair<string, string> >::iterator iter = extra_headers->begin(); - iter != extra_headers->end(); ++iter) { - headers[iter->first] = iter->second; - } + headers.insert(extra_headers->begin(), extra_headers->end()); } req.set_params(¶ms); |