mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
ecb09c186e
commit
afd7aea857
2 changed files with 6 additions and 1 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Tue Dec 28 22:31:46 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* string.c (rb_str_justify): create buffer string after argument type
|
||||||
|
conversion. fixed: [ruby-dev:25341]
|
||||||
|
|
||||||
Tue Dec 28 17:18:17 2004 NAKAMURA Usaku <usa@ruby-lang.org>
|
Tue Dec 28 17:18:17 2004 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||||
|
|
||||||
* lib/net/telnet.rb (preprocess): remove NULL unless binmode.
|
* lib/net/telnet.rb (preprocess): remove NULL unless binmode.
|
||||||
|
|
2
string.c
2
string.c
|
@ -4505,7 +4505,6 @@ rb_str_justify(argc, argv, str, jflag)
|
||||||
rb_scan_args(argc, argv, "11", &w, &pad);
|
rb_scan_args(argc, argv, "11", &w, &pad);
|
||||||
width = NUM2LONG(w);
|
width = NUM2LONG(w);
|
||||||
if (width < 0 || RSTRING(str)->len >= width) return rb_str_dup(str);
|
if (width < 0 || RSTRING(str)->len >= width) return rb_str_dup(str);
|
||||||
res = rb_str_new5(str, 0, width);
|
|
||||||
if (argc == 2) {
|
if (argc == 2) {
|
||||||
StringValue(pad);
|
StringValue(pad);
|
||||||
f = RSTRING(pad)->ptr;
|
f = RSTRING(pad)->ptr;
|
||||||
|
@ -4514,6 +4513,7 @@ rb_str_justify(argc, argv, str, jflag)
|
||||||
rb_raise(rb_eArgError, "zero width padding");
|
rb_raise(rb_eArgError, "zero width padding");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
res = rb_str_new5(str, 0, width);
|
||||||
p = RSTRING(res)->ptr;
|
p = RSTRING(res)->ptr;
|
||||||
if (jflag != 'l') {
|
if (jflag != 'l') {
|
||||||
n = width - RSTRING(str)->len;
|
n = width - RSTRING(str)->len;
|
||||||
|
|
Loading…
Add table
Reference in a new issue