Skip to content

Commit 3f61b32

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 7640f93 commit 3f61b32

File tree

3 files changed

+17
-16
lines changed

3 files changed

+17
-16
lines changed

src/pl/plpgsql/src/pl_comp.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2212,16 +2212,16 @@ plpgsql_start_datums(void)
22122212
* ----------
22132213
*/
22142214
void
2215-
plpgsql_adddatum(PLpgSQL_datum *new)
2215+
plpgsql_adddatum(PLpgSQL_datum *newdatum)
22162216
{
22172217
if (plpgsql_nDatums == datums_alloc)
22182218
{
22192219
datums_alloc *= 2;
22202220
plpgsql_Datums = repalloc(plpgsql_Datums, sizeof(PLpgSQL_datum *) * datums_alloc);
22212221
}
22222222

2223-
new->dno = plpgsql_nDatums;
2224-
plpgsql_Datums[plpgsql_nDatums++] = new;
2223+
newdatum->dno = plpgsql_nDatums;
2224+
plpgsql_Datums[plpgsql_nDatums++] = newdatum;
22252225
}
22262226

22272227
/* ----------

src/pl/plpgsql/src/pl_exec.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5583,7 +5583,7 @@ plpgsql_exec_get_datum_type(PLpgSQL_execstate *estate,
55835583
void
55845584
plpgsql_exec_get_datum_type_info(PLpgSQL_execstate *estate,
55855585
PLpgSQL_datum *datum,
5586-
Oid *typeid, int32 *typmod, Oid *collation)
5586+
Oid *typeId, int32 *typMod, Oid *collation)
55875587
{
55885588
switch (datum->dtype)
55895589
{
@@ -5592,8 +5592,8 @@ plpgsql_exec_get_datum_type_info(PLpgSQL_execstate *estate,
55925592
{
55935593
PLpgSQL_var *var = (PLpgSQL_var *) datum;
55945594

5595-
*typeid = var->datatype->typoid;
5596-
*typmod = var->datatype->atttypmod;
5595+
*typeId = var->datatype->typoid;
5596+
*typMod = var->datatype->atttypmod;
55975597
*collation = var->datatype->collation;
55985598
break;
55995599
}
@@ -5605,15 +5605,15 @@ plpgsql_exec_get_datum_type_info(PLpgSQL_execstate *estate,
56055605
if (rec->erh == NULL || rec->rectypeid != RECORDOID)
56065606
{
56075607
/* Report variable's declared type */
5608-
*typeid = rec->rectypeid;
5609-
*typmod = -1;
5608+
*typeId = rec->rectypeid;
5609+
*typMod = -1;
56105610
}
56115611
else
56125612
{
56135613
/* Report record's actual type if declared RECORD */
5614-
*typeid = rec->erh->er_typeid;
5614+
*typeId = rec->erh->er_typeid;
56155615
/* do NOT return the mutable typmod of a RECORD variable */
5616-
*typmod = -1;
5616+
*typMod = -1;
56175617
}
56185618
/* composite types are never collatable */
56195619
*collation = InvalidOid;
@@ -5651,16 +5651,16 @@ plpgsql_exec_get_datum_type_info(PLpgSQL_execstate *estate,
56515651
recfield->rectupledescid = rec->erh->er_tupdesc_id;
56525652
}
56535653

5654-
*typeid = recfield->finfo.ftypeid;
5655-
*typmod = recfield->finfo.ftypmod;
5654+
*typeId = recfield->finfo.ftypeid;
5655+
*typMod = recfield->finfo.ftypmod;
56565656
*collation = recfield->finfo.fcollation;
56575657
break;
56585658
}
56595659

56605660
default:
56615661
elog(ERROR, "unrecognized dtype: %d", datum->dtype);
5662-
*typeid = InvalidOid; /* keep compiler quiet */
5663-
*typmod = -1;
5662+
*typeId = InvalidOid; /* keep compiler quiet */
5663+
*typMod = -1;
56645664
*collation = InvalidOid;
56655665
break;
56665666
}

src/pl/plpgsql/src/plpgsql.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,7 +1239,7 @@ extern PLpgSQL_recfield *plpgsql_build_recfield(PLpgSQL_rec *rec,
12391239
extern int plpgsql_recognize_err_condition(const char *condname,
12401240
bool allow_sqlstate);
12411241
extern PLpgSQL_condition *plpgsql_parse_err_condition(char *condname);
1242-
extern void plpgsql_adddatum(PLpgSQL_datum *new);
1242+
extern void plpgsql_adddatum(PLpgSQL_datum *newdatum);
12431243
extern int plpgsql_add_initdatums(int **varnos);
12441244
extern void plpgsql_HashTableInit(void);
12451245

@@ -1266,7 +1266,8 @@ extern Oid plpgsql_exec_get_datum_type(PLpgSQL_execstate *estate,
12661266
PLpgSQL_datum *datum);
12671267
extern void plpgsql_exec_get_datum_type_info(PLpgSQL_execstate *estate,
12681268
PLpgSQL_datum *datum,
1269-
Oid *typeid, int32 *typmod, Oid *collation);
1269+
Oid *typeId, int32 *typMod,
1270+
Oid *collation);
12701271

12711272
/*
12721273
* Functions for namespace handling in pl_funcs.c

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy