mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/syslog/syslog.c (mSyslog_inspect): Use rb_sprintf().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35738 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
1b84082a61
commit
28fc368955
2 changed files with 11 additions and 16 deletions
|
@ -1,4 +1,6 @@
|
|||
Mon May 21 15:02:37 2012 Akinori MUSHA <knu@iDaemons.org>
|
||||
Mon May 21 15:10:28 2012 Akinori MUSHA <knu@iDaemons.org>
|
||||
|
||||
* ext/syslog/syslog.c (mSyslog_inspect): Use rb_sprintf().
|
||||
|
||||
* ext/syslog/syslog.c (mSyslog_inspect): Make sure self is a
|
||||
module before calling rb_class2name().
|
||||
|
|
|
@ -313,24 +313,17 @@ static VALUE mSyslog_log(int argc, VALUE *argv, VALUE self)
|
|||
*/
|
||||
static VALUE mSyslog_inspect(VALUE self)
|
||||
{
|
||||
char buf[1024];
|
||||
|
||||
Check_Type(self, T_MODULE);
|
||||
|
||||
if (syslog_opened) {
|
||||
snprintf(buf, sizeof(buf),
|
||||
"<#%s: opened=true, ident=\"%s\", options=%d, facility=%d, mask=%d>",
|
||||
rb_class2name(self),
|
||||
syslog_ident,
|
||||
syslog_options,
|
||||
syslog_facility,
|
||||
syslog_mask);
|
||||
} else {
|
||||
snprintf(buf, sizeof(buf),
|
||||
"<#%s: opened=false>", rb_class2name(self));
|
||||
}
|
||||
if (!syslog_opened)
|
||||
return rb_sprintf("<#%s: opened=false>", rb_class2name(self));
|
||||
|
||||
return rb_str_new2(buf);
|
||||
return rb_sprintf("<#%s: opened=true, ident=\"%s\", options=%d, facility=%d, mask=%d>",
|
||||
rb_class2name(self),
|
||||
syslog_ident,
|
||||
syslog_options,
|
||||
syslog_facility,
|
||||
syslog_mask);
|
||||
}
|
||||
|
||||
/* Returns self, for backward compatibility.
|
||||
|
|
Loading…
Reference in a new issue