ruby-changes:56576
From: Nobuyoshi <ko1@a...>
Date: Tue, 16 Jul 2019 18:43:19 +0900 (JST)
Subject: [ruby-changes:56576] Nobuyoshi Nakada: 8deabcd328 (master): Constified afamily functions
https://git.ruby-lang.org/ruby.git/commit/?id=8deabcd328 From 8deabcd3280f6042ea1ed14b629d70680e081fec Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Tue, 16 Jul 2019 18:42:56 +0900 Subject: Constified afamily functions diff --git a/ext/socket/raddrinfo.c b/ext/socket/raddrinfo.c index a6abad6..1054d04 100644 --- a/ext/socket/raddrinfo.c +++ b/ext/socket/raddrinfo.c @@ -1114,16 +1114,16 @@ addrinfo_initialize(int argc, VALUE *argv, VALUE self) https://github.com/ruby/ruby/blob/trunk/ext/socket/raddrinfo.c#L1114 } 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); } -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/