Skip to content

Commit

Permalink
indent
Browse files Browse the repository at this point in the history
* encoding.c (enc_compatible_latter): adjust indent.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52355 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
nobu committed Oct 29, 2015
1 parent 7b9b1e0 commit 4e1ea79
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Thu Oct 29 18:42:30 2015 Koichi Sasada <ko1@atdot.net>
Thu Oct 29 18:05:22 2015 Koichi Sasada <ko1@atdot.net>

* encoding.c (rb_enc_check_str): add for performance.
This function only accept T_STRING (and T_REGEXP).
This function only accepts T_STRING (and T_REGEXP).

This patch improves performance of a tiny_segmenter benchmark
(num=2) 2.54sec -> 2.42sec on my machine.
Expand Down
10 changes: 5 additions & 5 deletions encoding.c
Original file line number Diff line number Diff line change
Expand Up @@ -890,19 +890,19 @@ enc_compatible_latter(VALUE str1, VALUE str2, int idx1, int idx2)

isstr2 = RB_TYPE_P(str2, T_STRING);
if (isstr2 && RSTRING_LEN(str2) == 0)
return enc1;
return enc1;
isstr1 = RB_TYPE_P(str1, T_STRING);
if (isstr1 && RSTRING_LEN(str1) == 0)
return (rb_enc_asciicompat(enc1) && rb_enc_str_asciionly_p(str2)) ? enc1 : enc2;
return (rb_enc_asciicompat(enc1) && rb_enc_str_asciionly_p(str2)) ? enc1 : enc2;
if (!rb_enc_asciicompat(enc1) || !rb_enc_asciicompat(enc2)) {
return 0;
}

/* objects whose encoding is the same of contents */
if (!isstr2 && idx2 == ENCINDEX_US_ASCII)
return enc1;
return enc1;
if (!isstr1 && idx1 == ENCINDEX_US_ASCII)
return enc2;
return enc2;

if (!isstr1) {
VALUE tmp = str1;
Expand Down Expand Up @@ -931,7 +931,7 @@ enc_compatible_latter(VALUE str1, VALUE str2, int idx1, int idx2)
}
}
if (cr1 == ENC_CODERANGE_7BIT)
return enc2;
return enc2;
}
return 0;
}
Expand Down

0 comments on commit 4e1ea79

Please sign in to comment.