diff options
author | jtc <jtc@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2008-05-28 18:13:58 +0000 |
---|---|---|
committer | jtc <jtc@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2008-05-28 18:13:58 +0000 |
commit | 66032190d4b7ac7bfb23818948e454443011ed12 (patch) | |
tree | 31be0bd5d5be9dded1302d2a99424e2c91c56000 | |
parent | 74b3143d4c832839f22cb9bae808e96c80789ac6 (diff) | |
download | ATCD-66032190d4b7ac7bfb23818948e454443011ed12.tar.gz |
ChangeLogTag: Wed May 28 18:13:15 UTC 2008 J.T. Conklin <jtc@acorntoolworks.com>
-rw-r--r-- | ACE/ChangeLog | 19 | ||||
-rw-r--r-- | ACE/ace/INET_Addr.cpp | 36 | ||||
-rw-r--r-- | ACE/ace/INET_Addr.h | 9 |
3 files changed, 25 insertions, 39 deletions
diff --git a/ACE/ChangeLog b/ACE/ChangeLog index 8cc44d4c262..d9e66f21cde 100644 --- a/ACE/ChangeLog +++ b/ACE/ChangeLog @@ -1,3 +1,22 @@ +Wed May 28 18:13:15 UTC 2008 J.T. Conklin <jtc@acorntoolworks.com> + + * ace/INET_Addr.cpp: + * ace/INET_Addr.h: + + Changed ACE_INET_Addr::get_host_addr(char *, int) to be thread + safe by calling ACE_OS::inet_ntop() instead of + ACE_OS::inet_ntoa(). + + Changed ACE_INET_Addr::get_host_addr(void) to call + INET_Addr::get_host_addr(char *, size) with a static buffer. + + Removed the special cases for VxWorks in both of the above + methods which called inet_ntoa_b() which, according to comments, + was for efficency and thread safety. These are are now as + efficent and thread safe (or not, in the case of ACE_INET_Addr:: + get_host_addr(void)) as any other target platform, but no longer + need a string buffer member in every ACE_INET_Addr instance. + Wed May 28 13:46:00 UTC 2008 Simon Massey <sma at prismtech dot com> * ace/Malloc.h: diff --git a/ACE/ace/INET_Addr.cpp b/ACE/ace/INET_Addr.cpp index 89337b0fea5..2b46e9b05e8 100644 --- a/ACE/ace/INET_Addr.cpp +++ b/ACE/ace/INET_Addr.cpp @@ -1109,24 +1109,10 @@ ACE_INET_Addr::get_host_addr (char *dst, int size) const } #endif /* ACE_HAS_IPV6 */ -#if defined (ACE_VXWORKS) - ACE_UNUSED_ARG (dst); - ACE_UNUSED_ARG (size); - - // It would be nice to be able to encapsulate this into - // ACE_OS::inet_ntoa(), but that would lead to either inefficiencies - // on vxworks or lack of thread safety. - // - // So, we use the way that vxworks suggests. - ACE_INET_Addr *ncthis = const_cast<ACE_INET_Addr *> (this); - inet_ntoa_b(this->inet_addr_.in4_.sin_addr, ncthis->buf_); - ACE_OS::strsncpy (dst, &buf_[0], size); - return &buf_[0]; -#else /* ACE_VXWORKS */ - char *ch = ACE_OS::inet_ntoa (this->inet_addr_.in4_.sin_addr); - ACE_OS::strsncpy (dst, ch, size); - return ch; -#endif + return ACE_OS::inet_ntop (AF_INET, + &this->inet_addr_.in4_.sin_addr, + dst, + size); } // Return the dotted Internet address. @@ -1138,18 +1124,8 @@ ACE_INET_Addr::get_host_addr (void) const static char buf[INET6_ADDRSTRLEN]; return this->get_host_addr (buf, INET6_ADDRSTRLEN); #else /* ACE_HAS_IPV6 */ -# if defined (ACE_VXWORKS) - // It would be nice to be able to encapsulate this into - // ACE_OS::inet_ntoa(), but that would lead to either inefficiencies - // on vxworks or lack of thread safety. - // - // So, we use the way that vxworks suggests. - ACE_INET_Addr *ncthis = const_cast<ACE_INET_Addr *> (this); - inet_ntoa_b (this->inet_addr_.in4_.sin_addr, ncthis->buf_); - return &buf_[0]; -# else /* ACE_VXWORKS */ - return ACE_OS::inet_ntoa (this->inet_addr_.in4_.sin_addr); -# endif /* !ACE_VXWORKS */ + static char buf[INET_ADDRSTRLEN]; + return this->get_host_addr (buf, INET_ADDRSTRLEN); #endif /* !ACE_HAS_IPV6 */ } diff --git a/ACE/ace/INET_Addr.h b/ACE/ace/INET_Addr.h index a69e1a7df00..e026d28b62b 100644 --- a/ACE/ace/INET_Addr.h +++ b/ACE/ace/INET_Addr.h @@ -22,11 +22,6 @@ #include "ace/Addr.h" -#if defined(ACE_VXWORKS) - // Needed to get INET_ADDR_LEN -# include /**/ "inetLib.h" -#endif /* ACE_VXWORKS */ - ACE_BEGIN_VERSIONED_NAMESPACE_DECL /** @@ -383,10 +378,6 @@ private: sockaddr_in6 in6_; #endif /* ACE_HAS_IPV6 */ } inet_addr_; - -#if defined (ACE_VXWORKS) - char buf_[INET_ADDR_LEN]; -#endif }; ACE_END_VERSIONED_NAMESPACE_DECL |