summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-03-12 09:27:29 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-03-12 09:27:29 +0000
commit63a17aa5a2ecc674d107f76d03a9cf0c75ffcf2f (patch)
tree630484248157d90d6a295969b554d43e2001ebd6 /string.c
parent250f86b79a0d5b56dd1659d8cd809d964f4b0603 (diff)
* regex.c (re_compile_pattern): '\0111' should be '\011' plus '1',
since octal literals are formed by three digits at most. * 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/branches/ruby_1_6@2186 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r--string.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/string.c b/string.c
index 099f6a81d1..5244f8e5f2 100644
--- a/string.c
+++ b/string.c
@@ -2728,7 +2728,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_new(0, width);
RBASIC(res)->klass = rb_obj_class(str);
memcpy(RSTRING(res)->ptr, RSTRING(str)->ptr, RSTRING(str)->len);
@@ -2749,7 +2749,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_new(0, width);
RBASIC(res)->klass = rb_obj_class(str);
p = RSTRING(res)->ptr; pend = p + width - RSTRING(str)->len;
@@ -2771,7 +2771,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_new(0, width);
RBASIC(res)->klass = rb_obj_class(str);
n = (width - RSTRING(str)->len)/2;