These programs in src/backend/utils/mb/ are unused, and have been unused
and unusable since 2003:
iso.c
win1251.c
win866.c
Attached patch removes them. See commit message for a little more
detailed analysis.
--
Heikki Linnakangas
Neon (https://neon.tech)
From 2c2c82757749534bd47348e5385cbb2b8363bf5b Mon Sep 17 00:00:00 2001
From: Heikki Linnakangas <heikki.linnakan...@iki.fi>
Date: Mon, 29 Jul 2024 14:12:28 +0300
Subject: [PATCH 1/1] Remove dead generators for cyrillic encoding converson
tables
These tools were used to read the koi-iso.tab, koi-win.tab, and
koi-alt.tab files, which contained the mappings between the
single-byte cyrillic encodings. However, those data files were removed
in commit 4c3c8c048d, back in 2003. These code generators have been
unused and unusable ever since.
The generated tables live in cyrillic_and_mic.c. There has been one
change to the tables since they were generated in 1999, in commit
f4b7624eb07a. So if we resurrected the original data tables, that
change would need to be taken into account.
So this code is very dead. The tables in cyrillic_and_mic.c, which
were originally generated by these tools, are now the authoritative
source for these mappings.
Discussion: xxx
---
src/backend/utils/mb/README | 3 --
src/backend/utils/mb/iso.c | 74 ----------------------------------
src/backend/utils/mb/win1251.c | 74 ----------------------------------
src/backend/utils/mb/win866.c | 74 ----------------------------------
4 files changed, 225 deletions(-)
delete mode 100644 src/backend/utils/mb/iso.c
delete mode 100644 src/backend/utils/mb/win1251.c
delete mode 100644 src/backend/utils/mb/win866.c
diff --git a/src/backend/utils/mb/README b/src/backend/utils/mb/README
index ef366268913..4447881ead0 100644
--- a/src/backend/utils/mb/README
+++ b/src/backend/utils/mb/README
@@ -8,9 +8,6 @@ mbutils.c: public functions for the backend only.
stringinfo_mb.c: public backend-only multibyte-aware stringinfo functions
wstrcmp.c: strcmp for mb
wstrncmp.c: strncmp for mb
-win866.c: a tool to generate KOI8 <--> CP866 conversion table
-iso.c: a tool to generate KOI8 <--> ISO8859-5 conversion table
-win1251.c: a tool to generate KOI8 <--> CP1251 conversion table
See also in src/common/:
diff --git a/src/backend/utils/mb/iso.c b/src/backend/utils/mb/iso.c
deleted file mode 100644
index d5dae56339f..00000000000
--- a/src/backend/utils/mb/iso.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * make KOI8->ISO8859-5 and ISO8859-5->KOI8 translation table
- * from koi-iso.tab.
- *
- * Tatsuo Ishii
- *
- * src/backend/utils/mb/iso.c
- */
-
-#include <stdio.h>
-
-
-main()
-{
- int i;
- char koitab[128],
- isotab[128];
- char buf[4096];
- int koi,
- iso;
-
- for (i = 0; i < 128; i++)
- koitab[i] = isotab[i] = 0;
-
- while (fgets(buf, sizeof(buf), stdin) != NULL)
- {
- if (*buf == '#')
- continue;
- sscanf(buf, "%d %x", &koi, &iso);
- if (koi < 128 || koi > 255 || iso < 128 || iso > 255)
- {
- fprintf(stderr, "invalid value %d\n", koi);
- exit(1);
- }
- koitab[koi - 128] = iso;
- isotab[iso - 128] = koi;
- }
-
- i = 0;
- printf("static char koi2iso[] = {\n");
- while (i < 128)
- {
- int j = 0;
-
- while (j < 8)
- {
- printf("0x%02x", koitab[i++]);
- j++;
- if (i >= 128)
- break;
- printf(", ");
- }
- printf("\n");
- }
- printf("};\n");
-
- i = 0;
- printf("static char iso2koi[] = {\n");
- while (i < 128)
- {
- int j = 0;
-
- while (j < 8)
- {
- printf("0x%02x", isotab[i++]);
- j++;
- if (i >= 128)
- break;
- printf(", ");
- }
- printf("\n");
- }
- printf("};\n");
-}
diff --git a/src/backend/utils/mb/win1251.c b/src/backend/utils/mb/win1251.c
deleted file mode 100644
index 75129e6eff8..00000000000
--- a/src/backend/utils/mb/win1251.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * make KOI8->CP1251(win-1251) and CP1251(win-1251)->KOI8 translation table
- * from koi-win.tab.
- *
- * Tatsuo Ishii
- *
- * src/backend/utils/mb/win1251.c
- */
-
-#include <stdio.h>
-
-
-main()
-{
- int i;
- char koitab[128],
- wintab[128];
- char buf[4096];
- int koi,
- win;
-
- for (i = 0; i < 128; i++)
- koitab[i] = wintab[i] = 0;
-
- while (fgets(buf, sizeof(buf), stdin) != NULL)
- {
- if (*buf == '#')
- continue;
- sscanf(buf, "%d %d", &koi, &win);
- if (koi < 128 || koi > 255 || win < 128 || win > 255)
- {
- fprintf(stderr, "invalid value %d\n", koi);
- exit(1);
- }
- koitab[koi - 128] = win;
- wintab[win - 128] = koi;
- }
-
- i = 0;
- printf("static char koi2win[] = {\n");
- while (i < 128)
- {
- int j = 0;
-
- while (j < 8)
- {
- printf("0x%02x", koitab[i++]);
- j++;
- if (i >= 128)
- break;
- printf(", ");
- }
- printf("\n");
- }
- printf("};\n");
-
- i = 0;
- printf("static char win2koi[] = {\n");
- while (i < 128)
- {
- int j = 0;
-
- while (j < 8)
- {
- printf("0x%02x", wintab[i++]);
- j++;
- if (i >= 128)
- break;
- printf(", ");
- }
- printf("\n");
- }
- printf("};\n");
-}
diff --git a/src/backend/utils/mb/win866.c b/src/backend/utils/mb/win866.c
deleted file mode 100644
index f98c3764503..00000000000
--- a/src/backend/utils/mb/win866.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * make KOI8->CP866(ALT) and CP866(ALT)->KOI8 translation table
- * from koi-alt.tab.
- *
- * Tatsuo Ishii
- *
- * src/backend/utils/mb/win866.c
- */
-
-#include <stdio.h>
-
-
-main()
-{
- int i;
- char koitab[128],
- alttab[128];
- char buf[4096];
- int koi,
- alt;
-
- for (i = 0; i < 128; i++)
- koitab[i] = alttab[i] = 0;
-
- while (fgets(buf, sizeof(buf), stdin) != NULL)
- {
- if (*buf == '#')
- continue;
- sscanf(buf, "%d %d", &koi, &alt);
- if (koi < 128 || koi > 255 || alt < 128 || alt > 255)
- {
- fprintf(stderr, "invalid value %d\n", koi);
- exit(1);
- }
- koitab[koi - 128] = alt;
- alttab[alt - 128] = koi;
- }
-
- i = 0;
- printf("static char koi2alt[] = {\n");
- while (i < 128)
- {
- int j = 0;
-
- while (j < 8)
- {
- printf("0x%02x", koitab[i++]);
- j++;
- if (i >= 128)
- break;
- printf(", ");
- }
- printf("\n");
- }
- printf("};\n");
-
- i = 0;
- printf("static char alt2koi[] = {\n");
- while (i < 128)
- {
- int j = 0;
-
- while (j < 8)
- {
- printf("0x%02x", alttab[i++]);
- j++;
- if (i >= 128)
- break;
- printf(", ");
- }
- printf("\n");
- }
- printf("};\n");
-}
--
2.39.2