Skip to content

Commit 4ea26bf

Browse files
committed
Remove variable length macros used in debugging, per Karel.
1 parent 7bfc83f commit 4ea26bf

File tree

1 file changed

+10
-28
lines changed

1 file changed

+10
-28
lines changed

src/backend/utils/mb/encnames.c

Lines changed: 10 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Encoding names and routines for work with it. All
33
* in this file is shared bedween FE and BE.
44
*
5-
* $Id: encnames.c,v 1.1 2001/09/07 03:32:11 ishii Exp $
5+
* $Id: encnames.c,v 1.2 2001/09/07 15:01:45 momjian Exp $
66
*/
77
#ifdef FRONTEND
88
#include "postgres_fe.h"
@@ -22,37 +22,23 @@
2222
#include "mb/pg_wchar.h"
2323
#include <ctype.h>
2424

25-
/*
26-
* Debug
27-
*/
28-
/* #define DEBUG_ENCODING */
29-
#ifdef DEBUG_ENCODING
30-
#ifdef FRONTEND
31-
#define encdebug(_format, _a...) fprintf(stderr, _format, ##_a)
32-
#else
33-
#define encdebug(_format, _a...) elog(NOTICE, _format, ##_a)
34-
#endif
35-
#else
36-
#define encdebug(_format, _a...)
37-
#endif
38-
3925
/* ----------
40-
* All encoding names, sorted: *** A L P H A B E T I C ***
26+
* All encoding names, sorted: *** A L P H A B E T I C ***
4127
*
4228
* All names must be without irrelevan chars, search routines use
4329
* isalnum() chars only. It means ISO-8859-1, iso_8859-1 and Iso8859_1
4430
* are always converted to 'iso88591'. All must be lower case.
4531
*
46-
* The table doesn't contain 'cs' aliases (like csISOLatin1). It's needful?
32+
* The table doesn't contain 'cs' aliases (like csISOLatin1). It's needful?
4733
*
4834
* Karel Zak, Aug 2001
4935
* ----------
50-
*/
36+
*/
5137
pg_encname pg_encname_tbl[] =
5238
{
5339
{ "alt", PG_ALT }, /* IBM866 */
5440
{ "big5", PG_BIG5 }, /* Big5; Chinese for Taiwan Multi-byte set */
55-
{ "euccn", PG_EUC_CN }, /* EUC-CN; ??? */
41+
{ "euccn", PG_EUC_CN }, /* EUC-CN; ??? */
5642
{ "eucjp", PG_EUC_JP }, /* EUC-JP; Extended UNIX Code Fixed Width for Japanese, stdandard OSF */
5743
{ "euckr", PG_EUC_KR }, /* EUC-KR; RFC1557,Choi */
5844
{ "euctw", PG_EUC_TW }, /* EUC-TW; ??? */
@@ -88,7 +74,7 @@ unsigned int pg_encname_tbl_sz = \
8874
sizeof(pg_encname_tbl) / sizeof(pg_encname_tbl[0]) -1;
8975

9076
/* ----------
91-
* WARNING: sorted by pg_enc enum (pg_wchar.h)!
77+
* WARNING: sorted by pg_enc enum (pg_wchar.h)!
9278
* ----------
9379
*/
9480
pg_enc2name pg_enc2name_tbl[] =
@@ -179,7 +165,7 @@ pg_char_to_encname_struct(const char *name)
179165
*key;
180166

181167
if(name==NULL || *name=='\0')
182-
return NULL;
168+
return NULL;
183169

184170
if (strlen(name) > NAMEDATALEN)
185171
{
@@ -192,13 +178,11 @@ pg_char_to_encname_struct(const char *name)
192178
}
193179
key = clean_encoding_name((char *) name, buff);
194180

195-
encdebug("Name: %s", key);
196-
197181
while (last >= base)
198-
{
182+
{
199183
position = base + ((last - base) >> 1);
200184
result = key[0] - position->name[0];
201-
185+
202186
if (result == 0)
203187
{
204188
result = strcmp(key, position->name);
@@ -210,8 +194,6 @@ pg_char_to_encname_struct(const char *name)
210194
else
211195
base = position + 1;
212196
}
213-
214-
encdebug("UNKNOWN! encoding");
215197
return NULL;
216198
}
217199

@@ -244,7 +226,7 @@ pg_encoding_to_char(int encoding)
244226
{
245227
if (PG_VALID_ENCODING(encoding))
246228
{
247-
pg_enc2name *p = &pg_enc2name_tbl[ encoding ];
229+
pg_enc2name *p = &pg_enc2name_tbl[ encoding ];
248230
Assert( encoding == p->encoding );
249231
return p->name;
250232
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy