mirror of
https://github.com/postgres/postgres.git
synced 2025-05-26 00:03:05 -04:00
Simplify some conditions related to [LW]Lock in generate-wait_event_types.pl
The first check on the enum values was not necessary as the values set in wait_event_names.txt for the classes LWLock and Lock were able to satisfy the check. The second check when generating the C and header files is now based on a match of the class names, making it simpler to understand. Author: Masahiro Ikeda, Michael Paquier Discussion: https://postgr.es/m/eaf82a85c0ef1b55dc3b651d3f7b867a@oss.nttdata.com
This commit is contained in:
parent
7a7f13afee
commit
c17164aec8
@ -85,13 +85,8 @@ foreach my $line (@lines_sorted)
|
|||||||
my $trimmedwaiteventname = $waiteventenumname;
|
my $trimmedwaiteventname = $waiteventenumname;
|
||||||
$trimmedwaiteventname =~ s/^WAIT_EVENT_//;
|
$trimmedwaiteventname =~ s/^WAIT_EVENT_//;
|
||||||
|
|
||||||
# An exception is required for LWLock and Lock as these don't require
|
|
||||||
# any C and header files generated.
|
|
||||||
die "wait event names must start with 'WAIT_EVENT_'"
|
die "wait event names must start with 'WAIT_EVENT_'"
|
||||||
if ( $trimmedwaiteventname eq $waiteventenumname
|
if ($trimmedwaiteventname eq $waiteventenumname);
|
||||||
&& $waiteventenumname !~ /^LWLock/
|
|
||||||
&& $waiteventenumname !~ /^Lock/);
|
|
||||||
$continue = ",\n";
|
|
||||||
push(@{ $hashwe{$waitclassname} }, @waiteventlist);
|
push(@{ $hashwe{$waitclassname} }, @waiteventlist);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,8 +136,8 @@ if ($gen_code)
|
|||||||
# Don't generate .c and .h files for LWLock and Lock, these are
|
# Don't generate .c and .h files for LWLock and Lock, these are
|
||||||
# handled independently.
|
# handled independently.
|
||||||
next
|
next
|
||||||
if ( $waitclass =~ /^WaitEventLWLock$/
|
if ( $waitclass eq 'WaitEventLWLock'
|
||||||
|| $waitclass =~ /^WaitEventLock$/);
|
|| $waitclass eq 'WaitEventLock');
|
||||||
|
|
||||||
my $last = $waitclass;
|
my $last = $waitclass;
|
||||||
$last =~ s/^WaitEvent//;
|
$last =~ s/^WaitEvent//;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user