Skip to content

Commit eaf0380

Browse files
committed
Fix C++ compile failures in headers.
Avoid using "typeid" as a parameter name in header files, since that is a C++ keyword. These cases were introduced recently, in 04fe805 and 586b98f. Since I'm an incurable neatnik, also rename these parameters in the underlying function definitions. That's not really necessary per project rules, but I don't like function declarations that don't quite agree with the underlying definitions. Per src/tools/pginclude/cpluspluscheck.
1 parent a968d54 commit eaf0380

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

src/backend/optimizer/plan/setrefs.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -2589,13 +2589,13 @@ record_plan_function_dependency(PlannerInfo *root, Oid funcid)
25892589
* someday fix_expr_common might call it.
25902590
*/
25912591
void
2592-
record_plan_type_dependency(PlannerInfo *root, Oid typeid)
2592+
record_plan_type_dependency(PlannerInfo *root, Oid typid)
25932593
{
25942594
/*
25952595
* As in record_plan_function_dependency, ignore the possibility that
25962596
* someone would change a built-in domain.
25972597
*/
2598-
if (typeid >= (Oid) FirstBootstrapObjectId)
2598+
if (typid >= (Oid) FirstBootstrapObjectId)
25992599
{
26002600
PlanInvalItem *inval_item = makeNode(PlanInvalItem);
26012601

@@ -2606,7 +2606,7 @@ record_plan_type_dependency(PlannerInfo *root, Oid typeid)
26062606
*/
26072607
inval_item->cacheId = TYPEOID;
26082608
inval_item->hashValue = GetSysCacheHashValue1(TYPEOID,
2609-
ObjectIdGetDatum(typeid));
2609+
ObjectIdGetDatum(typid));
26102610

26112611
root->glob->invalItems = lappend(root->glob->invalItems, inval_item);
26122612
}

src/backend/utils/adt/varlena.c

+8-8
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ typedef struct
6969
int last_returned; /* Last comparison result (cache) */
7070
bool cache_blob; /* Does buf2 contain strxfrm() blob, etc? */
7171
bool collate_c;
72-
Oid typeid; /* Actual datatype (text/bpchar/bytea/name) */
72+
Oid typid; /* Actual datatype (text/bpchar/bytea/name) */
7373
hyperLogLogState abbr_card; /* Abbreviated key cardinality state */
7474
hyperLogLogState full_card; /* Full key cardinality state */
7575
double prop_card; /* Required cardinality proportion */
@@ -1835,7 +1835,7 @@ bttextsortsupport(PG_FUNCTION_ARGS)
18351835
* this will not work with any other collation, though.
18361836
*/
18371837
void
1838-
varstr_sortsupport(SortSupport ssup, Oid typeid, Oid collid)
1838+
varstr_sortsupport(SortSupport ssup, Oid typid, Oid collid)
18391839
{
18401840
bool abbreviate = ssup->abbreviate;
18411841
bool collate_c = false;
@@ -1857,9 +1857,9 @@ varstr_sortsupport(SortSupport ssup, Oid typeid, Oid collid)
18571857
*/
18581858
if (lc_collate_is_c(collid))
18591859
{
1860-
if (typeid == BPCHAROID)
1860+
if (typid == BPCHAROID)
18611861
ssup->comparator = bpcharfastcmp_c;
1862-
else if (typeid == NAMEOID)
1862+
else if (typid == NAMEOID)
18631863
{
18641864
ssup->comparator = namefastcmp_c;
18651865
/* Not supporting abbreviation with type NAME, for now */
@@ -1910,7 +1910,7 @@ varstr_sortsupport(SortSupport ssup, Oid typeid, Oid collid)
19101910
/*
19111911
* We use varlenafastcmp_locale except for type NAME.
19121912
*/
1913-
if (typeid == NAMEOID)
1913+
if (typid == NAMEOID)
19141914
{
19151915
ssup->comparator = namefastcmp_locale;
19161916
/* Not supporting abbreviation with type NAME, for now */
@@ -1983,7 +1983,7 @@ varstr_sortsupport(SortSupport ssup, Oid typeid, Oid collid)
19831983
*/
19841984
sss->cache_blob = true;
19851985
sss->collate_c = collate_c;
1986-
sss->typeid = typeid;
1986+
sss->typid = typid;
19871987
ssup->ssup_extra = sss;
19881988

19891989
/*
@@ -2160,7 +2160,7 @@ varstrfastcmp_locale(char *a1p, int len1, char *a2p, int len2, SortSupport ssup)
21602160
return 0;
21612161
}
21622162

2163-
if (sss->typeid == BPCHAROID)
2163+
if (sss->typid == BPCHAROID)
21642164
{
21652165
/* Get true number of bytes, ignoring trailing spaces */
21662166
len1 = bpchartruelen(a1p, len1);
@@ -2333,7 +2333,7 @@ varstr_abbrev_convert(Datum original, SortSupport ssup)
23332333
len = VARSIZE_ANY_EXHDR(authoritative);
23342334

23352335
/* Get number of bytes, ignoring trailing spaces */
2336-
if (sss->typeid == BPCHAROID)
2336+
if (sss->typid == BPCHAROID)
23372337
len = bpchartruelen(authoritative_data, len);
23382338

23392339
/*

src/include/optimizer/planmain.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ extern bool innerrel_is_unique(PlannerInfo *root,
118118
*/
119119
extern Plan *set_plan_references(PlannerInfo *root, Plan *plan);
120120
extern void record_plan_function_dependency(PlannerInfo *root, Oid funcid);
121-
extern void record_plan_type_dependency(PlannerInfo *root, Oid typeid);
121+
extern void record_plan_type_dependency(PlannerInfo *root, Oid typid);
122122
extern void extract_query_dependencies(Node *query,
123123
List **relationOids,
124124
List **invalItems,

src/include/utils/varlena.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#include "utils/sortsupport.h"
1818

1919
extern int varstr_cmp(const char *arg1, int len1, const char *arg2, int len2, Oid collid);
20-
extern void varstr_sortsupport(SortSupport ssup, Oid typeid, Oid collid);
20+
extern void varstr_sortsupport(SortSupport ssup, Oid typid, Oid collid);
2121
extern int varstr_levenshtein(const char *source, int slen,
2222
const char *target, int tlen,
2323
int ins_c, int del_c, int sub_c,

0 commit comments

Comments
 (0)