Remove auto_delete in favor of std::unique_ptr

This commit is contained in:
Tatsuhiro Tsujikawa 2013-06-22 18:51:29 +09:00
parent e791eb9ca3
commit 05d85e2965
8 changed files with 28 additions and 62 deletions

View file

@ -89,7 +89,8 @@ void SocketCoreTest::testInetNtop()
addrinfo* res;
CPPUNIT_ASSERT_EQUAL(0, callGetaddrinfo(&res, s.c_str(), 0, AF_INET,
SOCK_STREAM, 0, 0));
WSAAPI_AUTO_DELETE<struct addrinfo*> resDeleter(res, freeaddrinfo);
std::unique_ptr<addrinfo, decltype(&freeaddrinfo)> resDeleter
(res, freeaddrinfo);
sockaddr_in addr;
memcpy(&addr, res->ai_addr, sizeof(addr));
CPPUNIT_ASSERT_EQUAL(0, inetNtop(AF_INET, &addr.sin_addr,
@ -101,7 +102,8 @@ void SocketCoreTest::testInetNtop()
addrinfo* res;
CPPUNIT_ASSERT_EQUAL(0, callGetaddrinfo(&res, s.c_str(), 0, AF_INET6,
SOCK_STREAM, 0, 0));
WSAAPI_AUTO_DELETE<struct addrinfo*> resDeleter(res, freeaddrinfo);
std::unique_ptr<addrinfo, decltype(&freeaddrinfo)> resDeleter
(res, freeaddrinfo);
sockaddr_in6 addr;
memcpy(&addr, res->ai_addr, sizeof(addr));
CPPUNIT_ASSERT_EQUAL(0, inetNtop(AF_INET6, &addr.sin6_addr,