0003-use-better-comment-for-the-0th-reserved-entry-in-the.patch
text/x-patch
Filename: 0003-use-better-comment-for-the-0th-reserved-entry-in-the.patch
Type: text/x-patch
Part: 2
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: format-patch
Series: patch 0003
Subject: use better comment for the 0th 'reserved' entry in the maps
| File | + | − |
|---|---|---|
| src/common/unicode/generate-unicode_case_table.pl | 19 | 14 |
| src/include/common/unicode_case_table.h | 5 | 5 |
From 362cd6c6433b17a95fda879ad449a72613df64dc Mon Sep 17 00:00:00 2001
From: Heikki Linnakangas <heikki.linnakangas@iki.fi>
Date: Fri, 14 Mar 2025 12:16:17 +0200
Subject: [PATCH 3/3] use better comment for the 0th 'reserved' entry in the
maps
---
.../unicode/generate-unicode_case_table.pl | 33 +++++++++++--------
src/include/common/unicode_case_table.h | 10 +++---
2 files changed, 24 insertions(+), 19 deletions(-)
diff --git a/src/common/unicode/generate-unicode_case_table.pl b/src/common/unicode/generate-unicode_case_table.pl
index 1d57cccc4d0..7765b7a5851 100644
--- a/src/common/unicode/generate-unicode_case_table.pl
+++ b/src/common/unicode/generate-unicode_case_table.pl
@@ -330,15 +330,15 @@ foreach my $code (sort { $a <=> $b } (keys %special))
}
print $OT "};\n";
-# Separate maps for each case form with initial empty map. The first
-# element is the result code point, and the second element is the
-# input code point (which is not ultimately stored in the C array,
-# it's just there as a comment).
-my @map_lower = ([ 0, 0 ]);
-my @map_title = ([ 0, 0 ]);
-my @map_upper = ([ 0, 0 ]);
-my @map_fold = ([ 0, 0 ]);
-my @map_special = ([ 0, 0 ]);
+# Separate maps for each case form, starting with the reserved entry
+# at index 0. The first element is the result code point, and the
+# second element is the input code point (which is not ultimately
+# stored in the C array, it's just there as a comment).
+my @map_lower = ([ 0, -1 ]);
+my @map_title = ([ 0, -1 ]);
+my @map_upper = ([ 0, -1 ]);
+my @map_fold = ([ 0, -1 ]);
+my @map_special = ([ 0, -1 ]);
# Current index into the map arrays above.
my $index = 1;
@@ -428,8 +428,9 @@ EOS
foreach my $entry (@map_lower)
{
+ my $comment = @$entry[1] == -1 ? "reserved" : sprintf("U+%06x", @$entry[1]);
print $OT
- sprintf("\t0x%06x,\t\t\t\t\t/* U+%06x */\n", @$entry[0], @$entry[1]);
+ sprintf("\t0x%06x,\t\t\t\t\t/* %s */\n", @$entry[0], $comment);
}
print $OT "\n};\n";
@@ -442,8 +443,9 @@ EOS
foreach my $entry (@map_title)
{
+ my $comment = @$entry[1] == -1 ? "reserved" : sprintf("U+%06x", @$entry[1]);
print $OT
- sprintf("\t0x%06x,\t\t\t\t\t/* U+%06x */\n", @$entry[0], @$entry[1]);
+ sprintf("\t0x%06x,\t\t\t\t\t/* %s */\n", @$entry[0], $comment);
}
print $OT "\n};\n";
@@ -456,8 +458,9 @@ EOS
foreach my $entry (@map_upper)
{
+ my $comment = @$entry[1] == -1 ? "reserved" : sprintf("U+%06x", @$entry[1]);
print $OT
- sprintf("\t0x%06x,\t\t\t\t\t/* U+%06x */\n", @$entry[0], @$entry[1]);
+ sprintf("\t0x%06x,\t\t\t\t\t/* %s */\n", @$entry[0], $comment);
}
print $OT "\n};\n";
@@ -470,8 +473,9 @@ EOS
foreach my $entry (@map_fold)
{
+ my $comment = @$entry[1] == -1 ? "reserved" : sprintf("U+%06x", @$entry[1]);
print $OT
- sprintf("\t0x%06x,\t\t\t\t\t/* U+%06x */\n", @$entry[0], @$entry[1]);
+ sprintf("\t0x%06x,\t\t\t\t\t/* %s */\n", @$entry[0], $comment);
}
print $OT "\n};\n";
@@ -484,8 +488,9 @@ EOS
foreach my $entry (@map_special)
{
+ my $comment = @$entry[1] == -1 ? "reserved" : sprintf("U+%06x", @$entry[1]);
print $OT
- sprintf("\t%d,\t\t\t\t\t/* U+%06x */\n", @$entry[0], @$entry[1]);
+ sprintf("\t%d,\t\t\t\t\t/* %s */\n", @$entry[0], $comment);
}
print $OT "\n};\n";
diff --git a/src/include/common/unicode_case_table.h b/src/include/common/unicode_case_table.h
index bbc4687d9a0..f8a10b84eea 100644
--- a/src/include/common/unicode_case_table.h
+++ b/src/include/common/unicode_case_table.h
@@ -164,7 +164,7 @@ static const pg_special_case special_case[106] =
static const pg_wchar case_map_lower[1677] =
{
- 0x000000, /* U+000000 */
+ 0x000000, /* reserved */
0x000000, /* U+000000 */
0x000001, /* U+000001 */
0x000002, /* U+000002 */
@@ -1846,7 +1846,7 @@ static const pg_wchar case_map_lower[1677] =
static const pg_wchar case_map_title[1677] =
{
- 0x000000, /* U+000000 */
+ 0x000000, /* reserved */
0x000000, /* U+000000 */
0x000001, /* U+000001 */
0x000002, /* U+000002 */
@@ -3528,7 +3528,7 @@ static const pg_wchar case_map_title[1677] =
static const pg_wchar case_map_upper[1677] =
{
- 0x000000, /* U+000000 */
+ 0x000000, /* reserved */
0x000000, /* U+000000 */
0x000001, /* U+000001 */
0x000002, /* U+000002 */
@@ -5210,7 +5210,7 @@ static const pg_wchar case_map_upper[1677] =
static const pg_wchar case_map_fold[1677] =
{
- 0x000000, /* U+000000 */
+ 0x000000, /* reserved */
0x000000, /* U+000000 */
0x000001, /* U+000001 */
0x000002, /* U+000002 */
@@ -6892,7 +6892,7 @@ static const pg_wchar case_map_fold[1677] =
static const uint8 case_map_special[1677] =
{
- 0, /* U+000000 */
+ 0, /* reserved */
0, /* U+000000 */
0, /* U+000001 */
0, /* U+000002 */
--
2.39.5