Browse Source

[5077] Reverted not trivial auto

Francis Dupont 8 years ago
parent
commit
0ad263c467

+ 2 - 4
src/lib/http/post_request_json.cc

@@ -41,13 +41,11 @@ PostHttpRequestJson::getBodyAsJson() {
 
 ConstElementPtr
 PostHttpRequestJson::getJsonElement(const std::string& element_name) {
-    typedef std::map<std::string, ConstElementPtr> MapElementType;
     try {
         ConstElementPtr body = getBodyAsJson();
         if (body) {
-            const MapElementType& map_value = body->mapValue();
-            MapElementType::const_iterator map_element =
-                map_value.find(element_name);
+            const std::map<std::string, ConstElementPtr>& map_value = body->mapValue();
+            auto map_element = map_value.find(element_name);
             if (map_element != map_value.end()) {
                 return (map_element->second);
             }

+ 4 - 7
src/lib/http/request.cc

@@ -53,8 +53,6 @@ HttpRequest::requiresBody() const {
 
 void
 HttpRequest::create() {
-    typedef std::vector<HttpHeaderContext> HeadersVector;
-    typedef std::map<std::string, std::string> HeadersMap;
     try {
         // The RequestParser doesn't validate the method name. Thus, this
         // may throw an exception. But, we're fine with lower case names,
@@ -78,7 +76,7 @@ HttpRequest::create() {
         }
 
         // Copy headers from the context.
-        for (HeadersVector::iterator header = context_->headers_.begin();
+        for (auto header = context_->headers_.begin();
              header != context_->headers_.end();
              ++header) {
             headers_[header->name_] = header->value_;
@@ -86,10 +84,10 @@ HttpRequest::create() {
 
         // Iterate over required headers and check that they exist
         // in the HTTP request.
-        for (HeadersMap::iterator req_header = required_headers_.begin();
+        for (auto req_header = required_headers_.begin();
              req_header != required_headers_.end();
              ++req_header) {
-            HeadersMap::iterator header = headers_.find(req_header->first);
+            auto header = headers_.find(req_header->first);
             if (header == headers_.end()) {
                 isc_throw(BadValue, "required header " << header->first
                           << " not found in the HTTP request");
@@ -155,10 +153,9 @@ HttpRequest::getHttpVersion() const {
 
 std::string
 HttpRequest::getHeaderValue(const std::string& header) const {
-    typedef std::map<std::string, std::string> HeadersMap;
     checkCreated();
 
-    HeadersMap::const_iterator header_it = headers_.find(header);
+    auto header_it = headers_.find(header);
     if (header_it != headers_.end()) {
         return (header_it->second);
     }

+ 1 - 3
src/lib/http/tests/post_request_json_unittests.cc

@@ -99,7 +99,6 @@ TEST_F(PostHttpRequestJsonTest, requireContentLength) {
 // This test verifies that JSON body can be retrieved from the
 // HTTP request.
 TEST_F(PostHttpRequestJsonTest, getBodyAsJson) {
-    typedef std::map<std::string, ConstElementPtr> MapElementType;
     // Create HTTP POST request with JSON body.
     setContextBasics("POST", "/isc/org", std::make_pair(1, 0));
     addHeaderToContext("Content-Length", json_body_.length());
@@ -114,8 +113,7 @@ TEST_F(PostHttpRequestJsonTest, getBodyAsJson) {
 
     // Iterate over JSON values and store them in a simple map.
     std::map<std::string, std::string> config_values;
-    for (MapElementType::const_iterator config_element =
-             json->mapValue().begin();
+    for (auto config_element = json->mapValue().begin();
          config_element != json->mapValue().end();
          ++config_element) {
         ASSERT_FALSE(config_element->first.empty());