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

Commitd70bf0d

Browse files
committed
Rename BITSPERBYTE to BITS_PER_BYTE to avoid conflict with <values.h>
on some platforms.
1 parent662f6a5 commitd70bf0d

File tree

7 files changed

+44
-44
lines changed

7 files changed

+44
-44
lines changed

‎src/backend/lib/bit.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/lib/Attic/bit.c,v 1.10 2000/08/20 19:31:37 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/lib/Attic/bit.c,v 1.11 2000/08/26 21:53:42 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -21,21 +21,21 @@
2121
void
2222
BitArraySetBit(BitArraybitArray,BitIndexbitIndex)
2323
{
24-
bitArray[bitIndex /BITSPERBYTE] |=
25-
(1 << (BITSPERBYTE-1- (bitIndex %BITSPERBYTE)));
24+
bitArray[bitIndex /BITS_PER_BYTE] |=
25+
(1 << (BITS_PER_BYTE-1- (bitIndex %BITS_PER_BYTE)));
2626
}
2727

2828
void
2929
BitArrayClearBit(BitArraybitArray,BitIndexbitIndex)
3030
{
31-
bitArray[bitIndex /BITSPERBYTE] &=
32-
~(1 << (BITSPERBYTE-1- (bitIndex %BITSPERBYTE)));
31+
bitArray[bitIndex /BITS_PER_BYTE] &=
32+
~(1 << (BITS_PER_BYTE-1- (bitIndex %BITS_PER_BYTE)));
3333
}
3434

3535
bool
3636
BitArrayBitIsSet(BitArraybitArray,BitIndexbitIndex)
3737
{
38-
return ((bitArray[bitIndex /BITSPERBYTE]&
39-
(1 << (BITSPERBYTE-1- (bitIndex %BITSPERBYTE)))
38+
return ((bitArray[bitIndex /BITS_PER_BYTE]&
39+
(1 << (BITS_PER_BYTE-1- (bitIndex %BITS_PER_BYTE)))
4040
)!=0);
4141
}

‎src/backend/parser/gram.y

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*
1212
*
1313
* IDENTIFICATION
14-
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.186 2000/08/12 05:15:21 tgl Exp $
14+
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.187 2000/08/26 21:53:43 tgl Exp $
1515
*
1616
* HISTORY
1717
* AUTHORDATEMAJOR EVENT
@@ -4163,9 +4163,9 @@ Bit: bit '(' Iconst ')'
41634163
if ($3 <1)
41644164
elog(ERROR,"length for type '%s' must be at least 1",
41654165
$1);
4166-
elseif ($3 > (MaxAttrSize *BITSPERBYTE))
4166+
elseif ($3 > (MaxAttrSize *BITS_PER_BYTE))
41674167
elog(ERROR,"length for type '%s' cannot exceed %d",
4168-
$1, (MaxAttrSize *BITSPERBYTE));
4168+
$1, (MaxAttrSize *BITS_PER_BYTE));
41694169
$$->typmod =$3;
41704170
}
41714171
|bit

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/format_type.c,v 1.4 2000/08/25 18:05:54 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/format_type.c,v 1.5 2000/08/26 21:53:41 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -254,7 +254,7 @@ type_maximum_size(Oid type_oid, int32 typemod)
254254
caseVARBITOID:
255255
caseZPBITOID:
256256
/* typemod is the (max) number of bits */
257-
return (typemod+ (BITSPERBYTE-1)) /BITSPERBYTE
257+
return (typemod+ (BITS_PER_BYTE-1)) /BITS_PER_BYTE
258258
+2*sizeof(int32);
259259
}
260260

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

Lines changed: 24 additions & 24 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-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varbit.c,v 1.8 2000/08/21 04:48:50 tgl Exp $
12+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varbit.c,v 1.9 2000/08/26 21:53:41 tgl Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -161,7 +161,7 @@ zpbit_in(PG_FUNCTION_ARGS)
161161
* The bottom ipad bits of the byte pointed to by r need to be
162162
* zero
163163
*/
164-
if (((*r << (BITSPERBYTE-ipad))&BITMASK)!=0)
164+
if (((*r << (BITS_PER_BYTE-ipad))&BITMASK)!=0)
165165
elog(ERROR,"zpbit_in: bit string too long for bit(%d)",
166166
atttypmod);
167167
}
@@ -387,7 +387,7 @@ varbit_in(PG_FUNCTION_ARGS)
387387
* The bottom ipad bits of the byte pointed to by r need to be
388388
* zero
389389
*/
390-
if (((*r << (BITSPERBYTE-ipad))&BITMASK)!=0)
390+
if (((*r << (BITS_PER_BYTE-ipad))&BITMASK)!=0)
391391
elog(ERROR,"varbit_in: bit string too long for bit varying(%d)",
392392
atttypmod);
393393
}
@@ -415,10 +415,10 @@ varbit_out(PG_FUNCTION_ARGS)
415415
sp=VARBITS(s);
416416
r=result;
417417
*r++='B';
418-
for (i=0;i<len-BITSPERBYTE;i+=BITSPERBYTE,sp++)
418+
for (i=0;i<len-BITS_PER_BYTE;i+=BITS_PER_BYTE,sp++)
419419
{
420420
x=*sp;
421-
for (k=0;k<BITSPERBYTE;k++)
421+
for (k=0;k<BITS_PER_BYTE;k++)
422422
{
423423
*r++= (x&BITHIGH) ?'1' :'0';
424424
x <<=1;
@@ -704,7 +704,7 @@ bitcat(PG_FUNCTION_ARGS)
704704
elseif (bitlen2>0)
705705
{
706706
/* We need to shift all the bits to fit */
707-
bit2shift=BITSPERBYTE-bit1pad;
707+
bit2shift=BITS_PER_BYTE-bit1pad;
708708
pr=VARBITS(result)+VARBITBYTES(arg1)-1;
709709
for (pa=VARBITS(arg2);pa<VARBITEND(arg2);pa++)
710710
{
@@ -768,23 +768,23 @@ bitsubstr(PG_FUNCTION_ARGS)
768768
VARBITLEN(result)=rbitlen;
769769
len-=VARHDRSZ+VARBITHDRSZ;
770770
/* Are we copying from a byte boundary? */
771-
if ((s1-1) %BITSPERBYTE==0)
771+
if ((s1-1) %BITS_PER_BYTE==0)
772772
{
773773
/* Yep, we are copying bytes */
774-
memcpy(VARBITS(result),VARBITS(arg)+ (s1-1) /BITSPERBYTE,
774+
memcpy(VARBITS(result),VARBITS(arg)+ (s1-1) /BITS_PER_BYTE,
775775
len);
776776
}
777777
else
778778
{
779779
/* Figure out how much we need to shift the sequence by */
780-
ishift= (s1-1) %BITSPERBYTE;
780+
ishift= (s1-1) %BITS_PER_BYTE;
781781
r=VARBITS(result);
782-
ps=VARBITS(arg)+ (s1-1) /BITSPERBYTE;
782+
ps=VARBITS(arg)+ (s1-1) /BITS_PER_BYTE;
783783
for (i=0;i<len;i++)
784784
{
785785
*r= (*ps <<ishift)&BITMASK;
786786
if ((++ps)<VARBITEND(arg))
787-
*r |=*ps >> (BITSPERBYTE-ishift);
787+
*r |=*ps >> (BITS_PER_BYTE-ishift);
788788
r++;
789789
}
790790
}
@@ -1009,8 +1009,8 @@ bitshiftleft(PG_FUNCTION_ARGS)
10091009
PG_RETURN_VARBIT_P(result);
10101010
}
10111011

1012-
byte_shift=shft /BITSPERBYTE;
1013-
ishift=shft %BITSPERBYTE;
1012+
byte_shift=shft /BITS_PER_BYTE;
1013+
ishift=shft %BITS_PER_BYTE;
10141014
p=VARBITS(arg)+byte_shift;
10151015

10161016
if (ishift==0)
@@ -1026,7 +1026,7 @@ bitshiftleft(PG_FUNCTION_ARGS)
10261026
{
10271027
*r=*p <<ishift;
10281028
if ((++p)<VARBITEND(arg))
1029-
*r |=*p >> (BITSPERBYTE-ishift);
1029+
*r |=*p >> (BITS_PER_BYTE-ishift);
10301030
}
10311031
for (;r<VARBITEND(result);r++)
10321032
*r=0;
@@ -1068,8 +1068,8 @@ bitshiftright(PG_FUNCTION_ARGS)
10681068
PG_RETURN_VARBIT_P(result);
10691069
}
10701070

1071-
byte_shift=shft /BITSPERBYTE;
1072-
ishift=shft %BITSPERBYTE;
1071+
byte_shift=shft /BITS_PER_BYTE;
1072+
ishift=shft %BITS_PER_BYTE;
10731073
p=VARBITS(arg);
10741074

10751075
/* Set the first part of the result to 0 */
@@ -1090,7 +1090,7 @@ bitshiftright(PG_FUNCTION_ARGS)
10901090
{
10911091
*r |=*p >>ishift;
10921092
if ((++r)<VARBITEND(result))
1093-
*r= (*p << (BITSPERBYTE-ishift))&BITMASK;
1093+
*r= (*p << (BITS_PER_BYTE-ishift))&BITMASK;
10941094
}
10951095
}
10961096

@@ -1109,17 +1109,17 @@ bitfromint4(PG_FUNCTION_ARGS)
11091109
intlen;
11101110

11111111
/* allocate enough space for the bits in an int4 */
1112-
len=VARBITTOTALLEN(sizeof(int4)*BITSPERBYTE);
1112+
len=VARBITTOTALLEN(sizeof(int4)*BITS_PER_BYTE);
11131113
result= (VarBit*)palloc(len);
11141114
VARATT_SIZEP(result)=len;
1115-
VARBITLEN(result)=sizeof(int4)*BITSPERBYTE;
1115+
VARBITLEN(result)=sizeof(int4)*BITS_PER_BYTE;
11161116
/* masks and shifts here are just too painful and we know that an int4 has
11171117
* got 4 bytes
11181118
*/
11191119
r=VARBITS(result);
1120-
r[0]= (bits8) ((a >> (3*BITSPERBYTE))&BITMASK);
1121-
r[1]= (bits8) ((a >> (2*BITSPERBYTE))&BITMASK);
1122-
r[2]= (bits8) ((a >> (1*BITSPERBYTE))&BITMASK);
1120+
r[0]= (bits8) ((a >> (3*BITS_PER_BYTE))&BITMASK);
1121+
r[1]= (bits8) ((a >> (2*BITS_PER_BYTE))&BITMASK);
1122+
r[2]= (bits8) ((a >> (1*BITS_PER_BYTE))&BITMASK);
11231123
r[3]= (bits8) (a&BITMASK);
11241124

11251125
PG_RETURN_VARBIT_P(result);
@@ -1133,12 +1133,12 @@ bittoint4(PG_FUNCTION_ARGS)
11331133
bits8*r;
11341134

11351135
/* Check that the bit string is not too long */
1136-
if (VARBITLEN(arg)>sizeof(int4)*BITSPERBYTE)
1136+
if (VARBITLEN(arg)>sizeof(int4)*BITS_PER_BYTE)
11371137
elog(ERROR,"Bit string is too large to fit in an int4");
11381138
result=0;
11391139
for (r=VARBITS(arg);r<VARBITEND(arg);r++)
11401140
{
1141-
result <<=BITSPERBYTE;
1141+
result <<=BITS_PER_BYTE;
11421142
result |=*r;
11431143
}
11441144
/* Now shift the result to take account of the padding at the end */

‎src/include/config.h.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* or in config.h afterwards. Of course, if you edit config.h, then your
99
* changes will be overwritten the next time you run configure.
1010
*
11-
* $Id: config.h.in,v 1.131 2000/08/20 10:55:34 petere Exp $
11+
* $Id: config.h.in,v 1.132 2000/08/26 21:53:40 tgl Exp $
1212
*/
1313

1414
#ifndefCONFIG_H
@@ -221,7 +221,7 @@
221221
* You can try changing this if you have a machine with bytes of another
222222
* size, but no guarantee...
223223
*/
224-
#defineBITSPERBYTE8
224+
#defineBITS_PER_BYTE8
225225

226226
/*
227227
* Define this is your operating system kernel supports AF_UNIX family

‎src/include/utils/varbit.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
99
* Portions Copyright (c) 1994, Regents of the University of California
1010
*
11-
* $Id: varbit.h,v 1.6 2000/08/21 04:48:54 tgl Exp $
11+
* $Id: varbit.h,v 1.7 2000/08/26 21:53:40 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -49,13 +49,13 @@ typedef struct
4949
/* Number of bytes in the data section of a bit string */
5050
#defineVARBITBYTES(PTR)(VARSIZE(PTR) - VARHDRSZ - VARBITHDRSZ)
5151
/* Padding of the bit string at the end (in bits) */
52-
#defineVARBITPAD(PTR)(VARBITBYTES(PTR)*BITSPERBYTE - VARBITLEN(PTR))
52+
#defineVARBITPAD(PTR)(VARBITBYTES(PTR)*BITS_PER_BYTE - VARBITLEN(PTR))
5353
/* Number of bytes needed to store a bit string of a given length */
54-
#defineVARBITTOTALLEN(BITLEN)(((BITLEN) +BITSPERBYTE-1)/BITSPERBYTE + \
54+
#defineVARBITTOTALLEN(BITLEN)(((BITLEN) +BITS_PER_BYTE-1)/BITS_PER_BYTE + \
5555
VARHDRSZ + VARBITHDRSZ)
5656
/* pointer beyond the end of the bit string (like end() in STL containers) */
5757
#defineVARBITEND(PTR)(((bits8 *) (PTR)) + VARSIZE(PTR))
58-
/* Mask that will cover exactly one byte, i.e.BITSPERBYTE bits */
58+
/* Mask that will cover exactly one byte, i.e.BITS_PER_BYTE bits */
5959
#defineBITMASK 0xFF
6060
#defineBITHIGH 0x80
6161

‎src/interfaces/ecpg/preproc/preproc.y

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3116,10 +3116,10 @@ Bit: bit '(' Iconst ')'
31163116
sprintf(errortext,"length for type '%s' must be at least 1",$1);
31173117
mmerror(ET_ERROR, errortext);
31183118
}
3119-
elseif (atol($3) > (MaxAttrSize *BITSPERBYTE))
3119+
elseif (atol($3) > (MaxAttrSize *BITS_PER_BYTE))
31203120
{
31213121
sprintf(errortext,"length for type '%s' cannot exceed %d", $1,
3122-
(MaxAttrSize *BITSPERBYTE));
3122+
(MaxAttrSize *BITS_PER_BYTE));
31233123
mmerror(ET_ERROR, errortext);
31243124
}
31253125
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp