Skip to content

Commit 312017f

Browse files
committed
Fix C++ incompatibilities in plpgsql's header files.
Rename some exposed parameters so that they don't conflict with C++ reserved words. Back-patch to all supported versions. George Tarasov Discussion: https://postgr.es/m/b517ec3918d645eb950505eac8dd434e@gaz-is.ru
1 parent 9c9a74c commit 312017f

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

src/pl/plpgsql/src/pl_comp.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2203,16 +2203,16 @@ plpgsql_start_datums(void)
22032203
* ----------
22042204
*/
22052205
void
2206-
plpgsql_adddatum(PLpgSQL_datum *new)
2206+
plpgsql_adddatum(PLpgSQL_datum *newdatum)
22072207
{
22082208
if (plpgsql_nDatums == datums_alloc)
22092209
{
22102210
datums_alloc *= 2;
22112211
plpgsql_Datums = repalloc(plpgsql_Datums, sizeof(PLpgSQL_datum *) * datums_alloc);
22122212
}
22132213

2214-
new->dno = plpgsql_nDatums;
2215-
plpgsql_Datums[plpgsql_nDatums++] = new;
2214+
newdatum->dno = plpgsql_nDatums;
2215+
plpgsql_Datums[plpgsql_nDatums++] = newdatum;
22162216
}
22172217

22182218
/* ----------

src/pl/plpgsql/src/pl_exec.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5552,7 +5552,7 @@ plpgsql_exec_get_datum_type(PLpgSQL_execstate *estate,
55525552
void
55535553
plpgsql_exec_get_datum_type_info(PLpgSQL_execstate *estate,
55545554
PLpgSQL_datum *datum,
5555-
Oid *typeid, int32 *typmod, Oid *collation)
5555+
Oid *typeId, int32 *typMod, Oid *collation)
55565556
{
55575557
switch (datum->dtype)
55585558
{
@@ -5561,8 +5561,8 @@ plpgsql_exec_get_datum_type_info(PLpgSQL_execstate *estate,
55615561
{
55625562
PLpgSQL_var *var = (PLpgSQL_var *) datum;
55635563

5564-
*typeid = var->datatype->typoid;
5565-
*typmod = var->datatype->atttypmod;
5564+
*typeId = var->datatype->typoid;
5565+
*typMod = var->datatype->atttypmod;
55665566
*collation = var->datatype->collation;
55675567
break;
55685568
}
@@ -5574,15 +5574,15 @@ plpgsql_exec_get_datum_type_info(PLpgSQL_execstate *estate,
55745574
if (rec->erh == NULL || rec->rectypeid != RECORDOID)
55755575
{
55765576
/* Report variable's declared type */
5577-
*typeid = rec->rectypeid;
5578-
*typmod = -1;
5577+
*typeId = rec->rectypeid;
5578+
*typMod = -1;
55795579
}
55805580
else
55815581
{
55825582
/* Report record's actual type if declared RECORD */
5583-
*typeid = rec->erh->er_typeid;
5583+
*typeId = rec->erh->er_typeid;
55845584
/* do NOT return the mutable typmod of a RECORD variable */
5585-
*typmod = -1;
5585+
*typMod = -1;
55865586
}
55875587
/* composite types are never collatable */
55885588
*collation = InvalidOid;
@@ -5620,16 +5620,16 @@ plpgsql_exec_get_datum_type_info(PLpgSQL_execstate *estate,
56205620
recfield->rectupledescid = rec->erh->er_tupdesc_id;
56215621
}
56225622

5623-
*typeid = recfield->finfo.ftypeid;
5624-
*typmod = recfield->finfo.ftypmod;
5623+
*typeId = recfield->finfo.ftypeid;
5624+
*typMod = recfield->finfo.ftypmod;
56255625
*collation = recfield->finfo.fcollation;
56265626
break;
56275627
}
56285628

56295629
default:
56305630
elog(ERROR, "unrecognized dtype: %d", datum->dtype);
5631-
*typeid = InvalidOid; /* keep compiler quiet */
5632-
*typmod = -1;
5631+
*typeId = InvalidOid; /* keep compiler quiet */
5632+
*typMod = -1;
56335633
*collation = InvalidOid;
56345634
break;
56355635
}

src/pl/plpgsql/src/plpgsql.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1198,7 +1198,7 @@ extern PLpgSQL_recfield *plpgsql_build_recfield(PLpgSQL_rec *rec,
11981198
extern int plpgsql_recognize_err_condition(const char *condname,
11991199
bool allow_sqlstate);
12001200
extern PLpgSQL_condition *plpgsql_parse_err_condition(char *condname);
1201-
extern void plpgsql_adddatum(PLpgSQL_datum *new);
1201+
extern void plpgsql_adddatum(PLpgSQL_datum *newdatum);
12021202
extern int plpgsql_add_initdatums(int **varnos);
12031203
extern void plpgsql_HashTableInit(void);
12041204

@@ -1225,7 +1225,7 @@ extern Oid plpgsql_exec_get_datum_type(PLpgSQL_execstate *estate,
12251225
PLpgSQL_datum *datum);
12261226
extern void plpgsql_exec_get_datum_type_info(PLpgSQL_execstate *estate,
12271227
PLpgSQL_datum *datum,
1228-
Oid *typeid, int32 *typmod, Oid *collation);
1228+
Oid *typeId, int32 *typMod, Oid *collation);
12291229

12301230
/*
12311231
* Functions for namespace handling in pl_funcs.c

0 commit comments

Comments
 (0)