Skip to content
Commit ebba97d1 authored by Adam Rice's avatar Adam Rice Committed by Chromium LUCI CQ
Browse files

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: default avatarEric Orth <ericorth@chromium.org>
Cr-Commit-Position: refs/heads/main@{#979727}
parent f2f8e13b
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment