Browse Source

[trac613] avoid using an unused temporary variable.

JINMEI Tatuya 14 years ago
parent
commit
6bdfcf31fe

+ 5 - 2
src/bin/host/host.cc

@@ -70,12 +70,15 @@ host_lookup(const char* const name, const char* const type) {
     msg.toWire(renderer);
     msg.toWire(renderer);
 
 
     struct addrinfo hints, *res;
     struct addrinfo hints, *res;
-    int e;
     memset(&hints, 0, sizeof(hints));
     memset(&hints, 0, sizeof(hints));
     hints.ai_family = AF_UNSPEC;
     hints.ai_family = AF_UNSPEC;
     hints.ai_socktype = SOCK_DGRAM;
     hints.ai_socktype = SOCK_DGRAM;
     hints.ai_flags = 0; // not using AI_NUMERICHOST in case to bootstrap
     hints.ai_flags = 0; // not using AI_NUMERICHOST in case to bootstrap
-    e = getaddrinfo(server, server_port, &hints, &res);
+    if (getaddrinfo(server, server_port, &hints, &res) != 0) {
+        cerr << "address/port conversion for " << server << ":"
+             << server_port << " failed" << endl;
+        return (1);
+    }
 
 
     if (verbose) {
     if (verbose) {
         cout << "Trying \"" << name << "\"\n";
         cout << "Trying \"" << name << "\"\n";

+ 3 - 3
src/lib/asiolink/tests/udp_socket_unittest.cc

@@ -138,7 +138,7 @@ public:
     }
     }
 
 
     /// \brief Get number of bytes transferred in I/O
     /// \brief Get number of bytes transferred in I/O
-    size_t getLength() {
+    size_t getLength() const {
         return (ptr_->length_);
         return (ptr_->length_);
     }
     }
 
 
@@ -150,7 +150,7 @@ public:
     }
     }
 
 
     /// \brief Get flag to say when callback was called
     /// \brief Get flag to say when callback was called
-    bool getCalled() {
+    bool getCalled() const {
         return (ptr_->called_);
         return (ptr_->called_);
     }
     }
 
 
@@ -162,7 +162,7 @@ public:
     }
     }
 
 
     /// \brief Return instance of callback name
     /// \brief Return instance of callback name
-    std::string getName() {
+    std::string getName() const {
         return (ptr_->name_);
         return (ptr_->name_);
     }
     }
 
 

+ 1 - 1
src/lib/bench/tests/loadquery_unittest.cc

@@ -55,7 +55,7 @@ const char* const LoadQueryTest::DATA_DIR = TEST_DATA_DIR;
 class QueryInserter {
 class QueryInserter {
 public:
 public:
     QueryInserter(stringstream& stream) : stream_(stream) {}
     QueryInserter(stringstream& stream) : stream_(stream) {}
-    void operator()(const QueryParam& query) {
+    void operator()(const QueryParam& query) const {
         stream_ << query.first << " " << query.second << endl;
         stream_ << query.first << " " << query.second << endl;
     }
     }
 private:
 private:

+ 1 - 1
src/lib/cc/tests/session_unittests.cc

@@ -74,7 +74,7 @@ public:
     }
     }
 
 
     void
     void
-    acceptHandler(const asio::error_code&) {
+    acceptHandler(const asio::error_code&) const {
     }
     }
 
 
     void
     void

+ 1 - 1
src/lib/nsas/asiolink.h

@@ -46,7 +46,7 @@ public:
     }
     }
 
 
     /// \return true if two addresses are equal
     /// \return true if two addresses are equal
-    bool equal(const IOAddress& address)
+    bool equal(const IOAddress& address) const
     {return (toText() == address.toText());}
     {return (toText() == address.toText());}
 
 
 private:
 private: