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

ruby-changes:66096

From: Nobuyoshi <ko1@a...>
Date: Fri, 7 May 2021 22:16:01 +0900 (JST)
Subject: [ruby-changes:66096] 40612d55c6 (master): Fixed shorten-64-to-32 errors when USE_COMBINATION_EXPLOSION_CHECK

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

From 40612d55c628cb80dc7cb2b98bad8d8cde9c1f75 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Fri, 7 May 2021 18:41:48 +0900
Subject: Fixed shorten-64-to-32 errors when USE_COMBINATION_EXPLOSION_CHECK

---
 regcomp.c | 2 --
 regexec.c | 8 ++++----
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/regcomp.c b/regcomp.c
index 3a438b9..44ee0b2 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -3755,10 +3755,8 @@ setup_comb_exp_check(Node* node, int state, ScanEnv* env) https://github.com/ruby/ruby/blob/trunk/regcomp.c#L3755
   switch (type) {
   case NT_LIST:
     {
-      Node* prev = NULL_NODE;
       do {
 	r = setup_comb_exp_check(NCAR(node), r, env);
-	prev = NCAR(node);
       } while (r >= 0 && IS_NOT_NULL(node = NCDR(node)));
     }
     break;
diff --git a/regexec.c b/regexec.c
index 10ada4d..8334b16 100644
--- a/regexec.c
+++ b/regexec.c
@@ -601,7 +601,7 @@ stack_double(OnigStackType** arg_stk_base, OnigStackType** arg_stk_end, https://github.com/ruby/ruby/blob/trunk/regexec.c#L601
   (((s) - str) * num_comb_exp_check + ((snum) - 1))
 # define STATE_CHECK_VAL(v,snum) do {\
   if (state_check_buff != NULL) {\
-    int x = STATE_CHECK_POS(s,snum);\
+    ptrdiff_t x = STATE_CHECK_POS(s,snum);\
     (v) = state_check_buff[x/8] & (1<<(x%8));\
   }\
   else (v) = 0;\
@@ -610,7 +610,7 @@ stack_double(OnigStackType** arg_stk_base, OnigStackType** arg_stk_end, https://github.com/ruby/ruby/blob/trunk/regexec.c#L610
 
 # define ELSE_IF_STATE_CHECK_MARK(stk) \
   else if ((stk)->type == STK_STATE_CHECK_MARK) { \
-    int x = STATE_CHECK_POS(stk->u.state.pstr, stk->u.state.state_check);\
+    ptrdiff_t x = STATE_CHECK_POS(stk->u.state.pstr, stk->u.state.state_check);\
     state_check_buff[x/8] |= (1<<(x%8));				\
   }
 
@@ -3873,7 +3873,7 @@ onig_match(regex_t* reg, const UChar* str, const UChar* end, const UChar* at, On https://github.com/ruby/ruby/blob/trunk/regexec.c#L3873
   MATCH_ARG_INIT(msa, option, region, at, at);
 #ifdef USE_COMBINATION_EXPLOSION_CHECK
   {
-    int offset = at - str;
+    ptrdiff_t offset = at - str;
     STATE_CHECK_BUFF_INIT(msa, end - str, offset, reg->num_comb_exp_check);
   }
 #endif
@@ -4352,7 +4352,7 @@ onig_search_gpos(regex_t* reg, const UChar* str, const UChar* end, https://github.com/ruby/ruby/blob/trunk/regexec.c#L4352
   MATCH_ARG_INIT(msa, option, region, start, global_pos);
 #ifdef USE_COMBINATION_EXPLOSION_CHECK
   {
-    int offset = (MIN(start, range) - str);
+    ptrdiff_t offset = (MIN(start, range) - str);
     STATE_CHECK_BUFF_INIT(msa, end - str, offset, reg->num_comb_exp_check);
   }
 #endif
-- 
cgit v1.1


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

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