From 5aff4aa52b5de4db8dd790461c70c7a680bea697 Mon Sep 17 00:00:00 2001 From: Jaylon Gowie Date: Sun, 25 Jul 2021 20:42:08 -0500 Subject: [PATCH] Add gethostbyaddr to header (#55) * Add gethostbyaddr to header * Remove Underscores * Remove Underscores * Fix Underscores in body --- newlib/libc/sys/vita/include/netdb.h | 1 + newlib/libc/sys/vita/net/gethostbyaddr.c | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/newlib/libc/sys/vita/include/netdb.h b/newlib/libc/sys/vita/include/netdb.h index 000ce347fe..b609fab141 100644 --- a/newlib/libc/sys/vita/include/netdb.h +++ b/newlib/libc/sys/vita/include/netdb.h @@ -112,6 +112,7 @@ struct addrinfo { #define NI_WITHSCOPEID 0x00000020 struct hostent *gethostbyname(const char *name); +struct hostent *gethostbyaddr(const void *addr, socklen_t len, int type); struct servent *getservbyname(const char *name, const char *proto); int getaddrinfo(const char *node, const char *service, const struct addrinfo *hints, struct addrinfo **res); void freeaddrinfo(struct addrinfo *res); diff --git a/newlib/libc/sys/vita/net/gethostbyaddr.c b/newlib/libc/sys/vita/net/gethostbyaddr.c index dc33cbfd06..92836e58f1 100644 --- a/newlib/libc/sys/vita/net/gethostbyaddr.c +++ b/newlib/libc/sys/vita/net/gethostbyaddr.c @@ -7,13 +7,13 @@ #define SCE_ERRNO_MASK 0xFF -struct hostent *gethostbyaddr(const void *__addr, socklen_t __len, int __type) { +struct hostent *gethostbyaddr(const void *addr, socklen_t len, int type) { static struct hostent ent; char name[NI_MAXHOST]; static char sname[NI_MAXHOST] = ""; static char *addrlist[2] = { NULL, NULL }; - if (__type != SCE_NET_AF_INET) { + if (type != SCE_NET_AF_INET) { errno = SCE_NET_ERROR_RESOLVER_ENOSUPPORT; return NULL; } @@ -24,7 +24,7 @@ struct hostent *gethostbyaddr(const void *__addr, socklen_t __len, int __type) { return NULL; } - int err = sceNetResolverStartAton(rid, __addr, name, sizeof(name), 0, 0, 0); + int err = sceNetResolverStartAton(rid, addr, name, sizeof(name), 0, 0, 0); sceNetResolverDestroy(rid); if (err < 0) { errno = err & SCE_ERRNO_MASK; @@ -32,11 +32,11 @@ struct hostent *gethostbyaddr(const void *__addr, socklen_t __len, int __type) { } strncpy(sname, name, NI_MAXHOST - 1); - addrlist[0] = (char *) __addr; + addrlist[0] = (char *) addr; ent.h_name = sname; ent.h_aliases = 0; - ent.h_addrtype = __type; + ent.h_addrtype = type; ent.h_length = sizeof(struct SceNetInAddr); ent.h_addr_list = addrlist; ent.h_addr = addrlist[0];