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

Commit261114a

Browse files
committed
I have added these macros to c.h:
#define HIGHBIT (0x80) #define IS_HIGHBIT_SET(ch) ((unsigned char)(ch) & HIGHBIT)and removed CSIGNBIT and mapped it uses to HIGHBIT. I have also addeduses for IS_HIGHBIT_SET where appropriate. This change ispurely for code clarity.
1 parenta4d69a4 commit261114a

File tree

13 files changed

+55
-55
lines changed

13 files changed

+55
-55
lines changed

‎src/backend/access/common/heaptuple.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*
1717
*
1818
* IDENTIFICATION
19-
* $PostgreSQL: pgsql/src/backend/access/common/heaptuple.c,v 1.104 2005/11/22 18:17:05 momjian Exp $
19+
* $PostgreSQL: pgsql/src/backend/access/common/heaptuple.c,v 1.105 2005/12/25 02:14:17 momjian Exp $
2020
*
2121
*-------------------------------------------------------------------------
2222
*/
@@ -111,7 +111,7 @@ heap_fill_tuple(TupleDesc tupleDesc,
111111
if (bit!=NULL)
112112
{
113113
bitP=&bit[-1];
114-
bitmask=CSIGNBIT;
114+
bitmask=HIGHBIT;
115115
}
116116
else
117117
{
@@ -128,7 +128,7 @@ heap_fill_tuple(TupleDesc tupleDesc,
128128

129129
if (bit!=NULL)
130130
{
131-
if (bitmask!=CSIGNBIT)
131+
if (bitmask!=HIGHBIT)
132132
bitmask <<=1;
133133
else
134134
{
@@ -210,7 +210,7 @@ DataFill(char *data,
210210
if (bit!=NULL)
211211
{
212212
bitP=&bit[-1];
213-
bitmask=CSIGNBIT;
213+
bitmask=HIGHBIT;
214214
}
215215
else
216216
{
@@ -227,7 +227,7 @@ DataFill(char *data,
227227

228228
if (bit!=NULL)
229229
{
230-
if (bitmask!=CSIGNBIT)
230+
if (bitmask!=HIGHBIT)
231231
bitmask <<=1;
232232
else
233233
{

‎src/backend/parser/scansup.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $PostgreSQL: pgsql/src/backend/parser/scansup.c,v 1.30 2005/10/15 02:49:22 momjian Exp $
12+
* $PostgreSQL: pgsql/src/backend/parser/scansup.c,v 1.31 2005/12/25 02:14:17 momjian Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -149,7 +149,7 @@ downcase_truncate_identifier(const char *ident, int len, bool warn)
149149

150150
if (ch >='A'&&ch <='Z')
151151
ch+='a'-'A';
152-
elseif (ch >=0x80&&isupper(ch))
152+
elseif (IS_HIGHBIT_SET(ch)&&isupper(ch))
153153
ch=tolower(ch);
154154
result[i]= (char)ch;
155155
}

‎src/backend/utils/adt/network.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
*PostgreSQL type definitions for the INET and CIDR types.
33
*
4-
*$PostgreSQL: pgsql/src/backend/utils/adt/network.c,v 1.56 2005/10/17 16:24:19 tgl Exp $
4+
*$PostgreSQL: pgsql/src/backend/utils/adt/network.c,v 1.57 2005/12/25 02:14:17 momjian Exp $
55
*
66
*Jon Postel RIP 16 Oct 1998
77
*/
@@ -904,16 +904,16 @@ bitncmp(void *l, void *r, int n)
904904
rb= ((constu_char*)r)[b];
905905
for (b=n %8;b>0;b--)
906906
{
907-
if ((lb&0x80)!= (rb&0x80))
907+
if (IS_HIGHBIT_SET(lb)!=IS_HIGHBIT_SET(rb))
908908
{
909-
if (lb&0x80)
910-
return(1);
911-
return(-1);
909+
if (IS_HIGHBIT_SET(lb))
910+
return1;
911+
return-1;
912912
}
913913
lb <<=1;
914914
rb <<=1;
915915
}
916-
return(0);
916+
return0;
917917
}
918918

919919
staticbool

‎src/backend/utils/adt/varbit.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* Portions Copyright (c) 1994, Regents of the University of California
1010
*
1111
* IDENTIFICATION
12-
* $PostgreSQL: pgsql/src/backend/utils/adt/varbit.c,v 1.47 2005/10/15 02:49:30 momjian Exp $
12+
* $PostgreSQL: pgsql/src/backend/utils/adt/varbit.c,v 1.48 2005/12/25 02:14:17 momjian Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -120,7 +120,7 @@ bit_in(PG_FUNCTION_ARGS)
120120
{
121121
/* Parse the bit representation of the string */
122122
/* We know it fits, as bitlen was compared to atttypmod */
123-
x=BITHIGH;
123+
x=HIGHBIT;
124124
for (;*sp;sp++)
125125
{
126126
if (*sp=='1')
@@ -134,7 +134,7 @@ bit_in(PG_FUNCTION_ARGS)
134134
x >>=1;
135135
if (x==0)
136136
{
137-
x=BITHIGH;
137+
x=HIGHBIT;
138138
r++;
139139
}
140140
}
@@ -401,7 +401,7 @@ varbit_in(PG_FUNCTION_ARGS)
401401
{
402402
/* Parse the bit representation of the string */
403403
/* We know it fits, as bitlen was compared to atttypmod */
404-
x=BITHIGH;
404+
x=HIGHBIT;
405405
for (;*sp;sp++)
406406
{
407407
if (*sp=='1')
@@ -415,7 +415,7 @@ varbit_in(PG_FUNCTION_ARGS)
415415
x >>=1;
416416
if (x==0)
417417
{
418-
x=BITHIGH;
418+
x=HIGHBIT;
419419
r++;
420420
}
421421
}
@@ -477,14 +477,14 @@ varbit_out(PG_FUNCTION_ARGS)
477477
x=*sp;
478478
for (k=0;k<BITS_PER_BYTE;k++)
479479
{
480-
*r++=(x&BITHIGH) ?'1' :'0';
480+
*r++=IS_HIGHBIT_SET(x) ?'1' :'0';
481481
x <<=1;
482482
}
483483
}
484484
x=*sp;
485485
for (k=i;k<len;k++)
486486
{
487-
*r++=(x&BITHIGH) ?'1' :'0';
487+
*r++=IS_HIGHBIT_SET(x) ?'1' :'0';
488488
x <<=1;
489489
}
490490
*r='\0';

‎src/backend/utils/mb/conv.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1994, Regents of the University of California
77
*
88
* IDENTIFICATION
9-
* $PostgreSQL: pgsql/src/backend/utils/mb/conv.c,v 1.56 2005/10/29 00:31:52 petere Exp $
9+
* $PostgreSQL: pgsql/src/backend/utils/mb/conv.c,v 1.57 2005/12/25 02:14:17 momjian Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -413,7 +413,7 @@ LocalToUtf(unsigned char *iso, unsigned char *utf,
413413

414414
for (;len>0&&*iso;len-=l)
415415
{
416-
if (*iso<0x80)
416+
if (!IS_HIGHBIT_SET(*iso))
417417
{
418418
*utf++=*iso++;
419419
l=1;

‎src/backend/utils/mb/conversion_procs/euc_cn_and_mic/euc_cn_and_mic.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1994, Regents of the University of California
77
*
88
* IDENTIFICATION
9-
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/euc_cn_and_mic/euc_cn_and_mic.c,v 1.10 2005/09/24 17:53:18tgl Exp $
9+
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/euc_cn_and_mic/euc_cn_and_mic.c,v 1.11 2005/12/25 02:14:18momjian Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -77,7 +77,7 @@ euc_cn2mic(unsigned char *euc, unsigned char *p, int len)
7777

7878
while (len >=0&& (c1=*euc++))
7979
{
80-
if (c1&0x80)
80+
if (IS_HIGHBIT_SET(c1))
8181
{
8282
len-=2;
8383
*p++=LC_GB2312_80;

‎src/backend/utils/mb/conversion_procs/euc_kr_and_mic/euc_kr_and_mic.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1994, Regents of the University of California
77
*
88
* IDENTIFICATION
9-
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/euc_kr_and_mic/euc_kr_and_mic.c,v 1.10 2005/09/24 17:53:19 tgl Exp $
9+
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/euc_kr_and_mic/euc_kr_and_mic.c,v 1.11 2005/12/25 02:14:18 momjian Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -77,7 +77,7 @@ euc_kr2mic(unsigned char *euc, unsigned char *p, int len)
7777

7878
while (len >=0&& (c1=*euc++))
7979
{
80-
if (c1&0x80)
80+
if (IS_HIGHBIT_SET(c1))
8181
{
8282
len-=2;
8383
*p++=LC_KS5601;

‎src/backend/utils/mb/conversion_procs/euc_tw_and_big5/euc_tw_and_big5.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1994, Regents of the University of California
77
*
88
* IDENTIFICATION
9-
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/euc_tw_and_big5/euc_tw_and_big5.c,v 1.10 2005/09/24 17:53:19 tgl Exp $
9+
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/euc_tw_and_big5/euc_tw_and_big5.c,v 1.11 2005/12/25 02:14:18 momjian Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -177,7 +177,7 @@ euc_tw2mic(unsigned char *euc, unsigned char *p, int len)
177177
*p++=*euc++;
178178
*p++=*euc++;
179179
}
180-
elseif (c1&0x80)
180+
elseif (IS_HIGHBIT_SET(c1))
181181
{/* CNS11643-1 */
182182
len-=2;
183183
*p++=LC_CNS11643_1;

‎src/backend/utils/mb/conversion_procs/utf8_and_iso8859_1/utf8_and_iso8859_1.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1994, Regents of the University of California
77
*
88
* IDENTIFICATION
9-
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_iso8859_1/utf8_and_iso8859_1.c,v 1.12 2005/09/24 17:53:24 tgl Exp $
9+
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_iso8859_1/utf8_and_iso8859_1.c,v 1.13 2005/12/25 02:14:18 momjian Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -46,12 +46,12 @@ iso8859_1_to_utf8(PG_FUNCTION_ARGS)
4646

4747
while (len-->0&& (c=*src++))
4848
{
49-
if (c<0x80)
49+
if (!IS_HIGHBIT_SET(c))
5050
*dest++=c;
5151
else
5252
{
5353
*dest++= (c >>6) |0xc0;
54-
*dest++= (c&0x003f) |0x80;
54+
*dest++= (c&0x003f) |HIGHBIT;
5555
}
5656
}
5757
*dest='\0';

‎src/backend/utils/mb/wchar.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* conversion functions between pg_wchar and multibyte streams.
33
* Tatsuo Ishii
4-
* $PostgreSQL: pgsql/src/backend/utils/mb/wchar.c,v 1.50 2005/12/24 17:19:40 momjian Exp $
4+
* $PostgreSQL: pgsql/src/backend/utils/mb/wchar.c,v 1.51 2005/12/25 02:14:18 momjian Exp $
55
*
66
* WIN1250 client encoding updated by Pavel Behal
77
*
@@ -79,7 +79,7 @@ static intpg_euc2wchar_with_len
7979
*to |=*from++;
8080
len-=3;
8181
}
82-
elseif ((*from&0x80)&&len >=2)/* JIS X 0208 KANJI */
82+
elseif (IS_HIGHBIT_SET(*from)&&len >=2)/* JIS X 0208 KANJI */
8383
{
8484
*to=*from++ <<8;
8585
*to |=*from++;
@@ -106,7 +106,7 @@ pg_euc_mblen(const unsigned char *s)
106106
len=2;
107107
elseif (*s==SS3)
108108
len=3;
109-
elseif (*s&0x80)
109+
elseif (IS_HIGHBIT_SET(*s))
110110
len=2;
111111
else
112112
len=1;
@@ -122,7 +122,7 @@ pg_euc_dsplen(const unsigned char *s)
122122
len=2;
123123
elseif (*s==SS3)
124124
len=2;
125-
elseif (*s&0x80)
125+
elseif (IS_HIGHBIT_SET(*s))
126126
len=2;
127127
else
128128
len=1;
@@ -153,7 +153,7 @@ pg_eucjp_dsplen(const unsigned char *s)
153153
len=1;
154154
elseif (*s==SS3)
155155
len=2;
156-
elseif (*s&0x80)
156+
elseif (IS_HIGHBIT_SET(*s))
157157
len=2;
158158
else
159159
len=1;
@@ -206,7 +206,7 @@ static intpg_euccn2wchar_with_len
206206
*to |=*from++;
207207
len-=3;
208208
}
209-
elseif ((*from&0x80)&&len >=2)/* code set 1 */
209+
elseif (IS_HIGHBIT_SET(*from)&&len >=2)/* code set 1 */
210210
{
211211
*to=*from++ <<8;
212212
*to |=*from++;
@@ -229,7 +229,7 @@ pg_euccn_mblen(const unsigned char *s)
229229
{
230230
intlen;
231231

232-
if (*s&0x80)
232+
if (IS_HIGHBIT_SET(*s))
233233
len=2;
234234
else
235235
len=1;
@@ -241,7 +241,7 @@ pg_euccn_dsplen(const unsigned char *s)
241241
{
242242
intlen;
243243

244-
if (*s&0x80)
244+
if (IS_HIGHBIT_SET(*s))
245245
len=2;
246246
else
247247
len=1;
@@ -274,7 +274,7 @@ static intpg_euctw2wchar_with_len
274274
*to |=*from++;
275275
len-=3;
276276
}
277-
elseif ((*from&0x80)&&len >=2)/* code set 2 */
277+
elseif (IS_HIGHBIT_SET(*from)&&len >=2)/* code set 2 */
278278
{
279279
*to=*from++ <<8;
280280
*to |=*from++;
@@ -301,7 +301,7 @@ pg_euctw_mblen(const unsigned char *s)
301301
len=4;
302302
elseif (*s==SS3)
303303
len=3;
304-
elseif (*s&0x80)
304+
elseif (IS_HIGHBIT_SET(*s))
305305
len=2;
306306
else
307307
len=1;
@@ -317,7 +317,7 @@ pg_euctw_dsplen(const unsigned char *s)
317317
len=2;
318318
elseif (*s==SS3)
319319
len=2;
320-
elseif (*s&0x80)
320+
elseif (IS_HIGHBIT_SET(*s))
321321
len=2;
322322
else
323323
len=1;
@@ -361,7 +361,7 @@ pg_utf2wchar_with_len(const unsigned char *from, pg_wchar *to, int len)
361361

362362
while (len>0&&*from)
363363
{
364-
if ((*from&0x80)==0)
364+
if (!IS_HIGHBIT_SET(*from))
365365
{
366366
*to=*from++;
367367
len--;
@@ -866,7 +866,7 @@ pg_verifymbstr(const char *mbstr, int len, bool noError)
866866
* we expect that every multibyte char consists of bytes
867867
* having the 8th bit set
868868
*/
869-
if (i >=len|| (mbstr[i]&0x80)==0)
869+
if (i >=len||!IS_HIGHBIT_SET(mbstr[i]))
870870
{
871871
charbuf[8*2+1];
872872
char*p=buf;

‎src/include/c.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
1313
* Portions Copyright (c) 1994, Regents of the University of California
1414
*
15-
* $PostgreSQL: pgsql/src/include/c.h,v 1.192 2005/12/06 02:29:03 tgl Exp $
15+
* $PostgreSQL: pgsql/src/include/c.h,v 1.193 2005/12/25 02:14:18 momjian Exp $
1616
*
1717
*-------------------------------------------------------------------------
1818
*/
@@ -704,7 +704,8 @@ typedef NameData *Name;
704704
*/
705705

706706
/* msb for char */
707-
#defineCSIGNBIT (0x80)
707+
#defineHIGHBIT(0x80)
708+
#defineIS_HIGHBIT_SET(ch)((unsigned char)(ch) & HIGHBIT)
708709

709710
#defineSTATUS_OK(0)
710711
#defineSTATUS_ERROR(-1)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp