From 7bd8dea94f32b4d65c97e447c1defe8d223dee25 Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Sat, 19 Jun 1999 04:54:23 +0000 Subject: [PATCH] Change form() to varargform() to prevent portability problems. --- src/backend/access/index/istrat.c | 14 +++++++------- src/backend/catalog/index.c | 8 ++++---- src/backend/commands/command.c | 12 ++++++------ src/backend/libpq/portalbuf.c | 16 ++++++++-------- src/backend/optimizer/path/indxpath.c | 16 ++++++++-------- src/backend/utils/error/format.c | 4 ++-- src/backend/utils/mmgr/portalmem.c | 4 ++-- src/include/c.h | 8 ++++---- 8 files changed, 41 insertions(+), 41 deletions(-) diff --git a/src/backend/access/index/istrat.c b/src/backend/access/index/istrat.c index 70f2cdf61c..70eee09649 100644 --- a/src/backend/access/index/istrat.c +++ b/src/backend/access/index/istrat.c @@ -612,7 +612,7 @@ IndexSupportInitialize(IndexStrategy indexStrategy, attributeNumber++) { int16 support; - Form_pg_amproc form; + Form_pg_amproc aform; RegProcedure *loc; loc = &indexSupport[((attributeNumber - 1) * maxSupportNumber)]; @@ -627,8 +627,8 @@ IndexSupportInitialize(IndexStrategy indexStrategy, while (HeapTupleIsValid(tuple = heap_getnext(scan, 0))) { - form = (Form_pg_amproc) GETSTRUCT(tuple); - loc[(form->amprocnum - 1)] = form->amproc; + aform = (Form_pg_amproc) GETSTRUCT(tuple); + loc[(aform->amprocnum - 1)] = aform->amproc; } heap_endscan(scan); @@ -667,12 +667,12 @@ IndexSupportInitialize(IndexStrategy indexStrategy, while (HeapTupleIsValid(tuple = heap_getnext(scan, 0))) { - Form_pg_amop form; + Form_pg_amop aform; - form = (Form_pg_amop) GETSTRUCT(tuple); + aform = (Form_pg_amop) GETSTRUCT(tuple); OperatorRelationFillScanKeyEntry(operatorRelation, - form->amopopr, - StrategyMapGetScanKeyEntry(map, form->amopstrategy)); + aform->amopopr, + StrategyMapGetScanKeyEntry(map, aform->amopstrategy)); } heap_endscan(scan); diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 39b186be14..859967a677 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -372,7 +372,7 @@ AccessMethodObjectIdGetForm(Oid accessMethodObjectId) HeapScanDesc pg_am_scan; HeapTuple pg_am_tuple; ScanKeyData key; - Form_pg_am form; + Form_pg_am aform; /* ---------------- * form a scan key for the pg_am relation @@ -406,13 +406,13 @@ AccessMethodObjectIdGetForm(Oid accessMethodObjectId) * if found am tuple, then copy the form and return the copy * ---------------- */ - form = (Form_pg_am) palloc(sizeof *form); - memcpy(form, GETSTRUCT(pg_am_tuple), sizeof *form); + aform = (Form_pg_am) palloc(sizeof *aform); + memcpy(aform, GETSTRUCT(pg_am_tuple), sizeof *aform); heap_endscan(pg_am_scan); heap_close(pg_am_desc); - return form; + return aform; } /* ---------------------------------------------------------------- diff --git a/src/backend/commands/command.c b/src/backend/commands/command.c index 797d9b702d..497553b9ad 100644 --- a/src/backend/commands/command.c +++ b/src/backend/commands/command.c @@ -435,7 +435,7 @@ PerformAddAttribute(char *relationName, { HeapTuple typeTuple; - Form_pg_type form; + Form_pg_type tform; char *typename; int attnelems; @@ -469,21 +469,21 @@ PerformAddAttribute(char *relationName, typeTuple = SearchSysCacheTuple(TYPNAME, PointerGetDatum(typename), 0, 0, 0); - form = (Form_pg_type) GETSTRUCT(typeTuple); + tform = (Form_pg_type) GETSTRUCT(typeTuple); if (!HeapTupleIsValid(typeTuple)) elog(ERROR, "Add: type \"%s\" nonexistent", typename); namestrcpy(&(attribute->attname), colDef->colname); attribute->atttypid = typeTuple->t_data->t_oid; - attribute->attlen = form->typlen; + attribute->attlen = tform->typlen; attribute->attdisbursion = 0; attribute->attcacheoff = -1; attribute->atttypmod = colDef->typename->typmod; attribute->attnum = i; - attribute->attbyval = form->typbyval; + attribute->attbyval = tform->typbyval; attribute->attnelems = attnelems; - attribute->attisset = (bool) (form->typtype == 'c'); - attribute->attalign = form->typalign; + attribute->attisset = (bool) (tform->typtype == 'c'); + attribute->attalign = tform->typalign; attribute->attnotnull = false; attribute->atthasdef = (colDef->defval != NULL); diff --git a/src/backend/libpq/portalbuf.c b/src/backend/libpq/portalbuf.c index 0f8da31667..8a03fea740 100644 --- a/src/backend/libpq/portalbuf.c +++ b/src/backend/libpq/portalbuf.c @@ -89,7 +89,7 @@ portals_realloc(size_t size) portals = newp; else libpq_raise(&PortalError, - form("Cannot alloc more memory in portals_realloc")); + varargform("Cannot alloc more memory in portals_realloc")); for (i = oldsize; i < portals_array_size; i++) portals[i] = (PortalEntry *) NULL; @@ -109,11 +109,11 @@ pbuf_alloc(size_t size) caddr_t addr; if (size <= 0) - libpq_raise(&MemoryError, form("Invalid argument to pbuf_alloc().")); + libpq_raise(&MemoryError, varargform("Invalid argument to pbuf_alloc().")); addr = (caddr_t) palloc(size); if (addr == (caddr_t) NULL) - libpq_raise(&MemoryError, form("Cannot Allocate space.")); + libpq_raise(&MemoryError, varargform("Cannot Allocate space.")); return addr; } @@ -131,7 +131,7 @@ pbuf_free(caddr_t pointer) if (pointer) pfree(pointer); else - libpq_raise(&MemoryError, form("Tried to free NULL memory pointer")); + libpq_raise(&MemoryError, varargform("Tried to free NULL memory pointer")); } @@ -437,7 +437,7 @@ pbuf_close(char *pname) int i; if ((i = pbuf_getIndex(pname)) == -1) - libpq_raise(&PortalError, form("Portal %s does not exist.", pname)); + libpq_raise(&PortalError, varargform("Portal %s does not exist.", pname)); pbuf_freePortal(portals[i]->portal); pbuf_freeEntry(i); @@ -462,7 +462,7 @@ pbuf_findGroup(PortalBuffer *portal, if (group == NULL) libpq_raise(&PortalError, - form("Group index %d out of bound.", group_index)); + varargform("Group index %d out of bound.", group_index)); return group; } @@ -485,7 +485,7 @@ pbuf_findFnumber(GroupBuffer *group, return i; libpq_raise(&PortalError, - form("Field-name %s does not exist.", field_name)); + varargform("Field-name %s does not exist.", field_name)); /* not reached, here to make compiler happy */ return 0; @@ -502,7 +502,7 @@ pbuf_checkFnumber(GroupBuffer *group, { if (field_number < 0 || field_number >= group->no_fields) libpq_raise(&PortalError, - form("Field number %d out of bound.", field_number)); + varargform("Field number %d out of bound.", field_number)); } /* -------------------------------- diff --git a/src/backend/optimizer/path/indxpath.c b/src/backend/optimizer/path/indxpath.c index 01c5d8af75..45e5a292fd 100644 --- a/src/backend/optimizer/path/indxpath.c +++ b/src/backend/optimizer/path/indxpath.c @@ -1008,7 +1008,7 @@ clause_pred_clause_test(Expr *predicate, Node *clause) HeapScanDesc scan; HeapTuple tuple; ScanKeyData entry[3]; - Form_pg_amop form; + Form_pg_amop aform; pred_var = (Var *) get_leftop(predicate); pred_const = (Const *) get_rightop(predicate); @@ -1067,13 +1067,13 @@ clause_pred_clause_test(Expr *predicate, Node *clause) elog(DEBUG, "clause_pred_clause_test: unknown pred_op"); return false; } - form = (Form_pg_amop) GETSTRUCT(tuple); + aform = (Form_pg_amop) GETSTRUCT(tuple); /* Get the predicate operator's strategy number (1 to 5) */ - pred_strategy = (StrategyNumber) form->amopstrategy; + pred_strategy = (StrategyNumber) aform->amopstrategy; /* Remember which operator class this strategy number came from */ - opclass_id = form->amopclaid; + opclass_id = aform->amopclaid; heap_endscan(scan); @@ -1098,10 +1098,10 @@ clause_pred_clause_test(Expr *predicate, Node *clause) elog(DEBUG, "clause_pred_clause_test: unknown clause_op"); return false; } - form = (Form_pg_amop) GETSTRUCT(tuple); + aform = (Form_pg_amop) GETSTRUCT(tuple); /* Get the restriction clause operator's strategy number (1 to 5) */ - clause_strategy = (StrategyNumber) form->amopstrategy; + clause_strategy = (StrategyNumber) aform->amopstrategy; heap_endscan(scan); @@ -1130,10 +1130,10 @@ clause_pred_clause_test(Expr *predicate, Node *clause) elog(DEBUG, "clause_pred_clause_test: unknown test_op"); return false; } - form = (Form_pg_amop) GETSTRUCT(tuple); + aform = (Form_pg_amop) GETSTRUCT(tuple); /* Get the test operator */ - test_op = form->amopopr; + test_op = aform->amopopr; heap_endscan(scan); diff --git a/src/backend/utils/error/format.c b/src/backend/utils/error/format.c index ea40da1c3d..968fca7b65 100644 --- a/src/backend/utils/error/format.c +++ b/src/backend/utils/error/format.c @@ -22,11 +22,11 @@ static char FormBuf[FormMaxSize]; /* ---------------- - * form + * varargform * ---------------- */ char * -form(const char *fmt,...) +varargform(const char *fmt,...) { va_list args; diff --git a/src/backend/utils/mmgr/portalmem.c b/src/backend/utils/mmgr/portalmem.c index 86c4ff6a2a..070bab26f3 100644 --- a/src/backend/utils/mmgr/portalmem.c +++ b/src/backend/utils/mmgr/portalmem.c @@ -234,7 +234,7 @@ PortalVariableMemoryRealloc(PortalVariableMemory this, static char * PortalVariableMemoryGetName(PortalVariableMemory this) { - return form("%s-var", PortalVariableMemoryGetPortal(this)->name); + return varargform("%s-var", PortalVariableMemoryGetPortal(this)->name); } /* ---------------- @@ -312,7 +312,7 @@ PortalHeapMemoryRealloc(PortalHeapMemory this, static char * PortalHeapMemoryGetName(PortalHeapMemory this) { - return form("%s-heap", PortalHeapMemoryGetPortal(this)->name); + return varargform("%s-heap", PortalHeapMemoryGetPortal(this)->name); } /* ---------------- diff --git a/src/include/c.h b/src/include/c.h index 204ce3e395..8d2376d144 100644 --- a/src/include/c.h +++ b/src/include/c.h @@ -591,7 +591,7 @@ extern int assert_enabled; #define LogTrap(condition, exception, printArgs) \ { if ((assert_enabled) && (condition)) \ ExceptionalCondition(CppAsString(condition), &(exception), \ - form printArgs, __FILE__, __LINE__); } + varargform printArgs, __FILE__, __LINE__); } /* * LogTrapMacro is the same as LogTrap but it's intended for use in macros: @@ -602,7 +602,7 @@ extern int assert_enabled; ((bool) ((! assert_enabled) || (! condition) || \ (ExceptionalCondition(CppAsString(condition), \ &(exception), \ - form printArgs, __FILE__, __LINE__)))) + varargform printArgs, __FILE__, __LINE__)))) #ifndef USE_ASSERT_CHECKING #define LogAssert(condition, printArgs) @@ -711,10 +711,10 @@ extern int ExceptionalCondition(char *conditionName, /* ---------------- - * form is used by assert and the exception handling stuff + * varargform is used by assert and the exception handling stuff * ---------------- */ -extern char *form(const char *fmt,...); +extern char *varargform(const char *fmt,...); -- 2.39.5