From 4dc1a2180946ab793adee5eb235fc4ee8fa4cefe Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 23 Jul 2011 15:05:03 +0000 Subject: * error.c (rb_name_error_str): new function to raise NameError with the name string but not ID. * object.c, proc.c, variable.c: more removal of inadvertent symbol creation. [Feature #5079] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32645 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- error.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'error.c') diff --git a/error.c b/error.c index 42f83682ea..834eede8af 100644 --- a/error.c +++ b/error.c @@ -812,6 +812,21 @@ rb_name_error(ID id, const char *fmt, ...) rb_exc_raise(exc); } +void +rb_name_error_str(VALUE str, const char *fmt, ...) +{ + VALUE exc, argv[2]; + va_list args; + + va_start(args, fmt); + argv[0] = rb_vsprintf(fmt, args); + va_end(args); + + argv[1] = str; + exc = rb_class_new_instance(2, argv, rb_eNameError); + rb_exc_raise(exc); +} + /* * call-seq: * NameError.new(msg [, name]) -> name_error -- cgit v1.2.3