ruby-changes:39531
From: usa <ko1@a...>
Date: Mon, 17 Aug 2015 17:50:20 +0900 (JST)
Subject: [ruby-changes:39531] usa:r51612 (ruby_2_1): merge revision(s) 44497: [Backport #11441]
usa 2015-08-17 17:50:03 +0900 (Mon, 17 Aug 2015) New Revision: 51612 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=51612 Log: merge revision(s) 44497: [Backport #11441] * ext/socket/socket.c (rsock_syserr_fail_host_port): use format flags, '+' to inspect, ' ' to quote unprintables. * ext/socket/socket.c (rsock_syserr_fail_path): ditto. * ext/socket/socket.c (rsock_syserr_fail_raddrinfo): ditto. Modified directories: branches/ruby_2_1/ Modified files: branches/ruby_2_1/ext/socket/socket.c branches/ruby_2_1/version.h Index: ruby_2_1/ext/socket/socket.c =================================================================== --- ruby_2_1/ext/socket/socket.c (revision 51611) +++ ruby_2_1/ext/socket/socket.c (revision 51612) @@ -23,10 +23,8 @@ rsock_syserr_fail_host_port(int err, con https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ext/socket/socket.c#L23 { VALUE message; - port = rb_String(port); - - message = rb_sprintf("%s for \"%s\" port %s", - mesg, StringValueCStr(host), StringValueCStr(port)); + message = rb_sprintf("%s for %+"PRIsVALUE" port % "PRIsVALUE"", + mesg, host, port); rb_syserr_fail_str(err, message); } @@ -43,15 +41,7 @@ rsock_syserr_fail_path(int err, const ch https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ext/socket/socket.c#L41 VALUE message; if (RB_TYPE_P(path, T_STRING)) { - if (memchr(RSTRING_PTR(path), '\0', RSTRING_LEN(path))) { - path = rb_str_inspect(path); - message = rb_sprintf("%s for %s", mesg, - StringValueCStr(path)); - } - else { - message = rb_sprintf("%s for \"%s\"", mesg, - StringValueCStr(path)); - } + message = rb_sprintf("%s for % "PRIsVALUE"", mesg, path); rb_syserr_fail_str(err, message); } else { @@ -87,7 +77,7 @@ rsock_syserr_fail_raddrinfo(int err, con https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ext/socket/socket.c#L77 VALUE str, message; str = rsock_addrinfo_inspect_sockaddr(rai); - message = rb_sprintf("%s for %s", mesg, StringValueCStr(str)); + message = rb_sprintf("%s for %"PRIsVALUE"", mesg, str); rb_syserr_fail_str(err, message); } Index: ruby_2_1/version.h =================================================================== --- ruby_2_1/version.h (revision 51611) +++ ruby_2_1/version.h (revision 51612) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/version.h#L1 #define RUBY_VERSION "2.1.7" #define RUBY_RELEASE_DATE "2015-08-17" -#define RUBY_PATCHLEVEL 394 +#define RUBY_PATCHLEVEL 395 #define RUBY_RELEASE_YEAR 2015 #define RUBY_RELEASE_MONTH 8 Property changes on: ruby_2_1 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r44497 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/