From 2fed885b253b553592b05ab40a3f009dfcea0a41 Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 22 Jul 2008 08:53:34 +0000 Subject: * compile.c (insn_data_to_s_detail), file.c (rb_stat_inspect), iseq.c (ruby_iseq_disasm_insn, ruby_iseq_disasm), process.c (pst_message), re.c (match_inspect): use rb_str_catf. * dir.c (dir_inspect), iseq.c (iseq_inspect, insn_operand_intern): use rb_sprintf. * error.c (rb_name_error, rb_raise, rb_loaderror, rb_fatal): use rb_vsprintf. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18158 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- error.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) (limited to 'error.c') diff --git a/error.c b/error.c index 9bf5c27fb..c88ef8132 100644 --- a/error.c +++ b/error.c @@ -621,13 +621,11 @@ rb_name_error(ID id, const char *fmt, ...) { VALUE exc, argv[2]; va_list args; - char buf[BUFSIZ]; va_start(args, fmt); - vsnprintf(buf, BUFSIZ, fmt, args); + argv[0] = rb_vsprintf(fmt, args); va_end(args); - argv[0] = rb_str_new2(buf); argv[1] = ID2SYM(id); exc = rb_class_new_instance(2, argv, rb_eNameError); rb_exc_raise(exc); @@ -1074,24 +1072,24 @@ void rb_raise(VALUE exc, const char *fmt, ...) { va_list args; - char buf[BUFSIZ]; + VALUE mesg; - va_start(args,fmt); - vsnprintf(buf, BUFSIZ, fmt, args); + va_start(args, fmt); + mesg = rb_vsprintf(fmt, args); va_end(args); - rb_exc_raise(rb_exc_new2(exc, buf)); + rb_exc_raise(rb_exc_new3(exc, mesg)); } void rb_loaderror(const char *fmt, ...) { va_list args; - char buf[BUFSIZ]; + VALUE mesg; va_start(args, fmt); - vsnprintf(buf, BUFSIZ, fmt, args); + mesg = rb_vsprintf(fmt, args); va_end(args); - rb_exc_raise(rb_exc_new2(rb_eLoadError, buf)); + rb_exc_raise(rb_exc_new3(rb_eLoadError, mesg)); } void @@ -1106,13 +1104,13 @@ void rb_fatal(const char *fmt, ...) { va_list args; - char buf[BUFSIZ]; + VALUE mesg; va_start(args, fmt); - vsnprintf(buf, BUFSIZ, fmt, args); + mesg = rb_vsprintf(fmt, args); va_end(args); - rb_exc_fatal(rb_exc_new2(rb_eFatal, buf)); + rb_exc_fatal(rb_exc_new3(rb_eFatal, mesg)); } void -- cgit