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

Commitb8b2e3b

Browse files
committed
Replace int2/int4 in C code with int16/int32
The latter was already the dominant use, and it's preferable becausein C the convention is that intXX means XX bits. Therefore, allowingmixed use of int2, int4, int8, int16, int32 is obviously confusing.Remove the typedefs for int2 and int4 for now. They don't seem to bewidely used outside of the PostgreSQL source tree, and the few usescan probably be cleaned up by the time this ships.
1 parent7eb8c78 commitb8b2e3b

File tree

75 files changed

+411
-404
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+411
-404
lines changed

‎contrib/btree_gist/btree_int2.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ gbt_int2key_cmp(const void *a, const void *b)
7777
staticfloat8
7878
gbt_int2_dist(constvoid*a,constvoid*b)
7979
{
80-
returnGET_FLOAT_DISTANCE(int2,a,b);
80+
returnGET_FLOAT_DISTANCE(int16,a,b);
8181
}
8282

8383

@@ -100,10 +100,10 @@ Datumint2_dist(PG_FUNCTION_ARGS);
100100
Datum
101101
int2_dist(PG_FUNCTION_ARGS)
102102
{
103-
int2a=PG_GETARG_INT16(0);
104-
int2b=PG_GETARG_INT16(1);
105-
int2r;
106-
int2ra;
103+
int16a=PG_GETARG_INT16(0);
104+
int16b=PG_GETARG_INT16(1);
105+
int16r;
106+
int16ra;
107107

108108
r=a-b;
109109
ra=Abs(r);

‎contrib/btree_gist/btree_int4.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ gbt_int4key_cmp(const void *a, const void *b)
7878
staticfloat8
7979
gbt_int4_dist(constvoid*a,constvoid*b)
8080
{
81-
returnGET_FLOAT_DISTANCE(int4,a,b);
81+
returnGET_FLOAT_DISTANCE(int32,a,b);
8282
}
8383

8484

@@ -101,10 +101,10 @@ Datumint4_dist(PG_FUNCTION_ARGS);
101101
Datum
102102
int4_dist(PG_FUNCTION_ARGS)
103103
{
104-
int4a=PG_GETARG_INT32(0);
105-
int4b=PG_GETARG_INT32(1);
106-
int4r;
107-
int4ra;
104+
int32a=PG_GETARG_INT32(0);
105+
int32b=PG_GETARG_INT32(1);
106+
int32r;
107+
int32ra;
108108

109109
r=a-b;
110110
ra=Abs(r);

‎contrib/cube/cube.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ cube_subset(PG_FUNCTION_ARGS)
266266
(errcode(ERRCODE_ARRAY_ELEMENT_ERROR),
267267
errmsg("cannot work with arrays containing NULLs")));
268268

269-
dx= (int4*)ARR_DATA_PTR(idx);
269+
dx= (int32*)ARR_DATA_PTR(idx);
270270

271271
dim=ARRNELEMS(idx);
272272
size= offsetof(NDBOX,x[0])+sizeof(double)*2*dim;
@@ -1360,7 +1360,7 @@ cube_enlarge(PG_FUNCTION_ARGS)
13601360
{
13611361
NDBOX*a=PG_GETARG_NDBOX(0);
13621362
doubler=PG_GETARG_FLOAT8(1);
1363-
int4n=PG_GETARG_INT32(2);
1363+
int32n=PG_GETARG_INT32(2);
13641364
NDBOX*result;
13651365
intdim=0;
13661366
intsize;

‎contrib/hstore/hstore.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,8 @@ typedef struct
159159
boolneedfree;/* need to pfree the value? */
160160
}Pairs;
161161

162-
externinthstoreUniquePairs(Pairs*a,int4l,int4*buflen);
163-
externHStore*hstorePairs(Pairs*pairs,int4pcount,int4buflen);
162+
externinthstoreUniquePairs(Pairs*a,int32l,int32*buflen);
163+
externHStore*hstorePairs(Pairs*pairs,int32pcount,int32buflen);
164164

165165
externsize_thstoreCheckKeyLen(size_tlen);
166166
externsize_thstoreCheckValLen(size_tlen);

‎contrib/hstore/hstore_gist.c

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@ typedef char *BITVECP;
4040
typedefstruct
4141
{
4242
int32vl_len_;/* varlena header (do not touch directly!) */
43-
int4flag;
43+
int32flag;
4444
chardata[1];
4545
}GISTTYPE;
4646

4747
#defineALLISTRUE0x04
4848

4949
#defineISALLTRUE(x)( ((GISTTYPE*)x)->flag & ALLISTRUE )
5050

51-
#defineGTHDRSIZE(VARHDRSZ + sizeof(int4))
51+
#defineGTHDRSIZE(VARHDRSZ + sizeof(int32))
5252
#defineCALCGTSIZE(flag) ( GTHDRSIZE+(((flag) & ALLISTRUE) ? 0 : SIGLEN) )
5353

5454
#defineGETSIGN(x)( (BITVECP)( (char*)x+GTHDRSIZE ) )
@@ -143,7 +143,7 @@ ghstore_compress(PG_FUNCTION_ARGS)
143143
}
144144
elseif (!ISALLTRUE(DatumGetPointer(entry->key)))
145145
{
146-
int4i;
146+
int32i;
147147
GISTTYPE*res;
148148
BITVECPsign=GETSIGN(DatumGetPointer(entry->key));
149149

@@ -192,7 +192,7 @@ ghstore_same(PG_FUNCTION_ARGS)
192192
*result= false;
193193
else
194194
{
195-
int4i;
195+
int32i;
196196
BITVECPsa=GETSIGN(a),
197197
sb=GETSIGN(b);
198198

@@ -209,10 +209,10 @@ ghstore_same(PG_FUNCTION_ARGS)
209209
PG_RETURN_POINTER(result);
210210
}
211211

212-
staticint4
212+
staticint32
213213
sizebitvec(BITVECPsign)
214214
{
215-
int4size=0,
215+
int32size=0,
216216
i;
217217

218218
LOOPBYTE
@@ -253,10 +253,10 @@ hemdist(GISTTYPE *a, GISTTYPE *b)
253253
returnhemdistsign(GETSIGN(a),GETSIGN(b));
254254
}
255255

256-
staticint4
256+
staticint32
257257
unionkey(BITVECPsbase,GISTTYPE*add)
258258
{
259-
int4i;
259+
int32i;
260260
BITVECPsadd=GETSIGN(add);
261261

262262
if (ISALLTRUE(add))
@@ -270,12 +270,12 @@ Datum
270270
ghstore_union(PG_FUNCTION_ARGS)
271271
{
272272
GistEntryVector*entryvec= (GistEntryVector*)PG_GETARG_POINTER(0);
273-
int4len=entryvec->n;
273+
int32len=entryvec->n;
274274

275275
int*size= (int*)PG_GETARG_POINTER(1);
276276
BITVECbase;
277-
int4i;
278-
int4flag=0;
277+
int32i;
278+
int32flag=0;
279279
GISTTYPE*result;
280280

281281
MemSet((void*)base,0,sizeof(BITVEC));
@@ -316,7 +316,7 @@ ghstore_penalty(PG_FUNCTION_ARGS)
316316
typedefstruct
317317
{
318318
OffsetNumberpos;
319-
int4cost;
319+
int32cost;
320320
}SPLITCOST;
321321

322322
staticint
@@ -339,11 +339,11 @@ ghstore_picksplit(PG_FUNCTION_ARGS)
339339
*datum_r;
340340
BITVECPunion_l,
341341
union_r;
342-
int4size_alpha,
342+
int32size_alpha,
343343
size_beta;
344-
int4size_waste,
344+
int32size_waste,
345345
waste=-1;
346-
int4nbytes;
346+
int32nbytes;
347347
OffsetNumberseed_1=0,
348348
seed_2=0;
349349
OffsetNumber*left,

‎contrib/hstore/hstore_io.c

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ typedef struct
3636
do { \
3737
if ( state->cur - state->word + 1 >= state->wordlen ) \
3838
{ \
39-
int4 clen = state->cur - state->word; \
39+
int32 clen = state->cur - state->word; \
4040
state->wordlen *= 2; \
4141
state->word = (char*)repalloc( (void*)state->word, state->wordlen ); \
4242
state->cur = state->word + clen; \
@@ -74,7 +74,7 @@ get_val(HSParser *state, bool ignoreeq, bool *escaped)
7474
}
7575
elseif (*(state->ptr)=='='&& !ignoreeq)
7676
{
77-
elog(ERROR,"Syntax error near '%c' at position %d",*(state->ptr), (int4) (state->ptr-state->begin));
77+
elog(ERROR,"Syntax error near '%c' at position %d",*(state->ptr), (int32) (state->ptr-state->begin));
7878
}
7979
elseif (*(state->ptr)=='\\')
8080
{
@@ -215,7 +215,7 @@ parse_hstore(HSParser *state)
215215
}
216216
elseif (!isspace((unsignedchar)*(state->ptr)))
217217
{
218-
elog(ERROR,"Syntax error near '%c' at position %d",*(state->ptr), (int4) (state->ptr-state->begin));
218+
elog(ERROR,"Syntax error near '%c' at position %d",*(state->ptr), (int32) (state->ptr-state->begin));
219219
}
220220
}
221221
elseif (st==WGT)
@@ -230,7 +230,7 @@ parse_hstore(HSParser *state)
230230
}
231231
else
232232
{
233-
elog(ERROR,"Syntax error near '%c' at position %d",*(state->ptr), (int4) (state->ptr-state->begin));
233+
elog(ERROR,"Syntax error near '%c' at position %d",*(state->ptr), (int32) (state->ptr-state->begin));
234234
}
235235
}
236236
elseif (st==WVAL)
@@ -263,7 +263,7 @@ parse_hstore(HSParser *state)
263263
}
264264
elseif (!isspace((unsignedchar)*(state->ptr)))
265265
{
266-
elog(ERROR,"Syntax error near '%c' at position %d",*(state->ptr), (int4) (state->ptr-state->begin));
266+
elog(ERROR,"Syntax error near '%c' at position %d",*(state->ptr), (int32) (state->ptr-state->begin));
267267
}
268268
}
269269
else
@@ -304,7 +304,7 @@ comparePairs(const void *a, const void *b)
304304
* and (b) who knows whether they might be needed by some caller.
305305
*/
306306
int
307-
hstoreUniquePairs(Pairs*a,int4l,int4*buflen)
307+
hstoreUniquePairs(Pairs*a,int32l,int32*buflen)
308308
{
309309
Pairs*ptr,
310310
*res;
@@ -367,14 +367,14 @@ hstoreCheckValLen(size_t len)
367367

368368

369369
HStore*
370-
hstorePairs(Pairs*pairs,int4pcount,int4buflen)
370+
hstorePairs(Pairs*pairs,int32pcount,int32buflen)
371371
{
372372
HStore*out;
373373
HEntry*entry;
374374
char*ptr;
375375
char*buf;
376-
int4len;
377-
int4i;
376+
int32len;
377+
int32i;
378378

379379
len=CALCDATASIZE(pcount,buflen);
380380
out=palloc(len);
@@ -402,7 +402,7 @@ Datum
402402
hstore_in(PG_FUNCTION_ARGS)
403403
{
404404
HSParserstate;
405-
int4buflen;
405+
int32buflen;
406406
HStore*out;
407407

408408
state.begin=PG_GETARG_CSTRING(0);
@@ -422,11 +422,11 @@ Datumhstore_recv(PG_FUNCTION_ARGS);
422422
Datum
423423
hstore_recv(PG_FUNCTION_ARGS)
424424
{
425-
int4buflen;
425+
int32buflen;
426426
HStore*out;
427427
Pairs*pairs;
428-
int4i;
429-
int4pcount;
428+
int32i;
429+
int32pcount;
430430
StringInfobuf= (StringInfo)PG_GETARG_POINTER(0);
431431

432432
pcount=pq_getmsgint(buf,4);
@@ -518,7 +518,7 @@ Datumhstore_from_arrays(PG_FUNCTION_ARGS);
518518
Datum
519519
hstore_from_arrays(PG_FUNCTION_ARGS)
520520
{
521-
int4buflen;
521+
int32buflen;
522522
HStore*out;
523523
Pairs*pairs;
524524
Datum*key_datums;
@@ -632,7 +632,7 @@ hstore_from_array(PG_FUNCTION_ARGS)
632632
ArrayType*in_array=PG_GETARG_ARRAYTYPE_P(0);
633633
intndims=ARR_NDIM(in_array);
634634
intcount;
635-
int4buflen;
635+
int32buflen;
636636
HStore*out;
637637
Pairs*pairs;
638638
Datum*in_datums;
@@ -737,7 +737,7 @@ Datum
737737
hstore_from_record(PG_FUNCTION_ARGS)
738738
{
739739
HeapTupleHeaderrec;
740-
int4buflen;
740+
int32buflen;
741741
HStore*out;
742742
Pairs*pairs;
743743
OidtupType;

‎contrib/intarray/_int.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#defineMAXNUMRANGE 100
1111

1212
/* useful macros for accessing int4 arrays */
13-
#defineARRPTR(x) ( (int4 *) ARR_DATA_PTR(x) )
13+
#defineARRPTR(x) ( (int32 *) ARR_DATA_PTR(x) )
1414
#defineARRNELEMS(x) ArrayGetNItems(ARR_NDIM(x), ARR_DIMS(x))
1515

1616
/* reject arrays we can't handle; to wit, those containing nulls */
@@ -71,15 +71,15 @@ typedef char *BITVECP;
7171
typedefstruct
7272
{
7373
int32vl_len_;/* varlena header (do not touch directly!) */
74-
int4flag;
74+
int32flag;
7575
chardata[1];
7676
}GISTTYPE;
7777

7878
#defineALLISTRUE0x04
7979

8080
#defineISALLTRUE(x)( ((GISTTYPE*)x)->flag & ALLISTRUE )
8181

82-
#defineGTHDRSIZE(VARHDRSZ + sizeof(int4))
82+
#defineGTHDRSIZE(VARHDRSZ + sizeof(int32))
8383
#defineCALCGTSIZE(flag) ( GTHDRSIZE+(((flag) & ALLISTRUE) ? 0 : SIGLEN) )
8484

8585
#defineGETSIGN(x)( (BITVECP)( (char*)x+GTHDRSIZE ) )
@@ -93,7 +93,7 @@ typedef void (*formfloat) (ArrayType *, float *);
9393
/*
9494
* useful functions
9595
*/
96-
boolisort(int4*a,intlen);
96+
boolisort(int32*a,intlen);
9797
ArrayType*new_intArrayType(intnum);
9898
ArrayType*copy_intArrayType(ArrayType*a);
9999
ArrayType*resize_intArrayType(ArrayType*a,intnum);
@@ -123,15 +123,15 @@ voidgensign(BITVEC sign, int *a, int len);
123123
*/
124124
typedefstructITEM
125125
{
126-
int2type;
127-
int2left;
128-
int4val;
126+
int16type;
127+
int16left;
128+
int32val;
129129
}ITEM;
130130

131131
typedefstructQUERYTYPE
132132
{
133133
int32vl_len_;/* varlena header (do not touch directly!) */
134-
int4size;/* number of ITEMs */
134+
int32size;/* number of ITEMs */
135135
ITEMitems[1];/* variable length array */
136136
}QUERYTYPE;
137137

@@ -167,7 +167,7 @@ intcompDESC(const void *a, const void *b);
167167
do { \
168168
int_nelems_ = ARRNELEMS(a); \
169169
if (_nelems_ > 1) \
170-
qsort((void*) ARRPTR(a), _nelems_, sizeof(int4), \
170+
qsort((void*) ARRPTR(a), _nelems_, sizeof(int32), \
171171
(direction) ? compASC : compDESC ); \
172172
} while(0)
173173

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp