1
0
mirror of https://github.com/postgres/postgres.git synced 2025-10-27 00:12:01 +03:00

Inline fastgetattr and others so data access does not use function

calls.
This commit is contained in:
Bruce Momjian
1998-01-31 04:39:26 +00:00
parent 2df6bba3ca
commit 726c3854cb
35 changed files with 350 additions and 215 deletions

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/async.c,v 1.27 1998/01/25 05:12:54 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/async.c,v 1.28 1998/01/31 04:38:17 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -219,7 +219,7 @@ Async_Notify(char *relname)
while (HeapTupleIsValid(lTuple = heap_getnext(sRel, 0, &b)))
{
d = heap_getattr(lTuple, b, Anum_pg_listener_notify,
d = heap_getattr(lTuple, Anum_pg_listener_notify,
tdesc, &isnull);
if (!DatumGetInt32(d))
{
@@ -294,12 +294,12 @@ Async_NotifyAtCommit()
while (HeapTupleIsValid(lTuple = heap_getnext(sRel, 0, &b)))
{
d = heap_getattr(lTuple, b, Anum_pg_listener_relname,
d = heap_getattr(lTuple, Anum_pg_listener_relname,
tdesc, &isnull);
if (AsyncExistsPendingNotify((char *) DatumGetPointer(d)))
{
d = heap_getattr(lTuple, b, Anum_pg_listener_pid,
d = heap_getattr(lTuple, Anum_pg_listener_pid,
tdesc, &isnull);
if (MyProcPid == DatumGetInt32(d))
@@ -444,12 +444,12 @@ Async_Listen(char *relname, int pid)
s = heap_beginscan(lDesc, 0, false, 0, (ScanKey) NULL);
while (HeapTupleIsValid(htup = heap_getnext(s, 0, &b)))
{
d = heap_getattr(htup, b, Anum_pg_listener_relname, tdesc,
d = heap_getattr(htup, Anum_pg_listener_relname, tdesc,
&isnull);
relnamei = DatumGetPointer(d);
if (!strncmp(relnamei, relname, NAMEDATALEN))
{
d = heap_getattr(htup, b, Anum_pg_listener_pid, tdesc, &isnull);
d = heap_getattr(htup, Anum_pg_listener_pid, tdesc, &isnull);
pid = DatumGetInt32(d);
if (pid == MyProcPid)
{
@@ -607,7 +607,7 @@ Async_NotifyFrontEnd()
while (HeapTupleIsValid(lTuple = heap_getnext(sRel, 0, &b)))
{
d = heap_getattr(lTuple, b, Anum_pg_listener_relname,
d = heap_getattr(lTuple, Anum_pg_listener_relname,
tdesc, &isnull);
rTuple = heap_modifytuple(lTuple, b, lRel, value, nulls, repl);
heap_replace(lRel, &lTuple->t_ctid, rTuple);

View File

@@ -6,7 +6,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.39 1998/01/16 23:19:40 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.40 1998/01/31 04:38:18 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -266,7 +266,7 @@ CopyTo(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
for (i = 0; i < attr_count; i++)
{
value = heap_getattr(tuple, InvalidBuffer, i + 1, tupDesc, &isnull);
value = heap_getattr(tuple, i + 1, tupDesc, &isnull);
if (!binary)
{
if (!isnull)
@@ -921,12 +921,12 @@ GetIndexRelations(Oid main_relation_oid,
{
index_relation_oid =
(Oid) DatumGetInt32(heap_getattr(tuple, InvalidBuffer, 2,
(Oid) DatumGetInt32(heap_getattr(tuple, 2,
tupDesc, &isnull));
if (index_relation_oid == main_relation_oid)
{
scan->index_rel_oid =
(Oid) DatumGetInt32(heap_getattr(tuple, InvalidBuffer,
(Oid) DatumGetInt32(heap_getattr(tuple,
Anum_pg_index_indexrelid,
tupDesc, &isnull));
(*n_indices)++;

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.5 1998/01/05 16:38:51 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.6 1998/01/31 04:38:19 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -258,12 +258,12 @@ check_permissions(char *command,
if (dbfound)
{
dbowner = (Oid) heap_getattr(dbtup, InvalidBuffer,
dbowner = (Oid) heap_getattr(dbtup,
Anum_pg_database_datdba,
RelationGetTupleDescriptor(dbrel),
(char *) NULL);
*dbIdP = dbtup->t_oid;
dbtext = (text *) heap_getattr(dbtup, InvalidBuffer,
dbtext = (text *) heap_getattr(dbtup,
Anum_pg_database_datpath,
RelationGetTupleDescriptor(dbrel),
(char *) NULL);

View File

@@ -118,12 +118,12 @@ void DefineUser(CreateUserStmt *stmt) {
scan = heap_beginscan(pg_user_rel, false, false, 0, NULL);
while (HeapTupleIsValid(tuple = heap_getnext(scan, 0, &buffer))) {
datum = heap_getattr(tuple, buffer, Anum_pg_user_usename, pg_user_dsc, &n);
datum = heap_getattr(tuple, Anum_pg_user_usename, pg_user_dsc, &n);
if (!exists && !strncmp((char*)datum, stmt->user, strlen(stmt->user)))
exists = true;
datum = heap_getattr(tuple, buffer, Anum_pg_user_usesysid, pg_user_dsc, &n);
datum = heap_getattr(tuple, Anum_pg_user_usesysid, pg_user_dsc, &n);
if ((int)datum > max_id)
max_id = (int)datum;
@@ -229,7 +229,7 @@ extern void AlterUser(AlterUserStmt *stmt) {
scan = heap_beginscan(pg_user_rel, false, false, 0, NULL);
while (HeapTupleIsValid(tuple = heap_getnext(scan, 0, &buffer))) {
datum = heap_getattr(tuple, buffer, Anum_pg_user_usename, pg_user_dsc, &n);
datum = heap_getattr(tuple, Anum_pg_user_usename, pg_user_dsc, &n);
if (!strncmp((char*)datum, stmt->user, strlen(stmt->user))) {
exists = true;
@@ -340,10 +340,10 @@ extern void RemoveUser(char* user) {
scan = heap_beginscan(pg_user_rel, false, false, 0, NULL);
while (HeapTupleIsValid(tuple = heap_getnext(scan, 0, &buffer))) {
datum = heap_getattr(tuple, buffer, Anum_pg_user_usename, pg_dsc, &n);
datum = heap_getattr(tuple, Anum_pg_user_usename, pg_dsc, &n);
if (!strncmp((char*)datum, user, strlen(user))) {
usesysid = (int)heap_getattr(tuple, buffer, Anum_pg_user_usesysid, pg_dsc, &n);
usesysid = (int)heap_getattr(tuple, Anum_pg_user_usesysid, pg_dsc, &n);
ReleaseBuffer(buffer);
break;
}
@@ -367,10 +367,10 @@ extern void RemoveUser(char* user) {
scan = heap_beginscan(pg_rel, false, false, 0, NULL);
while (HeapTupleIsValid(tuple = heap_getnext(scan, 0, &buffer))) {
datum = heap_getattr(tuple, buffer, Anum_pg_database_datdba, pg_dsc, &n);
datum = heap_getattr(tuple, Anum_pg_database_datdba, pg_dsc, &n);
if ((int)datum == usesysid) {
datum = heap_getattr(tuple, buffer, Anum_pg_database_datname, pg_dsc, &n);
datum = heap_getattr(tuple, Anum_pg_database_datname, pg_dsc, &n);
if (memcmp((void*)datum, "template1", 9)) {
dbase = (char**)realloc((void*)dbase, sizeof(char*) * (ndbase + 1));
dbase[ndbase] = (char*)malloc(NAMEDATALEN + 1);

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.58 1998/01/15 19:42:40 pgsql Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.59 1998/01/31 04:38:21 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -299,7 +299,7 @@ vc_getrels(NameData *VacRelP)
found = true;
d = heap_getattr(pgctup, buf, Anum_pg_class_relname, pgcdesc, &n);
d = heap_getattr(pgctup, Anum_pg_class_relname, pgcdesc, &n);
rname = (char *) d;
/*
@@ -317,7 +317,7 @@ vc_getrels(NameData *VacRelP)
continue;
}
d = heap_getattr(pgctup, buf, Anum_pg_class_relkind, pgcdesc, &n);
d = heap_getattr(pgctup, Anum_pg_class_relkind, pgcdesc, &n);
rkind = DatumGetChar(d);
@@ -1637,7 +1637,7 @@ vc_attrstats(Relation onerel, VRelStats *vacrelstats, HeapTuple htup)
VacAttrStats *stats = &vacattrstats[i];
bool value_hit = true;
value = heap_getattr(htup, InvalidBuffer,
value = heap_getattr(htup,
stats->attr->attnum, tupDesc, &isnull);
if (!VacAttrStatsEqValid(stats))
@@ -2166,7 +2166,7 @@ vc_getindices(Oid relid, int *nindices, Relation **Irel)
while (HeapTupleIsValid(pgitup = heap_getnext(pgiscan, 0, NULL)))
{
d = heap_getattr(pgitup, InvalidBuffer, Anum_pg_index_indexrelid,
d = heap_getattr(pgitup, Anum_pg_index_indexrelid,
pgidesc, &n);
i++;
if (i % 10 == 0)