summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-12-28 13:32:28 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-12-28 13:32:28 +0000
commitafd7aea8577988d77cd7faed3524a92f29640e2b (patch)
treeb450de5b3be2521b319fcb5d2637b6b8385b61b8 /string.c
parentecb09c186e8decb94f10b54e07a6d424b596abbd (diff)
* string.c (rb_str_justify): create buffer string after argument type
conversion. fixed: [ruby-dev:25341] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7677 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 b566e7159f..73742cc38f 100644
--- a/string.c
+++ b/string.c
@@ -4505,7 +4505,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);
- res = rb_str_new5(str, 0, width);
if (argc == 2) {
StringValue(pad);
f = RSTRING(pad)->ptr;
@@ -4514,6 +4513,7 @@ rb_str_justify(argc, argv, str, jflag)
rb_raise(rb_eArgError, "zero width padding");
}
}
+ res = rb_str_new5(str, 0, width);
p = RSTRING(res)->ptr;
if (jflag != 'l') {
n = width - RSTRING(str)->len;