mirror of
https://github.com/libretro/RetroArch
synced 2025-04-18 14:42:30 +00:00
Usse wrapper functions freeaddrinfo/getaddrinfo in command.c
This commit is contained in:
parent
25d9d7459b
commit
4cdbe6f0c6
10
command.c
10
command.c
@ -86,7 +86,7 @@ static bool cmd_init_network(rarch_cmd_t *handle, uint16_t port)
|
|||||||
|
|
||||||
|
|
||||||
snprintf(port_buf, sizeof(port_buf), "%hu", (unsigned short)port);
|
snprintf(port_buf, sizeof(port_buf), "%hu", (unsigned short)port);
|
||||||
if (getaddrinfo(NULL, port_buf, &hints, &res) < 0)
|
if (getaddrinfo_rarch(NULL, port_buf, &hints, &res) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
handle->net_fd = socket(res->ai_family,
|
handle->net_fd = socket(res->ai_family,
|
||||||
@ -105,12 +105,12 @@ static bool cmd_init_network(rarch_cmd_t *handle, uint16_t port)
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
freeaddrinfo(res);
|
freeaddrinfo_rarch(res);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
if (res)
|
if (res)
|
||||||
freeaddrinfo(res);
|
freeaddrinfo_rarch(res);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -548,7 +548,7 @@ static bool send_udp_packet(const char *host,
|
|||||||
hints.ai_socktype = SOCK_DGRAM;
|
hints.ai_socktype = SOCK_DGRAM;
|
||||||
|
|
||||||
snprintf(port_buf, sizeof(port_buf), "%hu", (unsigned short)port);
|
snprintf(port_buf, sizeof(port_buf), "%hu", (unsigned short)port);
|
||||||
if (getaddrinfo(host, port_buf, &hints, &res) < 0)
|
if (getaddrinfo_rarch(host, port_buf, &hints, &res) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* Send to all possible targets.
|
/* Send to all possible targets.
|
||||||
@ -580,7 +580,7 @@ static bool send_udp_packet(const char *host,
|
|||||||
}
|
}
|
||||||
|
|
||||||
end:
|
end:
|
||||||
freeaddrinfo(res);
|
freeaddrinfo_rarch(res);
|
||||||
if (fd >= 0)
|
if (fd >= 0)
|
||||||
close(fd);
|
close(fd);
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user