ext: use rb_sprintf() and rb_vsprintf() with PRIsVALUE
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44581 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
5f11c41042
commit
74947c9d1e
@ -523,18 +523,11 @@ ossl_engine_get_cmds(VALUE self)
|
|||||||
static VALUE
|
static VALUE
|
||||||
ossl_engine_inspect(VALUE self)
|
ossl_engine_inspect(VALUE self)
|
||||||
{
|
{
|
||||||
VALUE str;
|
ENGINE *e;
|
||||||
const char *cname = rb_class2name(rb_obj_class(self));
|
|
||||||
|
|
||||||
str = rb_str_new2("#<");
|
GetEngine(self, e);
|
||||||
rb_str_cat2(str, cname);
|
return rb_sprintf("#<%"PRIsVALUE" id=\"%s\" name=\"%s\">",
|
||||||
rb_str_cat2(str, " id=\"");
|
rb_obj_class(self), ENGINE_get_id(e), ENGINE_get_name(e));
|
||||||
rb_str_append(str, ossl_engine_get_id(self));
|
|
||||||
rb_str_cat2(str, "\" name=\"");
|
|
||||||
rb_str_append(str, ossl_engine_get_name(self));
|
|
||||||
rb_str_cat2(str, "\">");
|
|
||||||
|
|
||||||
return str;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DefEngineConst(x) rb_define_const(cEngine, #x, INT2NUM(ENGINE_##x))
|
#define DefEngineConst(x) rb_define_const(cEngine, #x, INT2NUM(ENGINE_##x))
|
||||||
|
@ -693,35 +693,15 @@ ossl_x509_add_extension(VALUE self, VALUE extension)
|
|||||||
static VALUE
|
static VALUE
|
||||||
ossl_x509_inspect(VALUE self)
|
ossl_x509_inspect(VALUE self)
|
||||||
{
|
{
|
||||||
VALUE str;
|
return rb_sprintf("#<%"PRIsVALUE": subject=%+"PRIsVALUE", "
|
||||||
const char *cname = rb_class2name(rb_obj_class(self));
|
"issuer=%+"PRIsVALUE", serial=%+"PRIsVALUE", "
|
||||||
|
"not_before=%+"PRIsVALUE", not_after=%+"PRIsVALUE">",
|
||||||
str = rb_str_new2("#<");
|
rb_obj_class(self),
|
||||||
rb_str_cat2(str, cname);
|
ossl_x509_get_subject(self),
|
||||||
rb_str_cat2(str, " ");
|
ossl_x509_get_issuer(self),
|
||||||
|
ossl_x509_get_serial(self),
|
||||||
rb_str_cat2(str, "subject=");
|
ossl_x509_get_not_before(self),
|
||||||
rb_str_append(str, rb_inspect(ossl_x509_get_subject(self)));
|
ossl_x509_get_not_after(self));
|
||||||
rb_str_cat2(str, ", ");
|
|
||||||
|
|
||||||
rb_str_cat2(str, "issuer=");
|
|
||||||
rb_str_append(str, rb_inspect(ossl_x509_get_issuer(self)));
|
|
||||||
rb_str_cat2(str, ", ");
|
|
||||||
|
|
||||||
rb_str_cat2(str, "serial=");
|
|
||||||
rb_str_append(str, rb_inspect(ossl_x509_get_serial(self)));
|
|
||||||
rb_str_cat2(str, ", ");
|
|
||||||
|
|
||||||
rb_str_cat2(str, "not_before=");
|
|
||||||
rb_str_append(str, rb_inspect(ossl_x509_get_not_before(self)));
|
|
||||||
rb_str_cat2(str, ", ");
|
|
||||||
|
|
||||||
rb_str_cat2(str, "not_after=");
|
|
||||||
rb_str_append(str, rb_inspect(ossl_x509_get_not_after(self)));
|
|
||||||
|
|
||||||
str = rb_str_cat2(str, ">");
|
|
||||||
|
|
||||||
return str;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -327,10 +327,10 @@ static VALUE mSyslog_inspect(VALUE self)
|
|||||||
Check_Type(self, T_MODULE);
|
Check_Type(self, T_MODULE);
|
||||||
|
|
||||||
if (!syslog_opened)
|
if (!syslog_opened)
|
||||||
return rb_sprintf("<#%s: opened=false>", rb_class2name(self));
|
return rb_sprintf("<#%"PRIsVALUE": opened=false>", self);
|
||||||
|
|
||||||
return rb_sprintf("<#%s: opened=true, ident=\"%s\", options=%d, facility=%d, mask=%d>",
|
return rb_sprintf("<#%"PRIsVALUE": opened=true, ident=\"%s\", options=%d, facility=%d, mask=%d>",
|
||||||
rb_class2name(self),
|
self,
|
||||||
syslog_ident,
|
syslog_ident,
|
||||||
syslog_options,
|
syslog_options,
|
||||||
syslog_facility,
|
syslog_facility,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user