Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit d326924

Browse files
removed variable consider_overlapping_ and used its expression directly in the if-else statement
1 parent 88f38dd commit d326924

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

‎src/stdlib_strings.f90‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -454,9 +454,7 @@ elemental function find_char_char(string, pattern, occurrence, consider_overlapp
454454
logical, intent(in), optional :: consider_overlapping
455455
integer :: lps_array(len(pattern))
456456
integer :: res, s_i, p_i, length_string, length_pattern, occurrence_
457-
logical :: consider_overlapping_
458457

459-
consider_overlapping_ = optval(consider_overlapping, .true.)
460458
occurrence_ = optval(occurrence, 1)
461459
res = 0
462460
length_string = len(string)
@@ -475,7 +473,7 @@ elemental function find_char_char(string, pattern, occurrence, consider_overlapp
475473
if (occurrence_ == 0) then
476474
res = s_i - length_pattern + 1
477475
exit
478-
else if (consider_overlapping_) then
476+
else if (optval(consider_overlapping, .true.)) then
479477
p_i = lps_array(p_i)
480478
else
481479
p_i = 0
@@ -708,9 +706,7 @@ elemental function count_char_char(string, pattern, consider_overlapping) result
708706
logical, intent(in), optional :: consider_overlapping
709707
integer :: lps_array(len(pattern))
710708
integer :: res, s_i, p_i, length_string, length_pattern
711-
logical :: consider_overlapping_
712709

713-
consider_overlapping_ = optval(consider_overlapping, .true.)
714710
res = 0
715711
length_string = len(string)
716712
length_pattern = len(pattern)
@@ -724,7 +720,7 @@ elemental function count_char_char(string, pattern, consider_overlapping) result
724720
if (string(s_i:s_i) == pattern(p_i:p_i)) then
725721
if (p_i == length_pattern) then
726722
res = res + 1
727-
if (consider_overlapping_) then
723+
if (optval(consider_overlapping, .true.)) then
728724
p_i = lps_array(p_i)
729725
else
730726
p_i = 0

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /