1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-13 16:22:44 +03:00

Alignment cleanup so no more massive switch statements for alignment,

just two macros.
This commit is contained in:
Bruce Momjian
1998-09-07 05:35:48 +00:00
parent e15807f410
commit 202751921d
10 changed files with 113 additions and 333 deletions

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.60 1998/09/01 04:27:31 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.61 1998/09/07 05:35:37 momjian Exp $
*
*
* INTERFACE ROUTINES
@@ -64,8 +64,7 @@
#define NTUPLES_PER_PAGE(natts) (BLCKSZ/((natts)*AVG_TUPLE_SIZE))
/* non-export function prototypes */
static Oid
RelationNameGetObjectId(char *relationName, Relation pg_class);
static Oid RelationNameGetObjectId(char *relationName, Relation pg_class);
static Oid GetHeapRelationOid(char *heapRelationName, char *indexRelationName);
static TupleDesc BuildFuncTupleDesc(FuncIndexInfo *funcInfo);
static TupleDesc ConstructTupleDescriptor(Oid heapoid, Relation heapRelation,
@@ -73,12 +72,11 @@ static TupleDesc ConstructTupleDescriptor(Oid heapoid, Relation heapRelation,
int numatts, AttrNumber *attNums);
static void ConstructIndexReldesc(Relation indexRelation, Oid amoid);
static Oid UpdateRelationRelation(Relation indexRelation);
static Oid UpdateRelationRelation(Relation indexRelation);
static void InitializeAttributeOids(Relation indexRelation,
int numatts,
Oid indexoid);
static void
AppendAttributeTuples(Relation indexRelation, int numatts);
static void AppendAttributeTuples(Relation indexRelation, int numatts);
static void UpdateIndexRelation(Oid indexoid, Oid heapoid,
FuncIndexInfo *funcInfo, int natts,
AttrNumber *attNums, Oid *classOids, Node *predicate,
@@ -552,11 +550,9 @@ UpdateRelationRelation(Relation indexRelation)
sizeof(*indexRelation->rd_rel),
(char *) indexRelation->rd_rel);
/* ----------------
* the new tuple must have the same oid as the relcache entry for the
* index. sure would be embarassing to do this sort of thing in polite
* company.
* ----------------
/*
* The new tuple must have the same oid as the heap_create() we just
* did.
*/
tuple->t_oid = RelationGetRelid(indexRelation);
heap_insert(pg_class, tuple);
@@ -1078,7 +1074,7 @@ index_create(char *heapRelationName,
/* ----------------
* add index to catalogs
* (append RELATION tuple)
* (INSERT pg_class tuple)
* ----------------
*/
indexoid = UpdateRelationRelation(indexRelation);
@@ -1264,8 +1260,7 @@ FormIndexDatum(int numberOfAttributes,
char *nullv,
FuncIndexInfoPtr fInfo)
{
AttrNumber i;
int offset;
AttrNumber attOff;
bool isNull;
/* ----------------
@@ -1275,18 +1270,16 @@ FormIndexDatum(int numberOfAttributes,
* ----------------
*/
for (i = 1; i <= numberOfAttributes; i++)
for (attOff = 0; attOff < numberOfAttributes; attOff++)
{
offset = AttrNumberGetAttrOffset(i);
datum[offset] = PointerGetDatum(GetIndexValue(heapTuple,
datum[attOff] = PointerGetDatum(GetIndexValue(heapTuple,
heapDescriptor,
offset,
attOff,
attributeNumber,
fInfo,
&isNull));
nullv[offset] = (isNull) ? 'n' : ' ';
nullv[attOff] = (isNull) ? 'n' : ' ';
}
}

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/indexing.c,v 1.30 1998/09/02 23:05:23 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/catalog/indexing.c,v 1.31 1998/09/07 05:35:39 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -129,25 +129,29 @@ CatalogIndexInsert(Relation *idescs,
Assert(index_tup);
index_form = (Form_pg_index) GETSTRUCT(index_tup);
/*
* Compute the number of attributes we are indexing upon.
*/
for (attnumP = index_form->indkey, natts = 0;
*attnumP != InvalidAttrNumber;
attnumP++, natts++)
;
if (index_form->indproc != InvalidOid)
{
FIgetnArgs(&finfo) = natts;
int fatts;
/*
* Compute the number of attributes we are indexing upon.
*/
for (attnumP = index_form->indkey, fatts = 0;
*attnumP != InvalidAttrNumber && fatts < INDEX_MAX_KEYS;
attnumP++, fatts++)
;
FIgetnArgs(&finfo) = fatts;
natts = 1;
FIgetProcOid(&finfo) = index_form->indproc;
*(FIgetname(&finfo)) = '\0';
finfoP = &finfo;
}
else
{
natts = RelationGetDescr(idescs[i])->natts;
finfoP = (FuncIndexInfo *) NULL;
}
FormIndexDatum(natts,
(AttrNumber *) index_form->indkey,
heapTuple,
@@ -160,6 +164,7 @@ CatalogIndexInsert(Relation *idescs,
&heapTuple->t_ctid, heapRelation);
if (indexRes)
pfree(indexRes);
pfree(index_tup);
}
}