зеркало из https://github.com/github/ruby.git
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:
Родитель
5f11c41042
Коммит
74947c9d1e
|
@ -523,18 +523,11 @@ ossl_engine_get_cmds(VALUE self)
|
|||
static VALUE
|
||||
ossl_engine_inspect(VALUE self)
|
||||
{
|
||||
VALUE str;
|
||||
const char *cname = rb_class2name(rb_obj_class(self));
|
||||
ENGINE *e;
|
||||
|
||||
str = rb_str_new2("#<");
|
||||
rb_str_cat2(str, cname);
|
||||
rb_str_cat2(str, " id=\"");
|
||||
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;
|
||||
GetEngine(self, e);
|
||||
return rb_sprintf("#<%"PRIsVALUE" id=\"%s\" name=\"%s\">",
|
||||
rb_obj_class(self), ENGINE_get_id(e), ENGINE_get_name(e));
|
||||
}
|
||||
|
||||
#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
|
||||
ossl_x509_inspect(VALUE self)
|
||||
{
|
||||
VALUE str;
|
||||
const char *cname = rb_class2name(rb_obj_class(self));
|
||||
|
||||
str = rb_str_new2("#<");
|
||||
rb_str_cat2(str, cname);
|
||||
rb_str_cat2(str, " ");
|
||||
|
||||
rb_str_cat2(str, "subject=");
|
||||
rb_str_append(str, rb_inspect(ossl_x509_get_subject(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;
|
||||
return rb_sprintf("#<%"PRIsVALUE": subject=%+"PRIsVALUE", "
|
||||
"issuer=%+"PRIsVALUE", serial=%+"PRIsVALUE", "
|
||||
"not_before=%+"PRIsVALUE", not_after=%+"PRIsVALUE">",
|
||||
rb_obj_class(self),
|
||||
ossl_x509_get_subject(self),
|
||||
ossl_x509_get_issuer(self),
|
||||
ossl_x509_get_serial(self),
|
||||
ossl_x509_get_not_before(self),
|
||||
ossl_x509_get_not_after(self));
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -327,10 +327,10 @@ static VALUE mSyslog_inspect(VALUE self)
|
|||
Check_Type(self, T_MODULE);
|
||||
|
||||
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>",
|
||||
rb_class2name(self),
|
||||
return rb_sprintf("<#%"PRIsVALUE": opened=true, ident=\"%s\", options=%d, facility=%d, mask=%d>",
|
||||
self,
|
||||
syslog_ident,
|
||||
syslog_options,
|
||||
syslog_facility,
|
||||
|
|
Загрузка…
Ссылка в новой задаче