mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
use rb_sym2str
* ext/openssl/ossl_ssl.c (ossl_sslctx_set_ssl_version): use rb_sym2str to get rid of inadvertent ID creations. * ext/socket/ancdata.c (ancillary_inspect): ditto. * ext/socket/option.c (sockopt_inspect): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51586 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
a19830c42c
commit
b5a5cd605b
3 changed files with 5 additions and 5 deletions
|
@ -174,13 +174,13 @@ ossl_sslctx_set_ssl_version(VALUE self, VALUE ssl_method)
|
||||||
{
|
{
|
||||||
SSL_METHOD *method = NULL;
|
SSL_METHOD *method = NULL;
|
||||||
const char *s;
|
const char *s;
|
||||||
|
VALUE m = ssl_method;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
SSL_CTX *ctx;
|
SSL_CTX *ctx;
|
||||||
if (RB_TYPE_P(ssl_method, T_SYMBOL))
|
if (RB_TYPE_P(ssl_method, T_SYMBOL))
|
||||||
s = rb_id2name(SYM2ID(ssl_method));
|
m = rb_sym2str(ssl_method);
|
||||||
else
|
s = StringValuePtr(m);
|
||||||
s = StringValuePtr(ssl_method);
|
|
||||||
for (i = 0; i < numberof(ossl_ssl_method_tab); i++) {
|
for (i = 0; i < numberof(ossl_ssl_method_tab); i++) {
|
||||||
if (strcmp(ossl_ssl_method_tab[i].name, s) == 0) {
|
if (strcmp(ossl_ssl_method_tab[i].name, s) == 0) {
|
||||||
method = ossl_ssl_method_tab[i].func();
|
method = ossl_ssl_method_tab[i].func();
|
||||||
|
|
|
@ -990,7 +990,7 @@ ancillary_inspect(VALUE self)
|
||||||
|
|
||||||
vtype = ip_cmsg_type_to_sym(level, type);
|
vtype = ip_cmsg_type_to_sym(level, type);
|
||||||
if (SYMBOL_P(vtype))
|
if (SYMBOL_P(vtype))
|
||||||
rb_str_catf(ret, " %s", rb_id2name(SYM2ID(vtype)));
|
rb_str_catf(ret, " %"PRIsVALUE, rb_sym2str(vtype));
|
||||||
else
|
else
|
||||||
rb_str_catf(ret, " cmsg_type:%d", type);
|
rb_str_catf(ret, " cmsg_type:%d", type);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1244,7 +1244,7 @@ sockopt_inspect(VALUE self)
|
||||||
|
|
||||||
v = optname_to_sym(level, optname);
|
v = optname_to_sym(level, optname);
|
||||||
if (SYMBOL_P(v))
|
if (SYMBOL_P(v))
|
||||||
rb_str_catf(ret, " %s", rb_id2name(SYM2ID(v)));
|
rb_str_catf(ret, " %"PRIsVALUE, rb_sym2str(v));
|
||||||
else
|
else
|
||||||
rb_str_catf(ret, " optname:%d", optname);
|
rb_str_catf(ret, " optname:%d", optname);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue