diff options
| author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-12-28 13:32:28 +0000 |
|---|---|---|
| committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-12-28 13:32:28 +0000 |
| commit | 3cb2875c397b0ed728276e56651e34ebf3009614 (patch) | |
| tree | c3f9a515a90a64600b22b53add54296fba216130 /string.c | |
| parent | 7fac9ffae3a631cbe8e8fc8bc4a68cfc58e84439 (diff) | |
| download | ruby-3cb2875c397b0ed728276e56651e34ebf3009614.tar.gz ruby-3cb2875c397b0ed728276e56651e34ebf3009614.tar.xz ruby-3cb2875c397b0ed728276e56651e34ebf3009614.zip | |
* string.c (rb_str_justify): create buffer string after argument type
conversion. fixed: [ruby-dev:25341]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@7677 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
| -rw-r--r-- | string.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -4475,7 +4475,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; @@ -4484,6 +4483,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; |
