Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commited7baea

Browse files
committed
Remove #ifdef MULTIBYTE per hackers list discussion.
1 parent8e80dbb commited7baea

File tree

31 files changed

+81
-761
lines changed

31 files changed

+81
-761
lines changed

‎src/backend/commands/copy.c

Lines changed: 5 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.168 2002/08/2900:17:03 tgl Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.169 2002/08/2907:22:21 ishii Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -39,10 +39,7 @@
3939
#include"utils/relcache.h"
4040
#include"utils/lsyscache.h"
4141
#include"utils/syscache.h"
42-
43-
#ifdefMULTIBYTE
4442
#include"mb/pg_wchar.h"
45-
#endif
4643

4744
#defineISOCTAL(c) (((c) >= '0') && ((c) <= '7'))
4845
#defineOCTVALUE(c) ((c) - '0')
@@ -85,11 +82,8 @@ static bool fe_eof;
8582
*/
8683
staticStringInfoDataattribute_buf;
8784

88-
#ifdefMULTIBYTE
8985
staticintclient_encoding;
9086
staticintserver_encoding;
91-
#endif
92-
9387

9488
/*
9589
* Internal communications functions
@@ -387,10 +381,9 @@ DoCopy(const CopyStmt *stmt)
387381
* Set up variables to avoid per-attribute overhead.
388382
*/
389383
initStringInfo(&attribute_buf);
390-
#ifdefMULTIBYTE
384+
391385
client_encoding=pg_get_client_encoding();
392386
server_encoding=GetDatabaseEncoding();
393-
#endif
394387

395388
if (is_from)
396389
{/* copy from file to database */
@@ -1231,14 +1224,12 @@ CopyReadAttribute(FILE *fp, const char *delim, CopyReadResult *result)
12311224
{
12321225
intc;
12331226
intdelimc= (unsignedchar)delim[0];
1234-
#ifdefMULTIBYTE
12351227
intmblen;
12361228
unsignedchars[2];
12371229
char*cvt;
12381230
intj;
12391231

12401232
s[1]=0;
1241-
#endif
12421233

12431234
/* reset attribute_buf to empty */
12441235
attribute_buf.len=0;
@@ -1354,7 +1345,7 @@ CopyReadAttribute(FILE *fp, const char *delim, CopyReadResult *result)
13541345
}
13551346
}
13561347
appendStringInfoCharMacro(&attribute_buf,c);
1357-
#ifdefMULTIBYTE
1348+
13581349
/* XXX shouldn't this be done even when encoding is the same? */
13591350
if (client_encoding!=server_encoding)
13601351
{
@@ -1372,12 +1363,10 @@ CopyReadAttribute(FILE *fp, const char *delim, CopyReadResult *result)
13721363
appendStringInfoCharMacro(&attribute_buf,c);
13731364
}
13741365
}
1375-
#endif
13761366
}
13771367

13781368
copy_eof:
13791369

1380-
#ifdefMULTIBYTE
13811370
if (client_encoding!=server_encoding)
13821371
{
13831372
cvt= (char*)pg_client_to_server((unsignedchar*)attribute_buf.data,
@@ -1391,7 +1380,6 @@ CopyReadAttribute(FILE *fp, const char *delim, CopyReadResult *result)
13911380
pfree(cvt);
13921381
}
13931382
}
1394-
#endif
13951383

13961384
returnattribute_buf.data;
13971385
}
@@ -1403,14 +1391,11 @@ CopyAttributeOut(FILE *fp, char *server_string, char *delim)
14031391
charc;
14041392
chardelimc=delim[0];
14051393

1406-
#ifdefMULTIBYTE
14071394
boolsame_encoding;
14081395
char*string_start;
14091396
intmblen;
14101397
inti;
1411-
#endif
14121398

1413-
#ifdefMULTIBYTE
14141399
same_encoding= (server_encoding==client_encoding);
14151400
if (!same_encoding)
14161401
{
@@ -1423,19 +1408,11 @@ CopyAttributeOut(FILE *fp, char *server_string, char *delim)
14231408
string=server_string;
14241409
string_start=NULL;
14251410
}
1426-
#else
1427-
string=server_string;
1428-
#endif
14291411

1430-
#ifdefMULTIBYTE
14311412
for (; (c=*string)!='\0';string+=mblen)
1432-
#else
1433-
for (; (c=*string)!='\0';string++)
1434-
#endif
14351413
{
1436-
#ifdefMULTIBYTE
14371414
mblen=1;
1438-
#endif
1415+
14391416
switch (c)
14401417
{
14411418
case'\b':
@@ -1463,7 +1440,7 @@ CopyAttributeOut(FILE *fp, char *server_string, char *delim)
14631440
if (c==delimc)
14641441
CopySendChar('\\',fp);
14651442
CopySendChar(c,fp);
1466-
#ifdefMULTIBYTE
1443+
14671444
/* XXX shouldn't this be done even when encoding is same? */
14681445
if (!same_encoding)
14691446
{
@@ -1472,15 +1449,12 @@ CopyAttributeOut(FILE *fp, char *server_string, char *delim)
14721449
for (i=1;i<mblen;i++)
14731450
CopySendChar(string[i],fp);
14741451
}
1475-
#endif
14761452
break;
14771453
}
14781454
}
14791455

1480-
#ifdefMULTIBYTE
14811456
if (string_start)
14821457
pfree(string_start);/* pfree pg_server_to_client result */
1483-
#endif
14841458
}
14851459

14861460
/*

‎src/backend/commands/dbcommands.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.99 2002/08/09 16:45:14 tgl Exp $
12+
* $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.100 2002/08/29 07:22:21 ishii Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -39,9 +39,7 @@
3939
#include"utils/lsyscache.h"
4040
#include"utils/syscache.h"
4141

42-
#ifdefMULTIBYTE
4342
#include"mb/pg_wchar.h"/* encoding check */
44-
#endif
4543

4644

4745
/* non-export function prototypes */
@@ -214,13 +212,9 @@ createdb(const CreatedbStmt *stmt)
214212
if (encoding<0)
215213
encoding=src_encoding;
216214

217-
#ifdefMULTIBYTE
218215
/* Some encodings are client only */
219216
if (!PG_VALID_BE_ENCODING(encoding))
220217
elog(ERROR,"CREATE DATABASE: invalid backend encoding");
221-
#else
222-
Assert(encoding==0);/* zero is PG_SQL_ASCII */
223-
#endif
224218

225219
/*
226220
* Preassign OID for pg_database tuple, so that we can compute db

‎src/backend/parser/analyze.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
9-
*$Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.245 2002/08/28 20:46:23 momjian Exp $
9+
*$Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.246 2002/08/29 07:22:22 ishii Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -42,9 +42,7 @@
4242
#include"utils/lsyscache.h"
4343
#include"utils/relcache.h"
4444
#include"utils/syscache.h"
45-
#ifdefMULTIBYTE
4645
#include"mb/pg_wchar.h"
47-
#endif
4846

4947

5048
/* State shared by transformCreateSchemaStmt and its subroutines */
@@ -634,12 +632,10 @@ makeObjectName(char *name1, char *name2, char *typename)
634632
name2chars--;
635633
}
636634

637-
#ifdefMULTIBYTE
638635
if (name1)
639636
name1chars=pg_mbcliplen(name1,name1chars,name1chars);
640637
if (name2)
641638
name2chars=pg_mbcliplen(name2,name2chars,name2chars);
642-
#endif
643639

644640
/* Now construct the string using the chosen lengths */
645641
name=palloc(name1chars+name2chars+overhead+1);

‎src/backend/parser/scan.l

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.100 2002/08/18 03:35:08 tgl Exp $
12+
* $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.101 2002/08/29 07:22:23 ishii Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -26,10 +26,7 @@
2626
#include"parser/keywords.h"
2727
#include"parser/parse.h"
2828
#include"utils/builtins.h"
29-
30-
#ifdef MULTIBYTE
3129
#include"mb/pg_wchar.h"
32-
#endif
3330

3431
/* No reason to constrain amount of data slurped*/
3532
#defineYY_READ_BUF_SIZE16777216
@@ -402,12 +399,9 @@ other.
402399
if (literallen >= NAMEDATALEN)
403400
{
404401
int len;
405-
#ifdef MULTIBYTE
402+
406403
len =pg_mbcliplen(literalbuf, literallen,
407404
NAMEDATALEN-1);
408-
#else
409-
len = NAMEDATALEN-1;
410-
#endif
411405
elog(NOTICE,"identifier\"%s\" will be truncated to\"%.*s\"",
412406
literalbuf, len, literalbuf);
413407
literalbuf[len] ='\0';
@@ -562,11 +556,8 @@ other.
562556
if (i >= NAMEDATALEN)
563557
{
564558
int len;
565-
#ifdef MULTIBYTE
559+
566560
len =pg_mbcliplen(ident, i, NAMEDATALEN-1);
567-
#else
568-
len = NAMEDATALEN-1;
569-
#endif
570561
elog(NOTICE,"identifier\"%s\" will be truncated to\"%.*s\"",
571562
ident, len, ident);
572563
ident[len] ='\0';

‎src/backend/postmaster/pgstat.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*
1717
*Copyright (c) 2001, PostgreSQL Global Development Group
1818
*
19-
*$Header: /cvsroot/pgsql/src/backend/postmaster/pgstat.c,v 1.23 2002/08/04 05:09:36 momjian Exp $
19+
*$Header: /cvsroot/pgsql/src/backend/postmaster/pgstat.c,v 1.24 2002/08/29 07:22:23 ishii Exp $
2020
* ----------
2121
*/
2222
#include"postgres.h"
@@ -38,9 +38,7 @@
3838
#include"catalog/pg_shadow.h"
3939
#include"catalog/pg_database.h"
4040
#include"libpq/pqsignal.h"
41-
#ifdefMULTIBYTE
4241
#include"mb/pg_wchar.h"
43-
#endif
4442
#include"miscadmin.h"
4543
#include"utils/memutils.h"
4644
#include"storage/backendid.h"
@@ -434,12 +432,7 @@ pgstat_report_activity(char *what)
434432
return;
435433

436434
len=strlen(what);
437-
#ifdefMULTIBYTE
438435
len=pg_mbcliplen((constunsignedchar*)what,len,PGSTAT_ACTIVITY_SIZE-1);
439-
#else
440-
if (len >=PGSTAT_ACTIVITY_SIZE)
441-
len=PGSTAT_ACTIVITY_SIZE-1;
442-
#endif
443436

444437
memcpy(msg.m_what,what,len);
445438
msg.m_what[len]='\0';

‎src/backend/regex/engine.c

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,8 @@ static states step(struct re_guts * g, sopno start,
108108
#defineEOW(BOL+5)
109109
#defineCODEMAX (BOL+5)/* highest code used */
110110

111-
#ifdefMULTIBYTE
112111
#defineNONCHAR(c) ((c) > 16777216)/* 16777216 == 2^24 == 3 bytes */
113112
#defineNNONCHAR (CODEMAX-16777216)
114-
#else
115-
#defineNONCHAR(c) ((c) > CHAR_MAX)
116-
#defineNNONCHAR (CODEMAX-CHAR_MAX)
117-
#endif
118113

119114
#ifdefREDEBUG
120115
staticvoidprint(structmatch*m,pg_wchar*caption,statesst,intch,
@@ -168,11 +163,7 @@ matcher(struct re_guts * g, pg_wchar *string, size_t nmatch,
168163
else
169164
{
170165
start=string;
171-
#ifdefMULTIBYTE
172166
stop=start+pg_wchar_strlen(start);
173-
#else
174-
stop=start+strlen(start);
175-
#endif
176167
}
177168
if (stop<start)
178169
returnREG_INVARG;
@@ -182,11 +173,7 @@ matcher(struct re_guts * g, pg_wchar *string, size_t nmatch,
182173
{
183174
for (dp=start;dp<stop;dp++)
184175
if (*dp==g->must[0]&&stop-dp >=g->mlen&&
185-
#ifdefMULTIBYTE
186176
memcmp(dp,g->must, (size_t) (g->mlen*sizeof(pg_wchar)))==0
187-
#else
188-
memcmp(dp,g->must, (size_t)g->mlen)==0
189-
#endif
190177
)
191178
break;
192179
if (dp==stop)/* we didn't find g->must */
@@ -1090,11 +1077,7 @@ pchar(int ch)
10901077
staticint
10911078
pg_isprint(intc)
10921079
{
1093-
#ifdefMULTIBYTE
10941080
return (c >=0&&c <=UCHAR_MAX&&isprint((unsignedchar)c));
1095-
#else
1096-
return (isprint((unsignedchar)c));
1097-
#endif
10981081
}
10991082
#endif
11001083
#endif

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp