Make AddrInfoGetter::getaddrinfo return a unique_ptr
Return a unique_ptr with a custom deleter from net::AddrInfoGetter::getaddrinfo. This makes memory management more consistent with C++ style and less error-prone. Also clean up net::test::make_addrinfo_list: 1. Infer the template argument rather than specifying it explicitly. 2. Put the template code inline so that it works for all possible N. 3. Outline the parts that don't depend on the template parameter. 4. Change the return type to match AddrInfoGetter::getaddrinfo(). 5. Use a StringPiece instead of a std::string. 6. Rename to MakeAddrInfoList to match C++ style. 7. Move into address_info_unittest.cc which is the only file that uses it. BUG=1293403 Change-Id: I4001bb50bf3dec8b2e500c80ecb824681f2c13b4 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3495725 Commit-Queue: Adam Rice <ricea@chromium.org> Reviewed-by:Eric Orth <ericorth@chromium.org> Cr-Commit-Position: refs/heads/main@{#979727}
Loading
Please register or sign in to comment