From 86c6af5873ae218a3fa92aed419de5b92653b9fb Mon Sep 17 00:00:00 2001 From: matz Date: Mon, 11 Mar 2002 08:02:04 +0000 Subject: * marshal.c (w_object): module inclusion using extend() should also be detected. * eval.c (rb_eval_cmd): cbase should not be NULL; it should be either ruby_wrapper or Object. * enum.c (enum_each_with_index): should return self. * process.c (proc_setpgrp): should return value for non-void function. * process.c (proc_getpgid): should raise exception if getpgid() return -1. * string.c (rb_str_ljust): should return a duplicated string. * string.c (rb_str_rjust): ditto. * string.c (rb_str_center): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2172 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- string.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'string.c') diff --git a/string.c b/string.c index 25fd851d08..d83913c0ee 100644 --- a/string.c +++ b/string.c @@ -3050,7 +3050,7 @@ rb_str_ljust(str, w) VALUE res; char *p, *pend; - if (width < 0 || RSTRING(str)->len >= width) return str; + if (width < 0 || RSTRING(str)->len >= width) return rb_str_dup(str); res = rb_str_new5(str, 0, width); memcpy(RSTRING(res)->ptr, RSTRING(str)->ptr, RSTRING(str)->len); p = RSTRING(res)->ptr + RSTRING(str)->len; pend = RSTRING(res)->ptr + width; @@ -3070,7 +3070,7 @@ rb_str_rjust(str, w) VALUE res; char *p, *pend; - if (width < 0 || RSTRING(str)->len >= width) return str; + if (width < 0 || RSTRING(str)->len >= width) return rb_str_dup(str); res = rb_str_new5(str, 0, width); p = RSTRING(res)->ptr; pend = p + width - RSTRING(str)->len; while (p < pend) { @@ -3091,7 +3091,7 @@ rb_str_center(str, w) char *p, *pend; long n; - if (width < 0 || RSTRING(str)->len >= width) return str; + if (width < 0 || RSTRING(str)->len >= width) return rb_str_dup(str); res = rb_str_new5(str, 0, width); n = (width - RSTRING(str)->len)/2; p = RSTRING(res)->ptr; pend = p + n; -- cgit v1.2.3