aboutsummaryrefslogtreecommitdiffstats
path: root/load.c
diff options
context:
space:
mode:
authornormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-08-13 00:02:01 +0000
committernormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-08-13 00:02:01 +0000
commit5d7ba76437bbe04d3315a07fda6a4e37a0958350 (patch)
treeddb9b6e094ace467babc36a2f855f4ad35047b1a /load.c
parentf86fdd80b9c36bac7023c60410ef0d081176e436 (diff)
downloadruby-5d7ba76437bbe04d3315a07fda6a4e37a0958350.tar.gz
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
Diffstat (limited to 'load.c')
-rw-r--r--load.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/load.c b/load.c
index 47c3bfe67c..0a8aedaa4d 100644
--- a/load.c
+++ b/load.c
@@ -239,16 +239,19 @@ features_index_add(VALUE feature, VALUE offset)
p = ext ? ext : feature_end;
while (1) {
+ long beg;
+
p--;
while (p >= feature_str && *p != '/')
p--;
if (p < feature_str)
break;
/* 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);
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);
}
}