Revert "Rename unicode_combining_table to unicode_width_table"
authorJohn Naylor <john.naylor@postgresql.org>
Thu, 26 Aug 2021 14:06:12 +0000 (10:06 -0400)
committerJohn Naylor <john.naylor@postgresql.org>
Thu, 26 Aug 2021 14:06:12 +0000 (10:06 -0400)
This reverts commit eb0d0d2c7300c9c5c22b35975c11265aa4becc84.

After I had committed eb0d0d2c7 and 78ab944cd, I decided to add
a sanity check for a "can't happen" scenario just to be cautious.
It turned out that it already happened in the official Unicode source
data, namely that a character can be both wide and a combining
character. This fact renders the aforementioned commits unnecessary,
so revert both of them.

Discussion: https://www.postgresql.org/message-id/CAFBsxsH5ejH4-1xaTLpSK8vWoK1m6fA1JBtTM6jmBsLfmDki1g%40mail.gmail.com

src/common/unicode/Makefile
src/common/unicode/generate-unicode_combining_table.pl [moved from src/common/unicode/generate-unicode_width_table.pl with 91% similarity]
src/common/wchar.c
src/include/common/unicode_combining_table.h [moved from src/include/common/unicode_width_table.h with 97% similarity]

index 499e31d59f05747b9cec836acbfe8e5829ea6c29..eb14add28ad6ddc512414c7d0a52e5cf17c9b893 100644 (file)
@@ -18,7 +18,7 @@ LIBS += $(PTHREAD_LIBS)
 # By default, do nothing.
 all:
 
-update-unicode: unicode_norm_table.h unicode_width_table.h unicode_normprops_table.h unicode_norm_hashfunc.h
+update-unicode: unicode_norm_table.h unicode_combining_table.h unicode_normprops_table.h unicode_norm_hashfunc.h
    mv $^ ../../../src/include/common/
    $(MAKE) normalization-check
 
@@ -35,7 +35,7 @@ unicode_norm_hashfunc.h: unicode_norm_table.h
 unicode_norm_table.h: generate-unicode_norm_table.pl UnicodeData.txt CompositionExclusions.txt
    $(PERL) generate-unicode_norm_table.pl
 
-unicode_width_table.h: generate-unicode_width_table.pl UnicodeData.txt
+unicode_combining_table.h: generate-unicode_combining_table.pl UnicodeData.txt
    $(PERL) $^ >$@
 
 unicode_normprops_table.h: generate-unicode_normprops_table.pl DerivedNormalizationProps.txt
similarity index 91%
rename from src/common/unicode/generate-unicode_width_table.pl
rename to src/common/unicode/generate-unicode_combining_table.pl
index 90b57af075e7cc478c55def7df7e5e8c55527f25..86aed7890708b5088ef389d1c1ba5d3b245b12a6 100644 (file)
@@ -15,7 +15,7 @@ my $prev_codepoint;
 my $count = 0;
 
 print
-  "/* generated by src/common/unicode/generate-unicode_width_table.pl, do not edit */\n\n";
+  "/* generated by src/common/unicode/generate-unicode_combining_table.pl, do not edit */\n\n";
 
 print "static const struct mbinterval combining[] = {\n";
 
index bb97b5f54f4a6f40ca58f24335d3395a3136a1b0..0636b8765ba358a382fccabab376adabe75e44c9 100644 (file)
@@ -644,7 +644,7 @@ mbbisearch(pg_wchar ucs, const struct mbinterval *table, int max)
 static int
 ucs_wcwidth(pg_wchar ucs)
 {
-#include "common/unicode_width_table.h"
+#include "common/unicode_combining_table.h"
 
    /* test for 8-bit control characters */
    if (ucs == 0)
similarity index 97%
rename from src/include/common/unicode_width_table.h
rename to src/include/common/unicode_combining_table.h
index 3a02ed5c6266e1da8a92ab7a4ee4a40eeb98c792..a9f10c31bc8a44b73b06b23aa5c96ef973e50101 100644 (file)
@@ -1,4 +1,4 @@
-/* generated by src/common/unicode/generate-unicode_width_table.pl, do not edit */
+/* generated by src/common/unicode/generate-unicode_combining_table.pl, do not edit */
 
 static const struct mbinterval combining[] = {
    {0x0300, 0x036F},