(Wiiu) Cleanups

This commit is contained in:
twinaphex 2020-07-24 04:42:43 +02:00
parent d2c3a6d71e
commit 2364fdd900

View File

@ -101,23 +101,25 @@ int _gettimeofday_r(struct _reent *ptr,
int clock_gettime(clockid_t clk_id, struct timespec* tp)
{
struct timeval ptimeval = { 0 };
int ret = 0;
OSTime cosTime;
int ret = 0;
if (tp == NULL) {
if (tp == NULL)
{
errno = EFAULT;
return -1;
}
switch (clk_id) {
switch (clk_id)
{
case CLOCK_REALTIME:
/* Just wrap gettimeofday. Cheating, I know. */
ret = _gettimeofday_r(NULL, &ptimeval, NULL);
if (ret) return -1;
if (ret)
return -1;
tp->tv_sec = ptimeval.tv_sec;
tp->tv_sec = ptimeval.tv_sec;
tp->tv_nsec = ptimeval.tv_usec * 1000;
break;
break;
default:
errno = EINVAL;
return -1;
@ -144,12 +146,15 @@ static struct ifaddrs *buildEmptyIfa(void)
if (result)
{
memset(result, 0, sizeof(struct ifaddrs));
result->ifa_name = strdup(wiiu_iface_name);
result->ifa_addr = (struct sockaddr *)malloc(sizeof(struct sockaddr_in));
result->ifa_name = strdup(wiiu_iface_name);
result->ifa_addr = (struct sockaddr *)malloc(sizeof(struct sockaddr_in));
result->ifa_netmask = (struct sockaddr *)malloc(sizeof(struct sockaddr_in));
result->ifa_dstaddr = (struct sockaddr *)malloc(sizeof(struct sockaddr_in));
if (!result->ifa_name || !result->ifa_addr || !result->ifa_netmask || !result->ifa_dstaddr)
if ( !result->ifa_name ||
!result->ifa_addr ||
!result->ifa_netmask ||
!result->ifa_dstaddr)
goto error;
memset(result->ifa_addr, 0, sizeof(struct sockaddr_in));