Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit c17164a

Browse files
committed
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
1 parent 7a7f13a commit c17164a

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

src/backend/utils/activity/generate-wait_event_types.pl

+3-8
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,8 @@
8585
my $trimmedwaiteventname = $waiteventenumname;
8686
$trimmedwaiteventname =~ s/^WAIT_EVENT_//;
8787

88-
# An exception is required for LWLock and Lock as these don't require
89-
# any C and header files generated.
9088
die "wait event names must start with 'WAIT_EVENT_'"
91-
if ( $trimmedwaiteventname eq $waiteventenumname
92-
&& $waiteventenumname !~ /^LWLock/
93-
&& $waiteventenumname !~ /^Lock/);
94-
$continue = ",\n";
89+
if ($trimmedwaiteventname eq $waiteventenumname);
9590
push(@{ $hashwe{$waitclassname} }, @waiteventlist);
9691
}
9792

@@ -141,8 +136,8 @@
141136
# Don't generate .c and .h files for LWLock and Lock, these are
142137
# handled independently.
143138
next
144-
if ( $waitclass =~ /^WaitEventLWLock$/
145-
|| $waitclass =~ /^WaitEventLock$/);
139+
if ( $waitclass eq 'WaitEventLWLock'
140+
|| $waitclass eq 'WaitEventLock');
146141

147142
my $last = $waitclass;
148143
$last =~ s/^WaitEvent//;

0 commit comments

Comments
 (0)