summaryrefslogtreecommitdiff
path: root/ext/syslog
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-05-21 07:18:47 (GMT)
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-05-21 07:18:47 (GMT)
commit28fc368955fc94726ec95fcecb1f2aeab6d1aa64 (patch)
tree6201614c19187747428475c12d0f48b22f418723 /ext/syslog
parent1b84082a613b7bf3a6a9380b095ee4df4f551011 (diff)
* 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
Diffstat (limited to 'ext/syslog')
-rw-r--r--ext/syslog/syslog.c23
1 files changed, 8 insertions, 15 deletions
diff --git a/ext/syslog/syslog.c b/ext/syslog/syslog.c
index a0b3ed3..14544cf 100644
--- a/ext/syslog/syslog.c
+++ b/ext/syslog/syslog.c
@@ -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.