1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-10 17:42:29 +03:00

New NameStr macro to convert Name to Str. No need for var.data anymore.

Fewer calls to nameout.

Better use of RelationGetRelationName.
This commit is contained in:
Bruce Momjian
1999-11-07 23:08:36 +00:00
parent df723a8a8a
commit 86ef36c907
65 changed files with 273 additions and 266 deletions

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.49 1999/07/17 20:16:35 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.50 1999/11/07 23:07:46 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -245,7 +245,7 @@ printatt(unsigned attributeId,
{
printf("\t%2d: %s%s%s%s\t(typeid = %u, len = %d, typmod = %d, byval = %c)\n",
attributeId,
attributeP->attname.data,
NameStr(attributeP->attname),
value != NULL ? " = \"" : "",
value != NULL ? value : "",
value != NULL ? "\"" : "",

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.55 1999/10/03 23:55:25 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.56 1999/11/07 23:07:47 momjian Exp $
*
* NOTES
* some of the executor utility code such as "ExecTypeFromTL" should be
@@ -278,7 +278,7 @@ TupleDescInitEntry(TupleDesc desc,
if (attributeName != NULL)
namestrcpy(&(att->attname), attributeName);
else
MemSet(att->attname.data, 0, NAMEDATALEN);
MemSet(NameStr(att->attname), 0, NAMEDATALEN);
att->attdisbursion = 0; /* dummy value */

View File

@@ -6,7 +6,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/gist/gist.c,v 1.46 1999/09/24 00:23:42 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/access/gist/gist.c,v 1.47 1999/11/07 23:07:48 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -111,7 +111,7 @@ gistbuild(Relation heap,
*/
if (oldPred == NULL && (nb = RelationGetNumberOfBlocks(index)) != 0)
elog(ERROR, "%s already contains data", index->rd_rel->relname.data);
elog(ERROR, "%s already contains data", RelationGetRelationName(index));
/* initialize the root page (if this is a new index) */
if (oldPred == NULL)

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashfunc.c,v 1.19 1999/07/15 22:38:35 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashfunc.c,v 1.20 1999/11/07 23:07:49 momjian Exp $
*
* NOTES
* These functions are stored in pg_amproc. For each operator class
@@ -177,7 +177,7 @@ hashname(NameData *n)
int len;
char *key;
key = n->data;
key = NameStr(*n);
h = 0;
len = NAMEDATALEN;

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.57 1999/10/30 23:10:21 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.58 1999/11/07 23:07:52 momjian Exp $
*
*
* INTERFACE ROUTINES
@@ -259,7 +259,7 @@ heapgettup(Relation relation,
elog(DEBUG, "heapgettup(..., b=0x%x, nkeys=%d, key=0x%x", buffer, nkeys, key);
elog(DEBUG, "heapgettup: relation(%c)=`%s', %p",
relation->rd_rel->relkind, &relation->rd_rel->relname,
relation->rd_rel->relkind, RelationGetRelationName(relation),
snapshot);
#endif /* !defined(HEAPDEBUGALL) */
@@ -525,7 +525,7 @@ heap_open(Oid relationId, LOCKMODE lockmode)
/* Under no circumstances will we return an index as a relation. */
if (RelationIsValid(r) && r->rd_rel->relkind == RELKIND_INDEX)
elog(ERROR, "%s is an index relation", r->rd_rel->relname.data);
elog(ERROR, "%s is an index relation", RelationGetRelationName(r));
if (lockmode == NoLock)
return r; /* caller must check RelationIsValid! */
@@ -567,7 +567,7 @@ heap_openr(char *relationName, LOCKMODE lockmode)
/* Under no circumstances will we return an index as a relation. */
if (RelationIsValid(r) && r->rd_rel->relkind == RELKIND_INDEX)
elog(ERROR, "%s is an index relation", r->rd_rel->relname.data);
elog(ERROR, "%s is an index relation", RelationGetRelationName(r));
if (lockmode == NoLock)
return r; /* caller must check RelationIsValid! */
@@ -765,7 +765,7 @@ heap_endscan(HeapScanDesc scan)
#ifdef HEAPDEBUGALL
#define HEAPDEBUG_1 \
elog(DEBUG, "heap_getnext([%s,nkeys=%d],backw=%d) called", \
scan->rs_rd->rd_rel->relname.data, scan->rs_nkeys, backw)
RelationGetRelationName(scan->rs_rd), scan->rs_nkeys, backw)
#define HEAPDEBUG_2 \
elog(DEBUG, "heap_getnext called with backw (no tracing yet)")
@@ -1045,7 +1045,7 @@ heap_fetch(Relation relation,
if (!BufferIsValid(buffer))
elog(ERROR, "heap_fetch: %s relation: ReadBuffer(%lx) failed",
&relation->rd_rel->relname, (long) tid);
RelationGetRelationName(relation), (long) tid);
LockBuffer(buffer, BUFFER_LOCK_SHARE);
@@ -1121,7 +1121,7 @@ heap_get_latest_tid(Relation relation,
if (!BufferIsValid(buffer))
elog(ERROR, "heap_get_latest_tid: %s relation: ReadBuffer(%lx) failed",
&relation->rd_rel->relname, (long) tid);
RelationGetRelationName(relation), (long) tid);
LockBuffer(buffer, BUFFER_LOCK_SHARE);
@@ -1231,7 +1231,7 @@ heap_insert(Relation relation, HeapTuple tup)
RelationPutHeapTupleAtEnd(relation, tup);
if (IsSystemRelationName(RelationGetRelationName(relation)->data))
if (IsSystemRelationName(RelationGetRelationName(relation)))
RelationInvalidateHeapTuple(relation, tup);
return tup->t_data->t_oid;

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/index/indexam.c,v 1.36 1999/09/18 19:06:04 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/access/index/indexam.c,v 1.37 1999/11/07 23:07:54 momjian Exp $
*
* INTERFACE ROUTINES
* index_open - open an index relation by relationId
@@ -147,7 +147,7 @@ index_open(Oid relationId)
elog(ERROR, "Index %u does not exist", relationId);
if (r->rd_rel->relkind != RELKIND_INDEX)
elog(ERROR, "%s is not an index relation", r->rd_rel->relname.data);
elog(ERROR, "%s is not an index relation", RelationGetRelationName(r));
return r;
}
@@ -169,7 +169,7 @@ index_openr(char *relationName)
elog(ERROR, "Index '%s' does not exist", relationName);
if (r->rd_rel->relkind != RELKIND_INDEX)
elog(ERROR, "%s is not an index relation", r->rd_rel->relname.data);
elog(ERROR, "%s is not an index relation", RelationGetRelationName(r));
return r;
}

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtcompare.c,v 1.27 1999/07/17 20:16:41 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtcompare.c,v 1.28 1999/11/07 23:07:56 momjian Exp $
*
* NOTES
* These functions are stored in pg_amproc. For each operator class
@@ -131,7 +131,7 @@ btcharcmp(char a, char b)
int32
btnamecmp(NameData *a, NameData *b)
{
return strncmp(a->data, b->data, NAMEDATALEN);
return strncmp(NameStr(*a), NameStr(*b), NAMEDATALEN);
}
int32

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtsearch.c,v 1.54 1999/09/27 18:20:21 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtsearch.c,v 1.55 1999/11/07 23:07:57 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -206,7 +206,7 @@ _bt_moveright(Relation rel,
PageGetItemId(page, P_FIRSTKEY),
BTEqualStrategyNumber))
elog(FATAL, "btree: BTP_CHAIN flag was expected in %s (access = %s)",
rel->rd_rel->relname.data, access ? "bt_write" : "bt_read");
RelationGetRelationName(rel), access ? "bt_write" : "bt_read");
if (_bt_skeycmp(rel, keysz, scankey, page,
PageGetItemId(page, offmax),
BTEqualStrategyNumber))

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtree.c,v 1.38 1999/09/24 00:23:59 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtree.c,v 1.39 1999/11/07 23:07:58 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -105,7 +105,7 @@ rtbuild(Relation heap,
*/
if (oldPred == NULL && (nb = RelationGetNumberOfBlocks(index)) != 0)
elog(ERROR, "%s already contains data", index->rd_rel->relname.data);
elog(ERROR, "%s already contains data", RelationGetRelationName(index));
/* initialize the root page (if this is a new index) */
if (oldPred == NULL)