[Lldb-commits] [PATCH] D104856: [NFC] Remove unreferenced function ResolveIPV4HostName

serge via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Jun 25 01:04:27 PDT 2021


serge-sans-paille updated this revision to Diff 354443.
serge-sans-paille retitled this revision from "[lldb] replace gethostbyname call by getaddrinfo" to "[NFC] Remove unreferenced function ResolveIPV4HostName".
serge-sans-paille edited the summary of this revision.
serge-sans-paille added a comment.

Just remove the function


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104856/new/

https://reviews.llvm.org/D104856

Files:
  lldb/tools/debugserver/source/RNBSocket.cpp


Index: lldb/tools/debugserver/source/RNBSocket.cpp
===================================================================
--- lldb/tools/debugserver/source/RNBSocket.cpp
+++ lldb/tools/debugserver/source/RNBSocket.cpp
@@ -30,38 +30,6 @@
 #include "lockdown.h"
 #endif
 
-/* Once we have a RNBSocket object with a port # specified,
-   this function is called to wait for an incoming connection.
-   This function blocks while waiting for that connection.  */
-
-bool ResolveIPV4HostName(const char *hostname, in_addr_t &addr) {
-  if (hostname == NULL || hostname[0] == '\0' ||
-      strcmp(hostname, "localhost") == 0 ||
-      strcmp(hostname, "127.0.0.1") == 0) {
-    addr = htonl(INADDR_LOOPBACK);
-    return true;
-  } else if (strcmp(hostname, "*") == 0) {
-    addr = htonl(INADDR_ANY);
-    return true;
-  } else {
-    // See if an IP address was specified as numbers
-    int inet_pton_result = ::inet_pton(AF_INET, hostname, &addr);
-
-    if (inet_pton_result == 1)
-      return true;
-
-    struct hostent *host_entry = gethostbyname(hostname);
-    if (host_entry) {
-      std::string ip_str(
-          ::inet_ntoa(*(struct in_addr *)*host_entry->h_addr_list));
-      inet_pton_result = ::inet_pton(AF_INET, ip_str.c_str(), &addr);
-      if (inet_pton_result == 1)
-        return true;
-    }
-  }
-  return false;
-}
-
 rnb_err_t RNBSocket::Listen(const char *listen_host, uint16_t port,
                             PortBoundCallback callback,
                             const void *callback_baton) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D104856.354443.patch
Type: text/x-patch
Size: 1526 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210625/c9c16f63/attachment.bin>


More information about the lldb-commits mailing list