From f232bdfbe0d14a7dc5a838601b1a3b4d880d52d5 Mon Sep 17 00:00:00 2001 From: matz Date: Mon, 15 Nov 2004 16:45:03 +0000 Subject: * array.c (rb_ary_update): pedantic check to detect rb_ary_to_ary() to modify the receiver. [ruby-dev:24861] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@7273 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- string.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'string.c') diff --git a/string.c b/string.c index 6ebbf9289..bf95d610c 100644 --- a/string.c +++ b/string.c @@ -4491,9 +4491,10 @@ rb_str_justify(argc, argv, str, jflag) res = rb_str_new5(str, 0, width); if (argc == 2) { StringValue(pad); - if (RSTRING(pad)->len > 0) { - f = RSTRING(pad)->ptr; - flen = RSTRING(pad)->len; + f = RSTRING(pad)->ptr; + flen = RSTRING(pad)->len; + if (flen == 0) { + rb_raise(rb_eArgError, "zero width padding"); } } p = RSTRING(res)->ptr; -- cgit