From 31ab31f409ea3305105822d91fd688ecd35b594d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dagfinn=20Ilmari=20Manns=C3=A5ker?= <ilmari@ilmari.org>
Date: Tue, 2 Jul 2024 16:25:15 +0100
Subject: [PATCH 2/3] Fix unused regular expression captures

Remove unused captures, actually use the capture, or fix the capture
number used, as appropriate.
---
 src/backend/catalog/Catalog.pm                          | 2 +-
 src/backend/utils/activity/generate-wait_event_types.pl | 5 ++---
 src/backend/utils/mb/Unicode/convutils.pm               | 4 ++--
 3 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/src/backend/catalog/Catalog.pm b/src/backend/catalog/Catalog.pm
index 8e709524cb..59ebe5f434 100644
--- a/src/backend/catalog/Catalog.pm
+++ b/src/backend/catalog/Catalog.pm
@@ -69,7 +69,7 @@ sub ParseHeader
 		if (!$is_client_code)
 		{
 			# Strip C-style comments.
-			s;/\*(.|\n)*\*/;;g;
+			s;/\*.*\*/;;gs;
 			if (m;/\*;)
 			{
 
diff --git a/src/backend/utils/activity/generate-wait_event_types.pl b/src/backend/utils/activity/generate-wait_event_types.pl
index 2f2fa5bb8f..4e8dc63e6b 100644
--- a/src/backend/utils/activity/generate-wait_event_types.pl
+++ b/src/backend/utils/activity/generate-wait_event_types.pl
@@ -55,10 +55,9 @@
 	next if /^\s*$/;
 
 	# Get waitclassname based on the section
-	if (/^Section: ClassName(.*)/)
+	if (/^Section: ClassName - (\w+)/)
 	{
-		$section_name = $_;
-		$section_name =~ s/^.*- //;
+		$section_name = $1;
 		$abi_compatibility = 0;
 		next;
 	}
diff --git a/src/backend/utils/mb/Unicode/convutils.pm b/src/backend/utils/mb/Unicode/convutils.pm
index ee780acbe3..1b453d1eba 100644
--- a/src/backend/utils/mb/Unicode/convutils.pm
+++ b/src/backend/utils/mb/Unicode/convutils.pm
@@ -41,7 +41,7 @@ sub read_source
 
 		next if (/^$/);    # Ignore empty lines
 
-		next if (/^0x([0-9A-F]+)\s+(#.*)$/);
+		next if (/^0x[0-9A-F]+\s+#.*$/);
 
 		# The Unicode source files have three columns
 		# 1: The "foreign" code (in hex)
@@ -55,7 +55,7 @@ sub read_source
 		my $out = {
 			code => hex($1),
 			ucs => hex($2),
-			comment => $4,
+			comment => $3,
 			direction => BOTH,
 			f => $fname,
 			l => $.
-- 
2.39.2

