summaryrefslogtreecommitdiff
path: root/ext/syslog
diff options
context:
space:
mode:
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 a0b3ed3af7..14544cfc0d 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.