summaryrefslogtreecommitdiff
path: root/error.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-07-23 01:02:18 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-07-23 01:02:18 +0000
commit6524f34a2688436249d111a3456a097c7111722c (patch)
treef9c83bf95a7873e01e38ff396a8bc5490b61162c /error.c
parente6a02b93747266925fd536a30715352bf2c60c07 (diff)
* sprintf.c (rb_vsprintf, rb_sprintf): new functions return new String,
using missing/vsnprintf.c. [ruby-dev:26580] * missing/vsnprintf.c: made the output changeable. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8825 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'error.c')
-rw-r--r--error.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/error.c b/error.c
index f35dc2ba3e..48cb00da38 100644
--- a/error.c
+++ b/error.c
@@ -956,14 +956,10 @@ syserr_initialize(argc, argv, self)
else err = "unknown error";
if (!NIL_P(mesg)) {
VALUE str = mesg;
- size_t len;
StringValue(str);
- len = strlen(err)+RSTRING(str)->len+3;
- mesg = rb_str_new(0, len);
- snprintf(RSTRING(mesg)->ptr, len+1, "%s - %.*s", err,
- (int)RSTRING(str)->len, RSTRING(str)->ptr);
- RSTRING(mesg)->len = strlen(RSTRING(mesg)->ptr);
+ mesg = rb_sprintf("%s - %.*s", err,
+ (int)RSTRING(str)->len, RSTRING(str)->ptr);
}
else {
mesg = rb_str_new2(err);