Fix C++ incompatibilities in plpgsql's header files.
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 31 May 2019 16:34:54 +0000 (12:34 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 31 May 2019 16:34:54 +0000 (12:34 -0400)
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

src/pl/plpgsql/src/pl_comp.c
src/pl/plpgsql/src/pl_exec.c
src/pl/plpgsql/src/plpgsql.h

index 59460d264345da2ac8ca5890bb1f47a2605136d5..f5ca1a359f505bc1f60410c5178d2ed8b1ef9378 100644 (file)
@@ -2203,7 +2203,7 @@ plpgsql_start_datums(void)
  * ----------
  */
 void
-plpgsql_adddatum(PLpgSQL_datum *new)
+plpgsql_adddatum(PLpgSQL_datum *newdatum)
 {
    if (plpgsql_nDatums == datums_alloc)
    {
@@ -2211,8 +2211,8 @@ plpgsql_adddatum(PLpgSQL_datum *new)
        plpgsql_Datums = repalloc(plpgsql_Datums, sizeof(PLpgSQL_datum *) * datums_alloc);
    }
 
-   new->dno = plpgsql_nDatums;
-   plpgsql_Datums[plpgsql_nDatums++] = new;
+   newdatum->dno = plpgsql_nDatums;
+   plpgsql_Datums[plpgsql_nDatums++] = newdatum;
 }
 
 /* ----------
index cbb4014bdf43d9c5b620eaeb1f40060657d36d84..2f49754c5f47dc89c2d53330771bbd712b020ff4 100644 (file)
@@ -5552,7 +5552,7 @@ plpgsql_exec_get_datum_type(PLpgSQL_execstate *estate,
 void
 plpgsql_exec_get_datum_type_info(PLpgSQL_execstate *estate,
                                 PLpgSQL_datum *datum,
-                                Oid *typeid, int32 *typmod, Oid *collation)
+                                Oid *typeId, int32 *typMod, Oid *collation)
 {
    switch (datum->dtype)
    {
@@ -5561,8 +5561,8 @@ plpgsql_exec_get_datum_type_info(PLpgSQL_execstate *estate,
            {
                PLpgSQL_var *var = (PLpgSQL_var *) datum;
 
-               *typeid = var->datatype->typoid;
-               *typmod = var->datatype->atttypmod;
+               *typeId = var->datatype->typoid;
+               *typMod = var->datatype->atttypmod;
                *collation = var->datatype->collation;
                break;
            }
@@ -5574,15 +5574,15 @@ plpgsql_exec_get_datum_type_info(PLpgSQL_execstate *estate,
                if (rec->erh == NULL || rec->rectypeid != RECORDOID)
                {
                    /* Report variable's declared type */
-                   *typeid = rec->rectypeid;
-                   *typmod = -1;
+                   *typeId = rec->rectypeid;
+                   *typMod = -1;
                }
                else
                {
                    /* Report record's actual type if declared RECORD */
-                   *typeid = rec->erh->er_typeid;
+                   *typeId = rec->erh->er_typeid;
                    /* do NOT return the mutable typmod of a RECORD variable */
-                   *typmod = -1;
+                   *typMod = -1;
                }
                /* composite types are never collatable */
                *collation = InvalidOid;
@@ -5620,16 +5620,16 @@ plpgsql_exec_get_datum_type_info(PLpgSQL_execstate *estate,
                    recfield->rectupledescid = rec->erh->er_tupdesc_id;
                }
 
-               *typeid = recfield->finfo.ftypeid;
-               *typmod = recfield->finfo.ftypmod;
+               *typeId = recfield->finfo.ftypeid;
+               *typMod = recfield->finfo.ftypmod;
                *collation = recfield->finfo.fcollation;
                break;
            }
 
        default:
            elog(ERROR, "unrecognized dtype: %d", datum->dtype);
-           *typeid = InvalidOid;   /* keep compiler quiet */
-           *typmod = -1;
+           *typeId = InvalidOid;   /* keep compiler quiet */
+           *typMod = -1;
            *collation = InvalidOid;
            break;
    }
index fb9fcb55f527ad5d472ce4be9e372ee976c005a5..fc2bff2ebf37bb870c0173332a87c3434ab7d387 100644 (file)
@@ -1198,7 +1198,7 @@ extern PLpgSQL_recfield *plpgsql_build_recfield(PLpgSQL_rec *rec,
 extern int plpgsql_recognize_err_condition(const char *condname,
                                bool allow_sqlstate);
 extern PLpgSQL_condition *plpgsql_parse_err_condition(char *condname);
-extern void plpgsql_adddatum(PLpgSQL_datum *new);
+extern void plpgsql_adddatum(PLpgSQL_datum *newdatum);
 extern int plpgsql_add_initdatums(int **varnos);
 extern void plpgsql_HashTableInit(void);
 
@@ -1225,7 +1225,7 @@ extern Oid plpgsql_exec_get_datum_type(PLpgSQL_execstate *estate,
                            PLpgSQL_datum *datum);
 extern void plpgsql_exec_get_datum_type_info(PLpgSQL_execstate *estate,
                                 PLpgSQL_datum *datum,
-                                Oid *typeid, int32 *typmod, Oid *collation);
+                                Oid *typeId, int32 *typMod, Oid *collation);
 
 /*
  * Functions for namespace handling in pl_funcs.c