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:
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/storage/buffer/bufmgr.c,v 1.64 1999/09/28 11:41:06 vadim Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/storage/buffer/bufmgr.c,v 1.65 1999/11/07 23:08:14 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -622,7 +622,7 @@ BufferAlloc(Relation reln,
|
||||
}
|
||||
|
||||
/* record the database name and relation name for this buffer */
|
||||
strcpy(buf->sb_relname, reln->rd_rel->relname.data);
|
||||
strcpy(buf->sb_relname, RelationGetRelationName(reln));
|
||||
strcpy(buf->sb_dbname, DatabaseName);
|
||||
|
||||
INIT_BUFFERTAG(&(buf->tag), reln, blockNum);
|
||||
@@ -1598,21 +1598,23 @@ FlushRelationBuffers(Relation rel, BlockNumber block, bool doFlush)
|
||||
if (FlushBuffer(-i-1, false) != STATUS_OK)
|
||||
{
|
||||
elog(NOTICE, "FlushRelationBuffers(%s (local), %u): block %u is dirty, could not flush it",
|
||||
rel->rd_rel->relname.data, block, buf->tag.blockNum);
|
||||
RelationGetRelationName(rel),
|
||||
block, buf->tag.blockNum);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
elog(NOTICE, "FlushRelationBuffers(%s (local), %u): block %u is dirty",
|
||||
rel->rd_rel->relname.data, block, buf->tag.blockNum);
|
||||
RelationGetRelationName(rel),
|
||||
block, buf->tag.blockNum);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
if (LocalRefCount[i] > 0)
|
||||
{
|
||||
elog(NOTICE, "FlushRelationBuffers(%s (local), %u): block %u is referenced (%d)",
|
||||
rel->rd_rel->relname.data, block,
|
||||
RelationGetRelationName(rel), block,
|
||||
buf->tag.blockNum, LocalRefCount[i]);
|
||||
return -2;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/storage/large_object/inv_api.c,v 1.60 1999/10/13 15:02:25 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/storage/large_object/inv_api.c,v 1.61 1999/11/07 23:08:16 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -210,7 +210,7 @@ inv_open(Oid lobjId, int flags)
|
||||
|
||||
r = heap_open(lobjId, AccessShareLock);
|
||||
|
||||
indname = pstrdup((r->rd_rel->relname).data);
|
||||
indname = pstrdup(RelationGetRelationName(r));
|
||||
|
||||
/*
|
||||
* hack hack hack... we know that the fourth character of the
|
||||
@@ -282,7 +282,7 @@ inv_destroy(Oid lobjId)
|
||||
if (!RelationIsValid(r) || r->rd_rel->relkind != RELKIND_LOBJECT)
|
||||
return -1;
|
||||
|
||||
heap_destroy_with_catalog(r->rd_rel->relname.data);
|
||||
heap_destroy_with_catalog(RelationGetRelationName(r));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.63 1999/10/12 14:54:27 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.64 1999/11/07 23:08:17 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -46,7 +46,7 @@
|
||||
* This is so that we can support more backends. (system-wide semaphore
|
||||
* sets run out pretty fast.) -ay 4/95
|
||||
*
|
||||
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.63 1999/10/12 14:54:27 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.64 1999/11/07 23:08:17 momjian Exp $
|
||||
*/
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
@@ -155,7 +155,6 @@ InitProcGlobal(IPCKey key, int maxBackends)
|
||||
{
|
||||
IPCKey semKey = ProcGlobal->currKey + i;
|
||||
int semId;
|
||||
int semstat;
|
||||
|
||||
semId = IpcSemaphoreCreate(semKey,
|
||||
PROC_NSEMS_PER_SET,
|
||||
@@ -180,7 +179,6 @@ void
|
||||
InitProcess(IPCKey key)
|
||||
{
|
||||
bool found = false;
|
||||
int semstat;
|
||||
unsigned long location,
|
||||
myOffset;
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/storage/smgr/md.c,v 1.58 1999/11/04 08:01:00 inoue Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/storage/smgr/md.c,v 1.59 1999/11/07 23:08:19 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -121,7 +121,7 @@ mdcreate(Relation reln)
|
||||
char *path;
|
||||
|
||||
Assert(reln->rd_unlinked && reln->rd_fd < 0);
|
||||
path = relpath(reln->rd_rel->relname.data);
|
||||
path = relpath(RelationGetRelationName(reln));
|
||||
#ifndef __CYGWIN32__
|
||||
fd = FileNameOpenFile(path, O_RDWR | O_CREAT | O_EXCL, 0600);
|
||||
#else
|
||||
@@ -319,7 +319,7 @@ mdopen(Relation reln)
|
||||
int vfd;
|
||||
|
||||
Assert(reln->rd_fd < 0);
|
||||
path = relpath(reln->rd_rel->relname.data);
|
||||
path = relpath(RelationGetRelationName(reln));
|
||||
|
||||
#ifndef __CYGWIN32__
|
||||
fd = FileNameOpenFile(path, O_RDWR, 0600);
|
||||
@@ -1011,7 +1011,7 @@ _mdfd_openseg(Relation reln, int segno, int oflags)
|
||||
*fullpath;
|
||||
|
||||
/* be sure we have enough space for the '.segno', if any */
|
||||
path = relpath(RelationGetRelationName(reln)->data);
|
||||
path = relpath(RelationGetRelationName(reln));
|
||||
|
||||
dofree = false;
|
||||
if (segno > 0)
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/storage/smgr/smgr.c,v 1.30 1999/11/04 08:01:01 inoue Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/storage/smgr/smgr.c,v 1.31 1999/11/07 23:08:20 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -131,7 +131,7 @@ smgrcreate(int16 which, Relation reln)
|
||||
int fd;
|
||||
|
||||
if ((fd = (*(smgrsw[which].smgr_create)) (reln)) < 0)
|
||||
elog(ERROR, "cannot create %s", reln->rd_rel->relname.data);
|
||||
elog(ERROR, "cannot create %s", RelationGetRelationName(reln));
|
||||
|
||||
return fd;
|
||||
}
|
||||
@@ -147,7 +147,7 @@ smgrunlink(int16 which, Relation reln)
|
||||
int status;
|
||||
|
||||
if ((status = (*(smgrsw[which].smgr_unlink)) (reln)) == SM_FAIL)
|
||||
elog(ERROR, "cannot unlink %s", reln->rd_rel->relname.data);
|
||||
elog(ERROR, "cannot unlink %s", RelationGetRelationName(reln));
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -166,7 +166,8 @@ smgrextend(int16 which, Relation reln, char *buffer)
|
||||
status = (*(smgrsw[which].smgr_extend)) (reln, buffer);
|
||||
|
||||
if (status == SM_FAIL)
|
||||
elog(ERROR, "%s: cannot extend. Check free disk space.", reln->rd_rel->relname.data);
|
||||
elog(ERROR, "%s: cannot extend. Check free disk space.",
|
||||
RelationGetRelationName(reln));
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -184,7 +185,7 @@ smgropen(int16 which, Relation reln)
|
||||
|
||||
if ((fd = (*(smgrsw[which].smgr_open)) (reln)) < 0 &&
|
||||
!reln->rd_unlinked)
|
||||
elog(ERROR, "cannot open %s", reln->rd_rel->relname.data);
|
||||
elog(ERROR, "cannot open %s", RelationGetRelationName(reln));
|
||||
|
||||
return fd;
|
||||
}
|
||||
@@ -204,7 +205,7 @@ int
|
||||
smgrclose(int16 which, Relation reln)
|
||||
{
|
||||
if ((*(smgrsw[which].smgr_close)) (reln) == SM_FAIL)
|
||||
elog(ERROR, "cannot close %s", reln->rd_rel->relname.data);
|
||||
elog(ERROR, "cannot close %s", RelationGetRelationName(reln));
|
||||
|
||||
return SM_SUCCESS;
|
||||
}
|
||||
@@ -228,7 +229,7 @@ smgrread(int16 which, Relation reln, BlockNumber blocknum, char *buffer)
|
||||
|
||||
if (status == SM_FAIL)
|
||||
elog(ERROR, "cannot read block %d of %s",
|
||||
blocknum, reln->rd_rel->relname.data);
|
||||
blocknum, RelationGetRelationName(reln));
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -250,7 +251,7 @@ smgrwrite(int16 which, Relation reln, BlockNumber blocknum, char *buffer)
|
||||
|
||||
if (status == SM_FAIL)
|
||||
elog(ERROR, "cannot write block %d of %s",
|
||||
blocknum, reln->rd_rel->relname.data);
|
||||
blocknum, RelationGetRelationName(reln));
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -267,7 +268,7 @@ smgrflush(int16 which, Relation reln, BlockNumber blocknum, char *buffer)
|
||||
|
||||
if (status == SM_FAIL)
|
||||
elog(ERROR, "cannot flush block %d of %s to stable store",
|
||||
blocknum, reln->rd_rel->relname.data);
|
||||
blocknum, RelationGetRelationName(reln));
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -326,7 +327,8 @@ smgrnblocks(int16 which, Relation reln)
|
||||
int nblocks;
|
||||
|
||||
if ((nblocks = (*(smgrsw[which].smgr_nblocks)) (reln)) < 0)
|
||||
elog(ERROR, "cannot count blocks for %s", reln->rd_rel->relname.data);
|
||||
elog(ERROR, "cannot count blocks for %s",
|
||||
RelationGetRelationName(reln));
|
||||
|
||||
return nblocks;
|
||||
}
|
||||
@@ -348,7 +350,7 @@ smgrtruncate(int16 which, Relation reln, int nblocks)
|
||||
{
|
||||
if ((newblks = (*(smgrsw[which].smgr_truncate)) (reln, nblocks)) < 0)
|
||||
elog(ERROR, "cannot truncate %s to %d blocks",
|
||||
reln->rd_rel->relname.data, nblocks);
|
||||
RelationGetRelationName(reln), nblocks);
|
||||
}
|
||||
|
||||
return newblks;
|
||||
|
||||
Reference in New Issue
Block a user