Merge "Nullability check for inet module." am: 2b12a6ed5f am: 40df9116a6

Original change: https://android-review.googlesource.com/c/platform/bionic/+/2587988

Change-Id: I4dad88b30d076a592c9939d3cab6bcd7acadaeed
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot 2023-05-25 02:22:09 +00:00 committed by Automerger Merge Worker
commit fba80e7172
2 changed files with 23 additions and 20 deletions

View file

@ -36,17 +36,17 @@
__BEGIN_DECLS
in_addr_t inet_addr(const char* __s);
int inet_aton(const char* __s, struct in_addr* __addr);
in_addr_t inet_addr(const char* _Nonnull __s);
int inet_aton(const char* _Nonnull __s, struct in_addr* _Nullable __addr);
in_addr_t inet_lnaof(struct in_addr __addr) __INTRODUCED_IN(21);
struct in_addr inet_makeaddr(in_addr_t __net, in_addr_t __host) __INTRODUCED_IN(21);
in_addr_t inet_netof(struct in_addr __addr) __INTRODUCED_IN(21);
in_addr_t inet_network(const char* __s) __INTRODUCED_IN(21);
char* inet_ntoa(struct in_addr __addr);
const char* inet_ntop(int __af, const void* __src, char* __dst, socklen_t __size);
unsigned int inet_nsap_addr(const char* __ascii, unsigned char* __binary, int __n);
char* inet_nsap_ntoa(int __binary_length, const unsigned char* __binary, char* __ascii);
int inet_pton(int __af, const char* __src, void* __dst);
in_addr_t inet_network(const char* _Nonnull __s) __INTRODUCED_IN(21);
char* _Nonnull inet_ntoa(struct in_addr __addr);
const char* _Nullable inet_ntop(int __af, const void* _Nonnull __src, char* _Nonnull __dst, socklen_t __size);
unsigned int inet_nsap_addr(const char* _Nonnull __ascii, unsigned char* _Nonnull __binary, int __n);
char* _Nonnull inet_nsap_ntoa(int __binary_length, const unsigned char* _Nonnull __binary, char* _Nullable __ascii);
int inet_pton(int __af, const char* _Nonnull __src, void* _Nonnull __dst);
__END_DECLS

View file

@ -78,32 +78,34 @@
* supplied in host order, and returned in network order (suitable for
* use in system calls).
*/
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wnullability-completeness"
struct hostent {
char * _Nullable h_name; /* official name of host */
char * _Nullable * _Nullable h_aliases; /* alias list */
char *h_name; /* official name of host */
char **h_aliases; /* alias list */
int h_addrtype; /* host address type */
int h_length; /* length of address */
char * _Nullable * _Nullable h_addr_list; /* list of addresses from name server */
char **h_addr_list; /* list of addresses from name server */
#define h_addr h_addr_list[0] /* address, for backward compatibility */
};
struct netent {
char * _Nullable n_name; /* official name of net */
char * _Nullable * _Nullable n_aliases; /* alias list */
char *n_name; /* official name of net */
char **n_aliases; /* alias list */
int n_addrtype; /* net address type */
uint32_t n_net; /* network # */
};
struct servent {
char * _Nullable s_name; /* official service name */
char * _Nullable * _Nullable s_aliases; /* alias list */
char *s_name; /* official service name */
char **s_aliases; /* alias list */
int s_port; /* port # */
char * _Nullable s_proto; /* protocol to use */
};
struct protoent {
char * _Nullable p_name; /* official protocol name */
char * _Nullable * _Nullable p_aliases; /* alias list */
char *p_name; /* official protocol name */
char **p_aliases; /* alias list */
int p_proto; /* protocol # */
};
@ -113,10 +115,11 @@ struct addrinfo {
int ai_socktype; /* SOCK_xxx */
int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */
socklen_t ai_addrlen; /* length of ai_addr */
char * _Nullable ai_canonname; /* canonical name for hostname */
struct sockaddr * _Nullable ai_addr; /* binary address */
struct addrinfo * _Nullable ai_next; /* next structure in linked list */
char *ai_canonname; /* canonical name for hostname */
struct sockaddr *ai_addr; /* binary address */
struct addrinfo *ai_next; /* next structure in linked list */
};
#pragma clang diagnostic pop
/*
* Error return codes from gethostbyname() and gethostbyaddr()