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

ruby-changes:63485

From: Alan <ko1@a...>
Date: Sat, 31 Oct 2020 08:38:51 +0900 (JST)
Subject: [ruby-changes:63485] 520b86caf1 (master): Move variable closer to usage

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

From 520b86caf1b6e954c5fbe61a3a83bc5b4716c988 Mon Sep 17 00:00:00 2001
From: Alan Wu <alanwu@r...>
Date: Fri, 30 Oct 2020 19:34:41 -0400
Subject: Move variable closer to usage


diff --git a/string.c b/string.c
index 069aef1..3dc9aa6 100644
--- a/string.c
+++ b/string.c
@@ -3563,7 +3563,6 @@ rb_strseq_index(VALUE str, VALUE sub, long offset, int in_byte) https://github.com/ruby/ruby/blob/trunk/string.c#L3563
 {
     const char *str_ptr, *str_ptr_end, *sub_ptr;
     long str_len, sub_len;
-    int single_byte = single_byte_optimizable(str);
     rb_encoding *enc;
 
     enc = rb_enc_check(str, sub);
@@ -3579,6 +3578,7 @@ rb_strseq_index(VALUE str, VALUE sub, long offset, int in_byte) https://github.com/ruby/ruby/blob/trunk/string.c#L3578
 
     if (offset != 0) {
 	long str_len_char, sub_len_char;
+        int single_byte = single_byte_optimizable(str);
 	str_len_char = (in_byte || single_byte) ? str_len : str_strlen(str, enc);
 	sub_len_char = in_byte ? sub_len : str_strlen(sub, enc);
 	if (offset < 0) {
-- 
cgit v0.10.2


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

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