cf-socket: make Curl_addr2string static

Move as sockaddr2string() into cf-socket.c where its only callers are.

Mark as UNITTEST for unit1609.

Move "struct Curl_sockaddr_ex" into sockaddr.h, so connect.h and
cf-socket.h can be included without all the system headers needed.

Closes #21946
This commit is contained in:
Stefan Eissing 2026-06-10 13:18:30 +02:00 committed by Daniel Stenberg
parent 7ec25148c0
commit 30c9c79cf8
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
11 changed files with 95 additions and 91 deletions

View file

@ -23,7 +23,6 @@
***************************************************************************/
#include "unitcheck.h"
#include "urldata.h"
#include "connect.h"
#include "curl_addrinfo.h"
static CURLcode t1607_setup(void)
@ -146,8 +145,8 @@ static CURLcode test_unit1607(const char *arg)
if(tests[i].address[j] == &skip)
continue;
if(addr && !Curl_addr2string(addr->ai_addr, addr->ai_addrlen,
ipaddress, &port)) {
if(addr && !sockaddr2string(addr->ai_addr, addr->ai_addrlen,
ipaddress, &port)) {
curl_mfprintf(stderr, "%s:%d tests[%zu] failed. "
"getaddressinfo failed.\n",
__FILE__, __LINE__, i);

View file

@ -145,8 +145,8 @@ static CURLcode test_unit1609(const char *arg)
if(!addr && !tests[i].address[j])
break;
if(addr && !Curl_addr2string(addr->ai_addr, addr->ai_addrlen,
ipaddress, &port)) {
if(addr && !sockaddr2string(addr->ai_addr, addr->ai_addrlen,
ipaddress, &port)) {
curl_mfprintf(stderr,
"%s:%d tests[%zu] failed. Curl_addr2string failed.\n",
__FILE__, __LINE__, i);

View file

@ -46,6 +46,7 @@
#include "cf-ip-happy.h"
#include "multiif.h"
#include "select.h"
#include "sockaddr.h"
#include "curl_addrinfo.h"
#include "curl_trc.h"