tqchen commented on a change in pull request #4281: [RUTNIME] Support C++ RPC
URL: https://github.com/apache/incubator-tvm/pull/4281#discussion_r344292057
 
 

 ##########
 File path: src/common/socket.h
 ##########
 @@ -62,6 +65,25 @@ inline std::string GetHostName() {
   return std::string(buf.c_str());
 }
 
+/*!
+ * \brief ValidateIP validates an ip address.
+ * \param ip The ip address in string format localhost or x.x.x.x format
+ * \return result of operation.
+ */
+inline bool ValidateIP(std::string ip) {
+  if (ip == "localhost") {
+    return true;
+  }
+  std::vector<std::string> list = Split(ip, '.');
+  if (list.size() != 4)
+    return false;
+  for (std::string str : list) {
 
 Review comment:
   when iterate over a list, use const std::string& str(otherwise could result 
in a copy)

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to