mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
load.c (features_index_add): avoid repeat calculation
Reduce cognitive overhead, eye strain and keep lines less than 80 columns to benefit users of giant fonts (honestly I prefer 64 column wrap :P). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51559 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
ccdcaf6b78
commit
efef2c6308
2 changed files with 9 additions and 2 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
Thu Aug 13 09:01:25 2015 Eric Wong <e@80x24.org>
|
||||||
|
|
||||||
|
* load.c (features_index_add): avoid repeat calculation
|
||||||
|
|
||||||
Wed Aug 12 21:57:31 2015 Koichi Sasada <ko1@atdot.net>
|
Wed Aug 12 21:57:31 2015 Koichi Sasada <ko1@atdot.net>
|
||||||
|
|
||||||
* id_table.c: IMPL() macro accept op as _opname instead of opname
|
* id_table.c: IMPL() macro accept op as _opname instead of opname
|
||||||
|
|
7
load.c
7
load.c
|
@ -239,16 +239,19 @@ features_index_add(VALUE feature, VALUE offset)
|
||||||
|
|
||||||
p = ext ? ext : feature_end;
|
p = ext ? ext : feature_end;
|
||||||
while (1) {
|
while (1) {
|
||||||
|
long beg;
|
||||||
|
|
||||||
p--;
|
p--;
|
||||||
while (p >= feature_str && *p != '/')
|
while (p >= feature_str && *p != '/')
|
||||||
p--;
|
p--;
|
||||||
if (p < feature_str)
|
if (p < feature_str)
|
||||||
break;
|
break;
|
||||||
/* Now *p == '/'. We reach this point for every '/' in `feature`. */
|
/* Now *p == '/'. We reach this point for every '/' in `feature`. */
|
||||||
short_feature = rb_str_subseq(feature, p + 1 - feature_str, feature_end - p - 1);
|
beg = p + 1 - feature_str;
|
||||||
|
short_feature = rb_str_subseq(feature, beg, feature_end - p - 1);
|
||||||
features_index_add_single(short_feature, offset);
|
features_index_add_single(short_feature, offset);
|
||||||
if (ext) {
|
if (ext) {
|
||||||
short_feature = rb_str_subseq(feature, p + 1 - feature_str, ext - p - 1);
|
short_feature = rb_str_subseq(feature, beg, ext - p - 1);
|
||||||
features_index_add_single(short_feature, offset);
|
features_index_add_single(short_feature, offset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue