diff options
-rw-r--r-- | ChangeLog | 46 | ||||
-rw-r--r-- | dir.c | 19 | ||||
-rw-r--r-- | enum.c | 29 | ||||
-rw-r--r-- | eval.c | 9 | ||||
-rw-r--r-- | ext/bigdecimal/bigdecimal.c | 2 | ||||
-rw-r--r-- | ext/dbm/dbm.c | 2 | ||||
-rw-r--r-- | ext/enumerator/enumerator.c | 3 | ||||
-rw-r--r-- | ext/socket/socket.c | 16 | ||||
-rw-r--r-- | ext/zlib/zlib.c | 3 | ||||
-rw-r--r-- | io.c | 36 | ||||
-rw-r--r-- | lib/cgi/session/pstore.rb | 6 | ||||
-rw-r--r-- | lib/delegate.rb | 9 | ||||
-rw-r--r-- | lib/tempfile.rb | 10 | ||||
-rw-r--r-- | lib/xsd/charset.rb | 2 | ||||
-rw-r--r-- | object.c | 4 | ||||
-rw-r--r-- | range.c | 60 | ||||
-rw-r--r-- | re.c | 4 | ||||
-rw-r--r-- | rubyio.h | 1 | ||||
-rw-r--r-- | string.c | 1 |
19 files changed, 131 insertions, 131 deletions
@@ -1,3 +1,18 @@ +Tue Oct 19 17:24:11 2004 Yukihiro Matsumoto <matz@ruby-lang.org> + + * io.c (read_all): block string buffer modification during + rb_io_fread() by freezing it temporarily. [ruby-dev:24479] + + * dir.c (rb_push_glob): block call at once the end of method. + [ruby-dev:24487] + + * ext/enumerator/enumerator.c (enum_each_slice): remove + rb_gc_force_recycle() to prevent potential SEGV. + [ruby-dev:24499] + + * ext/zlib/zlib.c (zstream_expand_buffer): hide internal string + buffer by clearing klass. [ruby-dev:24510] + Tue Oct 19 16:12:18 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp> * ext/tk/tkutil.c: backport from CVS HEAD @@ -157,6 +172,14 @@ Thu Oct 7 12:55:04 2004 Yukihiro Matsumoto <matz@ruby-lang.org> switch. [ruby-dev:24442] * pack.c (pack_unpack): string conversion should at the top of the +Mon Oct 18 00:42:45 2004 Yukihiro Matsumoto <matz@ruby-lang.org> + + * ext/socket/socket.c (sock_s_getservbyaname): protocol string + might be altered. [ruby-dev:24503] + + * string.c (rb_str_upto): check if return value from succ is a + string. [ruby-dev:24504] + method. [ruby-dev:24439] * io.c (io_read): buffer should be frozen only after the length @@ -246,6 +269,24 @@ Sat Oct 2 00:42:20 2004 Yukihiro Matsumoto <matz@ruby-lang.org> [ruby-dev:24383] * string.c (rb_str_sum): string may be altered. [ruby-dev:24381] +Mon Oct 11 17:51:34 2004 Yukihiro Matsumoto <matz@ruby-lang.org> + + * io.c (rb_io_popen): get mode string via rb_io_flags_mode() to + avoid mode string modification. [ruby-dev:24454] + + * io.c (rb_io_getline_fast): should take delim as unsigned char to + distinguish EOF and '\377'. [ruby-dev:24460] + + * io.c (rb_io_getline): add check for RS modification. + [ruby-dev:24461] + + * enum.c (enum_sort_by): use qsort() directly instead using + rb_iterate(). [ruby-dev:24462] + + * enum.c (enum_each_with_index): remove rb_gc_force_recycle() to + prevent access to recycled object (via continuation for + example). [ruby-dev:24463] + Fri Oct 1 11:40:14 2004 Yukihiro Matsumoto <matz@ruby-lang.org> @@ -277,6 +318,11 @@ Fri Oct 1 11:25:20 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp> Thu Sep 30 00:50:44 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp> +Sat Oct 9 00:25:39 2004 Tanaka Akira <akr@m17n.org> + + * io.c (rb_io_fread): rb_thread_wait_fd() was lost. + [ruby-dev:24457] + * ext/tcltklib/tcltklib.c (ip_init): bug fix * ext/tk/tkutil.c (get_eval_string_core): accept a Regexp object @@ -1119,14 +1119,7 @@ push_pattern(path, ary) const char *path; VALUE ary; { - VALUE str = rb_tainted_str_new2(path); - - if (ary) { - rb_ary_push(ary, str); - } - else { - rb_yield(str); - } + rb_ary_push(ary, rb_tainted_str_new2(path)); } static int @@ -1209,11 +1202,7 @@ rb_push_glob(str, flags) int noescape = flags & FNM_NOESCAPE; VALUE ary; - if (rb_block_given_p()) - ary = 0; - else - ary = rb_ary_new(); - + ary = rb_ary_new(); SafeStringValue(str); buf = xmalloc(RSTRING(str)->len + 1); @@ -1248,6 +1237,10 @@ rb_push_glob(str, flags) if (status) rb_jump_tag(status); + if (rb_block_given_p()) { + rb_ary_each(ary); + return Qnil; + } return ary; } @@ -117,11 +117,8 @@ enum_find(argc, argv, obj) rb_scan_args(argc, argv, "01", &if_none); rb_iterate(rb_each, obj, find_i, (VALUE)memo); if (memo->u2.value) { - VALUE result = memo->u1.value; - rb_gc_force_recycle((VALUE)memo); - return result; + return memo->u1.value; } - rb_gc_force_recycle((VALUE)memo); if (!NIL_P(if_none)) { return rb_funcall(if_none, rb_intern("call"), 0, 0); } @@ -319,7 +316,6 @@ enum_inject(argc, argv, obj) } rb_iterate(rb_each, obj, inject_i, (VALUE)memo); n = memo->u1.value; - rb_gc_force_recycle((VALUE)memo); return n; } @@ -398,17 +394,14 @@ sort_by_i(i, ary) return Qnil; } -static VALUE -sort_by_cmp(values, ary) - VALUE values, ary; +static int +sort_by_cmp(aa, bb) + NODE **aa, **bb; { - NODE *a = (NODE*)RARRAY(values)->ptr[0]; - NODE *b = (NODE*)RARRAY(values)->ptr[1]; + VALUE a = aa[0]->u1.value; + VALUE b = bb[0]->u1.value; - /* pedantic check; they must be memo nodes */ - Check_Type(a, T_NODE); - Check_Type(b, T_NODE); - return rb_funcall(a->u1.value, id_cmp, 1, b->u1.value); + return rb_cmpint(rb_funcall(a, id_cmp, 1, b), a, b); } /* @@ -495,7 +488,7 @@ enum_sort_by(obj) } rb_iterate(rb_each, obj, sort_by_i, ary); if (RARRAY(ary)->len > 1) { - rb_iterate(rb_ary_sort_bang, ary, sort_by_cmp, ary); + qsort(RARRAY(ary)->ptr, RARRAY(ary)->len, sizeof(VALUE), sort_by_cmp, 0); } for (i=0; i<RARRAY(ary)->len; i++) { RARRAY(ary)->ptr[i] = RNODE(RARRAY(ary)->ptr[i])->u2.value; @@ -554,7 +547,6 @@ enum_all(obj) memo->u1.value = Qtrue; rb_iterate(rb_each, obj, rb_block_given_p() ? all_iter_i : all_i, (VALUE)memo); result = memo->u1.value; - rb_gc_force_recycle((VALUE)memo); return result; } @@ -610,7 +602,6 @@ enum_any(obj) memo->u1.value = Qfalse; rb_iterate(rb_each, obj, rb_block_given_p() ? any_iter_i : any_i, (VALUE)memo); result = memo->u1.value; - rb_gc_force_recycle((VALUE)memo); return result; } @@ -676,7 +667,6 @@ enum_min(obj) rb_iterate(rb_each, obj, rb_block_given_p() ? min_ii : min_i, (VALUE)memo); result = memo->u1.value; - rb_gc_force_recycle((VALUE)memo); return result; } @@ -755,7 +745,6 @@ enum_max(obj) rb_iterate(rb_each, obj, rb_block_given_p() ? max_ii : max_i, (VALUE)memo); result = memo->u1.value; - rb_gc_force_recycle((VALUE)memo); return result; } @@ -793,7 +782,6 @@ enum_member(obj, val) rb_iterate(rb_each, obj, member_i, (VALUE)memo); result = memo->u2.value; - rb_gc_force_recycle((VALUE)memo); return result; } @@ -829,7 +817,6 @@ enum_each_with_index(obj) NODE *memo = rb_node_newnode(NODE_MEMO, 0, 0, 0); rb_iterate(rb_each, obj, each_with_index_i, (VALUE)memo); - rb_gc_force_recycle((VALUE)memo); return obj; } @@ -7790,11 +7790,6 @@ blk_copy_prev(block) while (block->prev) { tmp = ALLOC_N(struct BLOCK, 1); MEMCPY(tmp, block->prev, struct BLOCK, 1); - if (tmp->frame.argc > 0) { - tmp->frame.argv = ALLOC_N(VALUE, tmp->frame.argc); - MEMCPY(tmp->frame.argv, block->prev->frame.argv, VALUE, tmp->frame.argc); - tmp->frame.flags |= FRAME_MALLOC; - } scope_dup(tmp->scope); frame_dup(&tmp->frame); @@ -8266,8 +8261,8 @@ proc_eq(self, other) */ static VALUE -proc_to_s(self, other) - VALUE self, other; +proc_to_s(self) + VALUE self; { struct BLOCK *data; NODE *node; diff --git a/ext/bigdecimal/bigdecimal.c b/ext/bigdecimal/bigdecimal.c index 402e13cc5c..4ccba8809a 100644 --- a/ext/bigdecimal/bigdecimal.c +++ b/ext/bigdecimal/bigdecimal.c @@ -579,7 +579,7 @@ BigDecimal_ge(VALUE self, VALUE r) } static VALUE -BigDecimal_neg(VALUE self, VALUE r) +BigDecimal_neg(VALUE self) { ENTER(5); Real *c, *a; diff --git a/ext/dbm/dbm.c b/ext/dbm/dbm.c index c76d667989..143b0a9143 100644 --- a/ext/dbm/dbm.c +++ b/ext/dbm/dbm.c @@ -768,7 +768,7 @@ Init_dbm() rb_define_method(rb_cDBM, "index", fdbm_index, 1); rb_define_method(rb_cDBM, "indexes", fdbm_indexes, -1); rb_define_method(rb_cDBM, "indices", fdbm_indexes, -1); - rb_define_method(rb_cDBM, "select", fdbm_select, -1); + rb_define_method(rb_cDBM, "select", fdbm_select, 0); rb_define_method(rb_cDBM, "values_at", fdbm_values_at, -1); rb_define_method(rb_cDBM, "length", fdbm_length, 0); rb_define_method(rb_cDBM, "size", fdbm_length, 0); diff --git a/ext/enumerator/enumerator.c b/ext/enumerator/enumerator.c index 8c3c566178..6e47330cef 100644 --- a/ext/enumerator/enumerator.c +++ b/ext/enumerator/enumerator.c @@ -70,7 +70,6 @@ enum_each_slice(obj, n) ary = memo->u1.value; if (RARRAY(ary)->len > 0) rb_yield(ary); - rb_gc_force_recycle((VALUE)memo); return Qnil; } @@ -114,7 +113,6 @@ enum_each_cons(obj, n) rb_iterate(rb_each, obj, each_cons_i, (VALUE)memo); - rb_gc_force_recycle((VALUE)memo); return Qnil; } @@ -163,7 +161,6 @@ enumerator_each(obj) rb_to_id(rb_ivar_get(obj, id_enum_method)), rb_ivar_get(obj, id_enum_args)); val = rb_iterate((VALUE (*)_((VALUE)))enumerator_iter, obj, rb_yield, 0); - rb_gc_force_recycle(obj); return val; } diff --git a/ext/socket/socket.c b/ext/socket/socket.c index 21f2bea5d3..f9a821b55d 100644 --- a/ext/socket/socket.c +++ b/ext/socket/socket.c @@ -2130,27 +2130,25 @@ sock_s_getservbyaname(argc, argv) int argc; VALUE *argv; { - VALUE service, protocol; - char *proto; + VALUE service, proto; struct servent *sp; int port; - rb_scan_args(argc, argv, "11", &service, &protocol); - if (NIL_P(protocol)) proto = "tcp"; - else proto = StringValuePtr(protocol); + rb_scan_args(argc, argv, "11", &service, &proto); + if (NIL_P(proto)) proto = rb_str_new2("tcp"); + else StringValue(proto); - StringValue(service); - sp = getservbyname((char*)RSTRING(service)->ptr, proto); + sp = getservbyname((char*)RSTRING(service)->ptr, RSTRING(proto)->ptr); if (sp) { port = ntohs(sp->s_port); } else { - char *s = RSTRING(service)->ptr; + char *s = StringValuePtr(service); char *end; port = strtoul(s, &end, 0); if (*end != '\0') { - rb_raise(rb_eSocket, "no such service %s/%s", s, proto); + rb_raise(rb_eSocket, "no such service %s/%s", s, RSTRING(proto)->ptr); } } return INT2FIX(port); diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c index ad7e91e930..412c98244a 100644 --- a/ext/zlib/zlib.c +++ b/ext/zlib/zlib.c @@ -437,6 +437,7 @@ zstream_expand_buffer(z) z->buf_filled = 0; z->stream.next_out = RSTRING(z->buf)->ptr; z->stream.avail_out = ZSTREAM_INITIAL_BUFSIZE; + RBASIC(z->buf)->klass = 0; return; } @@ -3276,7 +3277,7 @@ void Init_zlib() cZStream = rb_define_class_under(mZlib, "ZStream", rb_cObject); rb_undef_alloc_func(cZStream); rb_define_method(cZStream, "avail_out", rb_zstream_avail_out, 0); - rb_define_method(cZStream, "avail_out=", rb_zstream_set_avail_out, 0); + rb_define_method(cZStream, "avail_out=", rb_zstream_set_avail_out, 1); rb_define_method(cZStream, "avail_in", rb_zstream_avail_in, 0); rb_define_method(cZStream, "total_in", rb_zstream_total_in, 0); rb_define_method(cZStream, "total_out", rb_zstream_total_out, 0); @@ -941,6 +941,7 @@ rb_io_fread(ptr, len, f) if (len > n) { clearerr(f); } + rb_thread_wait_fd(fileno(f)); } if (len == n) return 0; } @@ -994,7 +995,6 @@ read_all(fptr, siz, str) long bytes = 0; long n; - READ_CHECK(fptr->f); if (siz == 0) siz = BUFSIZ; if (NIL_P(str)) { str = rb_tainted_str_new(0, siz); @@ -1004,7 +1004,10 @@ read_all(fptr, siz, str) rb_str_resize(str, siz); } for (;;) { + FL_SET(str, FL_FREEZE); + READ_CHECK(fptr->f); n = rb_io_fread(RSTRING(str)->ptr+bytes, siz-bytes, fptr->f); + FL_UNSET(str, FL_FREEZE); if (n == 0 && bytes == 0) { rb_str_resize(str,0); if (!fptr->f) break; @@ -1232,7 +1235,7 @@ swallow(fptr, term) static VALUE rb_io_getline_fast(fptr, delim) OpenFile *fptr; - int delim; + unsigned char delim; { VALUE str = Qnil; int c; @@ -1248,6 +1251,17 @@ rb_io_getline_fast(fptr, delim) return str; } +static int +rscheck(rsptr, rslen, rs) + char *rsptr; + long rslen; + VALUE rs; +{ + if (RSTRING(rs)->ptr != rsptr && RSTRING(rs)->len != rslen) + rb_raise(rb_eRuntimeError, "rs modified"); + return 1; +} + static VALUE rb_io_getline(rs, fptr) VALUE rs; @@ -1287,6 +1301,7 @@ rb_io_getline(rs, fptr) while ((c = appendline(fptr, newline, &str)) != EOF && (c != newline || RSTRING(str)->len < rslen || + (rspara || rscheck(rsptr,rslen,rs)) || memcmp(RSTRING(str)->ptr+RSTRING(str)->len-rslen,rsptr,rslen))); if (rspara) { @@ -2148,9 +2163,8 @@ rb_io_binmode(io) } char* -rb_io_flags_mode(flags, mode) +rb_io_flags_mode(flags) int flags; - char *mode; { #ifdef O_BINARY # define MODE_BINMODE(a,b) ((flags & FMODE_BINMODE) ? (b) : (a)) @@ -2234,6 +2248,9 @@ rb_io_modenum_flags(mode) if (mode & O_APPEND) { flags |= FMODE_APPEND; } + if (mode & O_CREAT) { + flags |= FMODE_CREATE; + } #ifdef O_BINARY if (mode & O_BINARY) { flags |= FMODE_BINMODE; @@ -2407,13 +2424,12 @@ rb_file_open_internal(io, fname, mode) const char *fname, *mode; { OpenFile *fptr; - char mbuf[MODENUM_MAX]; MakeOpenFile(io, fptr); fptr->mode = rb_io_mode_flags(mode); fptr->path = strdup(fname); - fptr->f = rb_fopen(fptr->path, rb_io_flags_mode(fptr->mode, mbuf)); + fptr->f = rb_fopen(fptr->path, rb_io_flags_mode(fptr->mode)); return io; } @@ -2708,7 +2724,6 @@ rb_io_popen(str, argc, argv, klass) { char *mode; VALUE pname, pmode, port; - char mbuf[MODENUM_MAX]; if (rb_scan_args(argc, argv, "11", &pname, &pmode) == 1) { mode = "r"; @@ -2717,9 +2732,7 @@ rb_io_popen(str, argc, argv, klass) mode = rb_io_modenum_mode(FIX2INT(pmode)); } else { - strncpy(mbuf, StringValuePtr(pmode), sizeof(mbuf) - 1); - mbuf[sizeof(mbuf) - 1] = 0; - mode = mbuf; + mode = rb_io_flags_mode(rb_io_mode_flags(StringValuePtr(pmode))); } SafeStringValue(pname); port = pipe_open(str, mode); @@ -3982,7 +3995,7 @@ next_argv() if (binmode) rb_io_binmode(current_file); } else { - init_p = 0; + next_p = 1; return Qfalse; } } @@ -4945,7 +4958,6 @@ argf_read(argc, argv) retry: if (!next_argv()) { - if (NIL_P(str)) return rb_str_new(0,0); return str; } if (TYPE(current_file) != T_FILE) { diff --git a/lib/cgi/session/pstore.rb b/lib/cgi/session/pstore.rb index 033acc3249..10f3e8f75f 100644 --- a/lib/cgi/session/pstore.rb +++ b/lib/cgi/session/pstore.rb @@ -76,11 +76,7 @@ class CGI def restore unless @hash @p.transaction do - begin - @hash = @p['hash'] - rescue - @hash = {} - end + @hash = @p['hash'] || {} end end @hash diff --git a/lib/delegate.rb b/lib/delegate.rb index a14d62cf5b..ee574cb02b 100644 --- a/lib/delegate.rb +++ b/lib/delegate.rb @@ -75,6 +75,11 @@ class SimpleDelegator<Delegator def __setobj__(obj) @_sd_obj = obj end + + def initialize_copy(obj) + super + __setobj__(obj.__getobj__.clone) + end end # backward compatibility ^_^;;; @@ -103,6 +108,10 @@ def DelegateClass(superclass) def __setobj__(obj) @_dc_obj = obj end + def initialize_copy(obj) + super + __setobj__(obj.__getobj__.clone) + end } for method in methods begin diff --git a/lib/tempfile.rb b/lib/tempfile.rb index b13e5ff61f..cea229132a 100644 --- a/lib/tempfile.rb +++ b/lib/tempfile.rb @@ -111,8 +111,14 @@ class Tempfile < DelegateClass(File) # file. def unlink # keep this order for thread safeness - File.unlink(@tmpname) if File.exist?(@tmpname) - @@cleanlist.delete(@tmpname) if @@cleanlist + begin + File.unlink(@tmpname) if File.exist?(@tmpname) + @@cleanlist.delete(@tmpname) + @data = @tmpname = nil + ObjectSpace.undefine_finalizer(self) + rescue Errno::EACCESS + # may not be able to unlink on Windows; just ignore + end end alias delete unlink diff --git a/lib/xsd/charset.rb b/lib/xsd/charset.rb index 362f13edfc..e0241fdebc 100644 --- a/lib/xsd/charset.rb +++ b/lib/xsd/charset.rb @@ -103,7 +103,7 @@ public end def Charset.charset_str(label) - CharsetMap.index(label.downcase) + CharsetMap.key(label.downcase) end # us_ascii = '[\x00-\x7F]' @@ -1076,8 +1076,8 @@ rb_false(obj) */ static VALUE -rb_obj_pattern_match(obj) - VALUE obj; +rb_obj_pattern_match(obj1, obj2) + VALUE obj1, obj2; { return Qfalse; } @@ -230,13 +230,10 @@ str_step(args) return rb_str_upto(args[0], args[1], EXCL(args[2])); } -#define RANGE_EACH_BREAK Qfalse -#define RANGE_EACH_CONTINUE Qtrue - static void range_each_func(range, func, v, e, arg) VALUE range; - VALUE (*func) _((VALUE, void*)); + void (*func) _((VALUE, void*)); VALUE v, e; void *arg; { @@ -244,13 +241,13 @@ range_each_func(range, func, v, e, arg) if (EXCL(range)) { while (r_lt(v, e)) { - if ((*func)(v, arg) == RANGE_EACH_BREAK) break; + (*func)(v, arg); v = rb_funcall(v, id_succ, 0, 0); } } else { while (RTEST(c = r_le(v, e))) { - if ((*func)(v, arg) == RANGE_EACH_BREAK) break; + (*func)(v, arg); if (c == INT2FIX(0)) break; v = rb_funcall(v, id_succ, 0, 0); } @@ -267,7 +264,7 @@ step_i(i, iter) rb_yield(i); iter[0] = iter[1]; } - return RANGE_EACH_CONTINUE; + return Qnil; } /* @@ -367,13 +364,12 @@ range_step(argc, argv, range) return range; } -static VALUE +static void each_i(v, arg) VALUE v; void *arg; { rb_yield(v); - return RANGE_EACH_CONTINUE; } /* @@ -554,49 +550,11 @@ range_inspect(range) return str; } -static VALUE -member_i(v, args) - VALUE v; - VALUE *args; -{ - if (rb_equal(v, args[0])) { - args[1] = Qtrue; - return RANGE_EACH_BREAK; - } - return RANGE_EACH_CONTINUE; -} - -/* - * call-seq: - * rng.member?(val) => true or false - * - * Return +true+ if _val_ is one of the values in _rng_ (that is if - * <code>Range#each</code> would return _val_ at some point). - */ - -static VALUE -range_member(range, val) - VALUE range, val; -{ - VALUE beg, end; - VALUE args[2]; - - beg = rb_ivar_get(range, id_beg); - end = rb_ivar_get(range, id_end); - - if (!rb_respond_to(beg, id_succ)) { - rb_raise(rb_eTypeError, "cannot iterate from %s", - rb_obj_classname(beg)); - } - args[0] = val; - args[1] = Qfalse; - range_each_func(range, member_i, beg, end, args); - return args[1]; -} - /* * call-seq: - * rng === obj => true or false + * rng === obj => true or false + * rng.member?(val) => true or false + * rng.include?(val) => true or false * * Returns <code>true</code> if <i>obj</i> is an element of * <i>rng</i>, <code>false</code> otherwise. Conveniently, @@ -707,7 +665,7 @@ Init_Range() rb_define_method(rb_cRange, "exclude_end?", range_exclude_end_p, 0); - rb_define_method(rb_cRange, "member?", range_member, 1); + rb_define_method(rb_cRange, "member?", range_include, 1); rb_define_method(rb_cRange, "include?", range_include, 1); id_cmp = rb_intern("<=>"); @@ -1709,7 +1709,7 @@ rb_reg_initialize_m(argc, argv, self) s = StringValuePtr(argv[0]); len = RSTRING(argv[0])->len; } - rb_reg_initialize(self, s, len, flags); + rb_reg_initialize(self, s, len, flags, Qtrue); return self; } @@ -1983,7 +1983,7 @@ rb_reg_init_copy(copy, re) } rb_reg_check(re); rb_reg_initialize(copy, RREGEXP(re)->str, RREGEXP(re)->len, - rb_reg_options(re)); + rb_reg_options(re), Qfalse); return copy; } @@ -30,6 +30,7 @@ typedef struct OpenFile { #define FMODE_WRITABLE 2 #define FMODE_READWRITE 3 #define FMODE_APPEND 64 +#define FMODE_CREATE 128 #define FMODE_BINMODE 4 #define FMODE_SYNC 8 #define FMODE_WBUF 16 @@ -1410,6 +1410,7 @@ rb_str_upto(beg, end, excl) current = rb_funcall(current, succ, 0, 0); StringValue(current); if (excl && rb_str_equal(current, end)) break; + StringValue(current); if (RSTRING(current)->len > RSTRING(end)->len) break; } |