From 3f6153d2cbabb3c964aa0216c5dd866a159d2fb8 Mon Sep 17 00:00:00 2001
From: Kyotaro Horiguchi <horiguchi.kyotaro@lab.ntt.co.jp>
Date: Mon, 5 Dec 2016 17:54:27 +0900
Subject: [PATCH 1/2] Change type for map files as the parameter of UtfToLocal

Each UtfToLocal and LocalToUtf takes map files in definitely one
struct type. They no longer need to be void*.
---
 src/backend/utils/mb/conv.c | 14 ++++++--------
 src/include/mb/pg_wchar.h   |  8 ++++----
 2 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/src/backend/utils/mb/conv.c b/src/backend/utils/mb/conv.c
index 8c0563c..f850487 100644
--- a/src/backend/utils/mb/conv.c
+++ b/src/backend/utils/mb/conv.c
@@ -466,8 +466,8 @@ pg_mb_radix_conv(const pg_mb_radix_tree *rt,
 void
 UtfToLocal(const unsigned char *utf, int len,
 		   unsigned char *iso,
-		   const void *map,
-		   const void *cmap, int cmapsize,
+		   const pg_mb_radix_tree *map,
+		   const pg_utf_to_local *cmap, int cmapsize,
 		   utf_local_conversion_func conv_func,
 		   int encoding)
 {
@@ -600,8 +600,7 @@ UtfToLocal(const unsigned char *utf, int len,
 		/* Now check ordinary map */
 		if (map)
 		{
-			uint32 converted = pg_mb_radix_conv((pg_mb_radix_tree *)map,
-												l, b1, b2, b3, b4);
+			uint32 converted = pg_mb_radix_conv(map, l, b1, b2, b3, b4);
 			if (converted)
 			{
 				iso = store_coded_char(iso, converted);
@@ -658,8 +657,8 @@ UtfToLocal(const unsigned char *utf, int len,
 void
 LocalToUtf(const unsigned char *iso, int len,
 		   unsigned char *utf,
-		   const void *map,
-		   const void *cmap, int cmapsize,
+		   const pg_mb_radix_tree *map,
+		   const pg_local_to_utf *cmap, int cmapsize,
 		   utf_local_conversion_func conv_func,
 		   int encoding)
 {
@@ -725,8 +724,7 @@ LocalToUtf(const unsigned char *iso, int len,
 
 		if (map)
 		{
-			uint32 converted = pg_mb_radix_conv((pg_mb_radix_tree*)map,
-												l, b1, b2, b3, b4);
+			uint32 converted = pg_mb_radix_conv(map, l, b1, b2, b3, b4);
 
 			if (converted)
 			{
diff --git a/src/include/mb/pg_wchar.h b/src/include/mb/pg_wchar.h
index f51418f..7efa600 100644
--- a/src/include/mb/pg_wchar.h
+++ b/src/include/mb/pg_wchar.h
@@ -562,14 +562,14 @@ extern unsigned short CNStoBIG5(unsigned short cns, unsigned char lc);
 
 extern void UtfToLocal(const unsigned char *utf, int len,
 		   unsigned char *iso,
-		   const void *map,
-		   const void *combined_map, int cmapsize,
+		   const pg_mb_radix_tree *map,
+		   const pg_utf_to_local *cmap, int cmapsize,
 		   utf_local_conversion_func conv_func,
 		   int encoding);
 extern void LocalToUtf(const unsigned char *iso, int len,
 		   unsigned char *utf,
-		   const void *map,
-		   const void *combined_cmap, int cmapsize,
+		   const pg_mb_radix_tree *map,
+		   const pg_local_to_utf *cmap, int cmapsize,
 		   utf_local_conversion_func conv_func,
 		   int encoding);
 
-- 
2.9.2

