In message "[ruby-talk:01825] Very strange problem in chomp and/or sub, or with me"
on 00/03/14, Dave Thomas <Dave / thomases.com> writes:
|FE: [10, 15, 22, 120]-> [10,\ 15,\ 22,\ 120]^@
|18: '[0.8333333333, 1.25, 1.833333333, 10.0]'
|FE: [0.8333333333, 1.25, 1.833333333, 10.0]->
| [0.8333333333,\ 1.25,\ 1.833333333,\ 10.0]^@
|
|Note the NULL character added to the end of the result.
|Am I doing something stupid here?
No, it's a bug. It'll be solved by the following patch, which I
already sent to Dave. But I think the problem reported in
[ruby-talk:01826] is another story.
--- string.c 2000/03/13 07:18:39 1.24
+++ string.c 2000/03/15 04:13:04
@@ -2364,2 +2356,3 @@
if (len < RSTRING(str)->len) {
+ rb_str_modify(str);
RSTRING(str)->len = len;
@@ -2376,2 +2369,3 @@
memcmp(RSTRING(rs)->ptr, p+len-rslen, rslen) == 0)) {
+ rb_str_modify(str);
RSTRING(str)->len -= rslen;