1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Constified afamily functions

This commit is contained in:
Nobuyoshi Nakada 2019-07-16 18:42:56 +09:00
parent 19d592dc82
commit 8deabcd328
No known key found for this signature in database
GPG key ID: 4BC7D6DF58D8DF60

View file

@ -1114,16 +1114,16 @@ addrinfo_initialize(int argc, VALUE *argv, VALUE self)
}
static int
get_afamily(struct sockaddr *addr, socklen_t len)
get_afamily(const struct sockaddr *addr, socklen_t len)
{
if ((socklen_t)((char*)&addr->sa_family + sizeof(addr->sa_family) - (char*)addr) <= len)
if ((socklen_t)((const char*)&addr->sa_family + sizeof(addr->sa_family) - (char*)addr) <= len)
return addr->sa_family;
else
return AF_UNSPEC;
}
static int
ai_get_afamily(rb_addrinfo_t *rai)
ai_get_afamily(const rb_addrinfo_t *rai)
{
return get_afamily(&rai->addr.addr, rai->sockaddr_len);
}