summaryrefslogtreecommitdiff
path: root/range.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-07-24 09:48:21 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-07-24 09:48:21 +0000
commit7f3bfeb579a64646f9860507a6d96432f78e7e99 (patch)
tree26d71325d8b61fd763b11eb23bec0b30c8004c24 /range.c
parentadac65af9391f56e964066310ff1d61f65dccc8e (diff)
* range.c (rb_range_beg_len): returns Qnil only when "beg" points
outside of a range. No boundary check for "end". git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@6692 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'range.c')
-rw-r--r--range.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/range.c b/range.c
index 46cc6d0..be0896b 100644
--- a/range.c
+++ b/range.c
@@ -480,14 +480,12 @@ rb_range_beg_len(range, begp, lenp, len, err)
}
if (err == 0 || err == 2) {
if (beg > len) goto out_of_range;
- if (end > len)
- end = len;
+ if (end > len) end = len;
}
if (end < 0) end += len;
if (!EXCL(range)) end++; /* include end point */
- if (end < 0) goto out_of_range;
len = end - beg;
- if (len < 0) goto out_of_range;
+ if (len < 0) len = 0;
*begp = beg;
*lenp = len;