Stop using /(?=)/ since /.+/ is good enough.

Originally, DiskstatsMenu differentiated between an empty pattern
entered by the user (which in the shell version meant "match all")
and any other valid pattern by replacing it with /(?=)/.

However, Diskstats now carries the original string, inside the
OptionParser object, so the above was redundant.
This commit is contained in:
Brian Fraser
2012-01-10 16:10:50 -03:00
parent eaae370f81
commit f173069109
2 changed files with 2 additions and 2 deletions

View File

@@ -45,7 +45,7 @@ sub new {
# Defaults # Defaults
filename => '/proc/diskstats', filename => '/proc/diskstats',
column_regex => qr/cnc|rt|busy|prg|time|io_s/, column_regex => qr/cnc|rt|busy|prg|time|io_s/,
device_regex => qr/(?=)/, device_regex => qr/.+/,
block_size => 512, block_size => 512,
out_fh => \*STDOUT, out_fh => \*STDOUT,
filter_zeroed_rows => $o->get('zero-rows') ? undef : 1, filter_zeroed_rows => $o->get('zero-rows') ? undef : 1,

View File

@@ -413,7 +413,7 @@ sub get_new_regex_for {
# somewhat magical, and basically just asking for trouble. # somewhat magical, and basically just asking for trouble.
# Instead we give them what awk would, a pattern that always # Instead we give them what awk would, a pattern that always
# matches. # matches.
$args{options}->{current_group_by_obj}->$looking_for( qr/(?=)/ ); $args{options}->{current_group_by_obj}->$looking_for( qr/.+/ );
$args{options}->{OptionParser}->set($looking_for_o, ''); $args{options}->{OptionParser}->set($looking_for_o, '');
} }
else { else {