diff options
| author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-09-10 06:25:40 +0000 |
|---|---|---|
| committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-09-10 06:25:40 +0000 |
| commit | f8eb2ce31e4a515e46530a3f480f250651d0c67b (patch) | |
| tree | 694631f7fd4fcb019e94339af134b584e6a2c552 /range.c | |
| parent | 781c483c7c5ee2ad71a8e72200352846589d03cd (diff) | |
| download | ruby-f8eb2ce31e4a515e46530a3f480f250651d0c67b.tar.gz ruby-f8eb2ce31e4a515e46530a3f480f250651d0c67b.tar.xz ruby-f8eb2ce31e4a515e46530a3f480f250651d0c67b.zip | |
* range.c: represent initialized state using EXCL instead of FL_USER3.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@13425 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'range.c')
| -rw-r--r-- | range.c | 7 |
1 files changed, 1 insertions, 6 deletions
@@ -22,8 +22,6 @@ static ID id_cmp, id_succ, id_beg, id_end, id_excl; #define EXCL(r) RTEST(RANGE_EXCL(r)) #define SET_EXCL(r,v) (RSTRUCT(r)->as.ary[2] = (v) ? Qtrue : Qfalse) -#define FL_INITIALIZED FL_USER3 - static VALUE range_alloc(VALUE klass) { @@ -37,8 +35,6 @@ range_alloc(VALUE klass) RBASIC(r)->flags |= n << RSTRUCT_EMBED_LEN_SHIFT; rb_mem_clear(r->as.ary, n); - RBASIC(r)->flags &= ~FL_INITIALIZED; - return (VALUE)r; } @@ -101,10 +97,9 @@ range_initialize(int argc, VALUE *argv, VALUE range) rb_scan_args(argc, argv, "21", &beg, &end, &flags); /* Ranges are immutable, so that they should be initialized only once. */ - if (RBASIC(range)->flags & FL_INITIALIZED) { + if (RANGE_EXCL(range) != Qnil) { rb_name_error(rb_intern("initialize"), "`initialize' called twice"); } - RBASIC(range)->flags |= FL_INITIALIZED; range_init(range, beg, end, RTEST(flags)); return Qnil; } |
