From fec45ead6390688476b9e2f03090777bbac4e07b Mon Sep 17 00:00:00 2001 From: w00t Date: Tue, 16 Oct 2007 10:29:01 +0000 Subject: Remove second overridden (fully duplicated :/) copy of GetIPString which copies into a user specified buffer. It's not used anywhere, and is duplication ;( git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8218 e03df62e-2008-0410-955e-edbf42e46eb7 --- include/users.h | 6 ------ src/users.cpp | 46 ++++------------------------------------------ 2 files changed, 4 insertions(+), 48 deletions(-) diff --git a/include/users.h b/include/users.h index 915a23c0d..21214062c 100644 --- a/include/users.h +++ b/include/users.h @@ -659,12 +659,6 @@ class CoreExport User : public connection */ const char* GetIPString(); - /** Get IP string from sockaddr, using caller-specified buffer - * @param buf A buffer to use - * @return The IP string - */ - const char* GetIPString(char* buf); - /* Write error string */ std::string WriteError; diff --git a/src/users.cpp b/src/users.cpp index f487be6dc..2fb73c48b 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -1139,6 +1139,10 @@ int User::GetProtocolFamily() return sin->sin_family; } +/* + * XXX the duplication here is horrid.. + * do we really need two methods doing essentially the same thing? + */ const char* User::GetIPString() { static char buf[1024]; @@ -1179,48 +1183,6 @@ const char* User::GetIPString() return ""; } -const char* User::GetIPString(char* buf) -{ - if (this->ip == NULL) - { - *buf = 0; - return buf; - } - - switch (this->GetProtocolFamily()) - { -#ifdef SUPPORT_IP6LINKS - case AF_INET6: - { - static char temp[1024]; - - sockaddr_in6* sin = (sockaddr_in6*)this->ip; - inet_ntop(sin->sin6_family, &sin->sin6_addr, buf, sizeof(buf)); - /* IP addresses starting with a : on irc are a Bad Thing (tm) */ - if (*buf == ':') - { - strlcpy(&temp[1], buf, sizeof(temp) - 1); - *temp = '0'; - strlcpy(buf, temp, sizeof(temp)); - } - return buf; - } - break; -#endif - case AF_INET: - { - sockaddr_in* sin = (sockaddr_in*)this->ip; - inet_ntop(sin->sin_family, &sin->sin_addr, buf, sizeof(buf)); - return buf; - } - break; - - default: - break; - } - return ""; -} - /** NOTE: We cannot pass a const reference to this method. * The string is changed by the workings of the method, * so that if we pass const ref, we end up copying it to -- cgit v1.2.3