From 19728cda633b5ab8e207a95bb22c5b526bd239c4 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Wed, 14 Aug 2013 15:17:29 +0200 Subject: [PATCH] Reduce duplication in compile_flag_regexp(). --- bin/blhc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bin/blhc b/bin/blhc index 3abb979..c7457d2 100755 --- a/bin/blhc +++ b/bin/blhc @@ -500,15 +500,17 @@ sub compile_flag_regexp { my @result = (); foreach my $flag (@flags) { + # Compile flag regexp for faster execution. + my $regex = qr/\s$flag(?:\s|\\)/; + # Store flag name in replacement string for correct flags in messages # with qr//ed flag regexps. - $flag_renames_ref->{qr/\s$flag(?:\s|\\)/} + $flag_renames_ref->{$regex} = (exists $flag_renames_ref->{$flag}) ? $flag_renames_ref->{$flag} : $flag; - # Compile flag regexp for faster execution. - push @result, qr/\s$flag(?:\s|\\)/; + push @result, $regex; } return @result; } -- 2.45.2