summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-12-29 16:05:10 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-12-29 16:05:10 +0000
commitca61cc0b239e5561f767327579b2a37216fb74fe (patch)
tree5b104f83a35c88bc842a7250750d6260ca5bdfcb /string.c
parenta8a99b0fe50d81f676c2edd7e818ff13f21c3f5e (diff)
* string.c (rb_str_justify): [ruby-dev:25367]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@7685 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r--string.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/string.c b/string.c
index d1bd90c..c0bd42d 100644
--- a/string.c
+++ b/string.c
@@ -4474,7 +4474,6 @@ rb_str_justify(argc, argv, str, jflag)
rb_scan_args(argc, argv, "11", &w, &pad);
width = NUM2LONG(w);
- if (width < 0 || RSTRING(str)->len >= width) return rb_str_dup(str);
if (argc == 2) {
StringValue(pad);
f = RSTRING(pad)->ptr;
@@ -4483,6 +4482,7 @@ rb_str_justify(argc, argv, str, jflag)
rb_raise(rb_eArgError, "zero width padding");
}
}
+ if (width < 0 || RSTRING(str)->len >= width) return rb_str_dup(str);
res = rb_str_new5(str, 0, width);
p = RSTRING(res)->ptr;
if (jflag != 'l') {