Skip to content

Commit 2ec065b

Browse files
committed
Fix formatting to comply with pgindent
This PR fixes all the formatting to be inline with the latest version of pgindent. Since pgindent does not like variables named `type`, those have been appropriately renamed.
1 parent 4f2f1a6 commit 2ec065b

File tree

3 files changed

+33
-31
lines changed

3 files changed

+33
-31
lines changed

src/agg_bookend.c

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ TS_FUNCTION_INFO_V1(bookend_deserializefunc);
2828
/* A PolyDatum represents a polymorphic datum */
2929
typedef struct PolyDatum
3030
{
31-
Oid type;
31+
Oid type_oid;
3232
bool is_null;
3333
Datum datum;
3434
} PolyDatum;
@@ -37,7 +37,7 @@ typedef struct PolyDatum
3737
/* PolyDatumIOState is internal state used by polydatum_serialize and polydatum_deserialize */
3838
typedef struct PolyDatumIOState
3939
{
40-
Oid type;
40+
Oid type_oid;
4141
FmgrInfo proc;
4242
Oid typeioparam;
4343
} PolyDatumIOState;
@@ -47,7 +47,7 @@ polydatum_from_arg(int argno, FunctionCallInfo fcinfo)
4747
{
4848
PolyDatum value;
4949

50-
value.type = get_fn_expr_argtype(fcinfo->flinfo, argno);
50+
value.type_oid = get_fn_expr_argtype(fcinfo->flinfo, argno);
5151
value.is_null = PG_ARGISNULL(argno);
5252
if (!value.is_null)
5353
{
@@ -66,7 +66,7 @@ polydatum_serialize(PolyDatum *pd, StringInfo buf, PolyDatumIOState *state, Func
6666
{
6767
bytea *outputbytes;
6868

69-
pq_sendint(buf, pd->type, sizeof(Oid));
69+
pq_sendint(buf, pd->type_oid, sizeof(Oid));
7070

7171
if (pd->is_null)
7272
{
@@ -75,17 +75,17 @@ polydatum_serialize(PolyDatum *pd, StringInfo buf, PolyDatumIOState *state, Func
7575
return;
7676
}
7777

78-
if (state->type != pd->type)
78+
if (state->type_oid != pd->type_oid)
7979
{
8080
Oid func;
8181
bool is_varlena;
8282

83-
getTypeBinaryOutputInfo(pd->type,
83+
getTypeBinaryOutputInfo(pd->type_oid,
8484
&func,
8585
&is_varlena);
8686
fmgr_info_cxt(func, &state->proc,
8787
fcinfo->flinfo->fn_mcxt);
88-
state->type = pd->type;
88+
state->type_oid = pd->type_oid;
8989
}
9090
outputbytes = SendFunctionCall(&state->proc, pd->datum);
9191
pq_sendint(buf, VARSIZE(outputbytes) - VARHDRSZ, 4);
@@ -110,7 +110,7 @@ polydatum_deserialize(PolyDatum *result, StringInfo buf, PolyDatumIOState *state
110110
result = palloc(sizeof(PolyDatum));
111111
}
112112

113-
result->type = pq_getmsgint(buf, sizeof(Oid));
113+
result->type_oid = pq_getmsgint(buf, sizeof(Oid));
114114

115115
/* Following is copied/adapted from record_recv in core postgres */
116116

@@ -151,16 +151,16 @@ polydatum_deserialize(PolyDatum *result, StringInfo buf, PolyDatumIOState *state
151151
}
152152

153153
/* Now call the column's receiveproc */
154-
if (state->type != result->type)
154+
if (state->type_oid != result->type_oid)
155155
{
156156
Oid func;
157157

158-
getTypeBinaryInputInfo(result->type,
158+
getTypeBinaryInputInfo(result->type_oid,
159159
&func,
160160
&state->typeioparam);
161161
fmgr_info_cxt(func, &state->proc,
162162
fcinfo->flinfo->fn_mcxt);
163-
state->type = result->type;
163+
state->type_oid = result->type_oid;
164164
}
165165

166166
result->datum = ReceiveFunctionCall(&state->proc,
@@ -197,24 +197,24 @@ typedef struct InternalCmpAggStoreIOState
197197

198198
typedef struct TypeInfoCache
199199
{
200-
Oid type;
200+
Oid type_oid;
201201
int16 typelen;
202202
bool typebyval;
203203
} TypeInfoCache;
204204

205205
inline static void
206206
typeinfocache_init(TypeInfoCache *tic)
207207
{
208-
tic->type = InvalidOid;
208+
tic->type_oid = InvalidOid;
209209
}
210210

211211
inline static void
212212
typeinfocache_polydatumcopy(TypeInfoCache *tic, PolyDatum input, PolyDatum *output)
213213
{
214-
if (tic->type != input.type)
214+
if (tic->type_oid != input.type_oid)
215215
{
216-
tic->type = input.type;
217-
get_typlenbyval(tic->type, &tic->typelen, &tic->typebyval);
216+
tic->type_oid = input.type_oid;
217+
get_typlenbyval(tic->type_oid, &tic->typelen, &tic->typebyval);
218218
}
219219
*output = input;
220220
if (!input.is_null)
@@ -239,22 +239,22 @@ cmpfunccache_init(CmpFuncCache *cache)
239239
inline static bool
240240
cmpfunccache_cmp(CmpFuncCache *cache, FunctionCallInfo fcinfo, char *opname, PolyDatum left, PolyDatum right)
241241
{
242-
Assert(left.type == right.type);
242+
Assert(left.type_oid == right.type_oid);
243243
Assert(opname[1] == '\0');
244244

245-
if (cache->cmp_type != left.type || cache->op != opname[0])
245+
if (cache->cmp_type != left.type_oid || cache->op != opname[0])
246246
{
247247
Oid cmp_op,
248248
cmp_regproc;
249249

250-
if (!OidIsValid(left.type))
250+
if (!OidIsValid(left.type_oid))
251251
elog(ERROR, "could not determine the type of the comparison_element");
252-
cmp_op = OpernameGetOprid(list_make1(makeString(opname)), left.type, left.type);
252+
cmp_op = OpernameGetOprid(list_make1(makeString(opname)), left.type_oid, left.type_oid);
253253
if (!OidIsValid(cmp_op))
254-
elog(ERROR, "could not find a %s operator for type %d", opname, left.type);
254+
elog(ERROR, "could not find a %s operator for type %d", opname, left.type_oid);
255255
cmp_regproc = get_opcode(cmp_op);
256256
if (!OidIsValid(cmp_regproc))
257-
elog(ERROR, "could not find the procedure for the %s operator for type %d", opname, left.type);
257+
elog(ERROR, "could not find the procedure for the %s operator for type %d", opname, left.type_oid);
258258
fmgr_info_cxt(cmp_regproc, &cache->proc,
259259
fcinfo->flinfo->fn_mcxt);
260260
}

src/sort_transform.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ sort_transform_ec(PlannerInfo *root, EquivalenceClass *orig)
284284
if (transformed_expr != ec_mem->em_expr)
285285
{
286286
EquivalenceMember *em;
287-
Oid type = exprType((Node *) transformed_expr);
287+
Oid type_oid = exprType((Node *) transformed_expr);
288288
List *opfamilies = list_copy(orig->ec_opfamilies);
289289

290290
/*
@@ -293,7 +293,7 @@ sort_transform_ec(PlannerInfo *root, EquivalenceClass *orig)
293293
*/
294294
EquivalenceClass *exist =
295295
get_eclass_for_sort_expr(root, transformed_expr, ec_mem->em_nullable_relids,
296-
opfamilies, type,
296+
opfamilies, type_oid,
297297
orig->ec_collation, orig->ec_sortref,
298298
ec_mem->em_relids, false);
299299

@@ -309,7 +309,7 @@ sort_transform_ec(PlannerInfo *root, EquivalenceClass *orig)
309309
em->em_nullable_relids = bms_copy(ec_mem->em_nullable_relids);
310310
em->em_is_const = ec_mem->em_is_const;
311311
em->em_is_child = ec_mem->em_is_child;
312-
em->em_datatype = type;
312+
em->em_datatype = type_oid;
313313

314314
if (newec == NULL)
315315
{

src/utils.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,10 @@ time_to_internal(PG_FUNCTION_ARGS)
167167
int64
168168
time_value_to_internal(Datum time_val, Oid type_oid, bool failure_ok)
169169
{
170-
Datum res, tz;
170+
Datum res,
171+
tz;
171172

172-
switch(type_oid)
173+
switch (type_oid)
173174
{
174175
case INT8OID:
175176
return DatumGetInt64(time_val);
@@ -178,10 +179,11 @@ time_value_to_internal(Datum time_val, Oid type_oid, bool failure_ok)
178179
case INT2OID:
179180
return (int64) DatumGetInt16(time_val);
180181
case TIMESTAMPOID:
182+
181183
/*
182-
* for timestamps, ignore timezones, make believe the timestamp is at
183-
* UTC
184-
*/
184+
* for timestamps, ignore timezones, make believe the timestamp is
185+
* at UTC
186+
*/
185187
res = DirectFunctionCall1(pg_timestamp_to_unix_microseconds, time_val);
186188

187189
return DatumGetInt64(res);
@@ -425,7 +427,7 @@ date_trunc_interval_period_approx(text *units)
425427
case DTK_YEAR:
426428
return 1 * DAYS_PER_YEAR * USECS_PER_DAY;
427429
case DTK_QUARTER:
428-
return DAYS_PER_QUARTER * USECS_PER_DAY;
430+
return DAYS_PER_QUARTER * USECS_PER_DAY;
429431
case DTK_MONTH:
430432
return DAYS_PER_MONTH * USECS_PER_DAY;
431433
case DTK_DAY:

0 commit comments

Comments
 (0)