[前][次][番号順一覧][スレッド一覧]

ruby-changes:71208

From: Shugo <ko1@a...>
Date: Fri, 18 Feb 2022 22:15:40 +0900 (JST)
Subject: [ruby-changes:71208] cda5aee74e (master): LONG2NUM() should be used for rmatch_offset::{beg, end}

https://git.ruby-lang.org/ruby.git/commit/?id=cda5aee74e

From cda5aee74e298cca9ffaa42fdc99e8de2e05fb0e Mon Sep 17 00:00:00 2001
From: Shugo Maeda <shugo@r...>
Date: Fri, 18 Feb 2022 19:47:08 +0900
Subject: LONG2NUM() should be used for rmatch_offset::{beg,end}

https://github.com/ruby/ruby/pull/5518#discussion_r809645406
---
 re.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/re.c b/re.c
index 49b619ed9c..66519effcd 100644
--- a/re.c
+++ b/re.c
@@ -1230,8 +1230,8 @@ match_offset(VALUE match, VALUE n) https://github.com/ruby/ruby/blob/trunk/re.c#L1230
 	return rb_assoc_new(Qnil, Qnil);
 
     update_char_offset(match);
-    return rb_assoc_new(INT2FIX(RMATCH(match)->rmatch->char_offset[i].beg),
-			INT2FIX(RMATCH(match)->rmatch->char_offset[i].end));
+    return rb_assoc_new(LONG2NUM(RMATCH(match)->rmatch->char_offset[i].beg),
+                        LONG2NUM(RMATCH(match)->rmatch->char_offset[i].end));
 }
 
 
@@ -1265,7 +1265,7 @@ match_begin(VALUE match, VALUE n) https://github.com/ruby/ruby/blob/trunk/re.c#L1265
 	return Qnil;
 
     update_char_offset(match);
-    return INT2FIX(RMATCH(match)->rmatch->char_offset[i].beg);
+    return LONG2NUM(RMATCH(match)->rmatch->char_offset[i].beg);
 }
 
 
@@ -1299,7 +1299,7 @@ match_end(VALUE match, VALUE n) https://github.com/ruby/ruby/blob/trunk/re.c#L1299
 	return Qnil;
 
     update_char_offset(match);
-    return INT2FIX(RMATCH(match)->rmatch->char_offset[i].end);
+    return LONG2NUM(RMATCH(match)->rmatch->char_offset[i].end);
 }
 
 /*
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]