mirror of
https://github.com/postgres/postgres.git
synced 2025-11-10 17:42:29 +03:00
pgindent run before 6.3 release, with Thomas' requested changes.
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.36 1998/02/11 19:09:21 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.37 1998/02/26 04:29:15 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
* The old interface functions have been converted to macros
|
||||
@@ -34,14 +34,14 @@
|
||||
#endif
|
||||
|
||||
/* Used by heap_getattr() macro, for speed */
|
||||
long heap_sysoffset[] = {
|
||||
long heap_sysoffset[] = {
|
||||
/* Only the first one is pass-by-ref, and is handled specially in the macro */
|
||||
offsetof(HeapTupleData, t_ctid),
|
||||
offsetof(HeapTupleData, t_oid),
|
||||
offsetof(HeapTupleData, t_xmin),
|
||||
offsetof(HeapTupleData, t_cmin),
|
||||
offsetof(HeapTupleData, t_xmax),
|
||||
offsetof(HeapTupleData, t_cmax)
|
||||
offsetof(HeapTupleData, t_ctid),
|
||||
offsetof(HeapTupleData, t_oid),
|
||||
offsetof(HeapTupleData, t_xmin),
|
||||
offsetof(HeapTupleData, t_cmin),
|
||||
offsetof(HeapTupleData, t_xmax),
|
||||
offsetof(HeapTupleData, t_cmax)
|
||||
};
|
||||
|
||||
/* ----------------------------------------------------------------
|
||||
@@ -350,7 +350,7 @@ heap_getsysattr(HeapTuple tup, Buffer b, int attnum)
|
||||
{
|
||||
switch (attnum)
|
||||
{
|
||||
case SelfItemPointerAttributeNumber:
|
||||
case SelfItemPointerAttributeNumber:
|
||||
return ((Datum) &tup->t_ctid);
|
||||
case ObjectIdAttributeNumber:
|
||||
return ((Datum) (long) tup->t_oid);
|
||||
@@ -389,16 +389,16 @@ heap_getsysattr(HeapTuple tup, Buffer b, int attnum)
|
||||
*/
|
||||
Datum
|
||||
nocachegetattr(HeapTuple tup,
|
||||
int attnum,
|
||||
TupleDesc tupleDesc,
|
||||
bool *isnull)
|
||||
int attnum,
|
||||
TupleDesc tupleDesc,
|
||||
bool *isnull)
|
||||
{
|
||||
char *tp; /* ptr to att in tuple */
|
||||
bits8 *bp = tup->t_bits; /* ptr to att in tuple */
|
||||
bits8 *bp = tup->t_bits; /* ptr to att in tuple */
|
||||
int slow; /* do we have to walk nulls? */
|
||||
AttributeTupleForm *att = tupleDesc->attrs;
|
||||
|
||||
|
||||
|
||||
#if IN_MACRO
|
||||
/* This is handled in the macro */
|
||||
Assert(attnum > 0);
|
||||
@@ -430,6 +430,7 @@ nocachegetattr(HeapTuple tup,
|
||||
}
|
||||
else if (attnum == 0)
|
||||
{
|
||||
|
||||
/*
|
||||
* first attribute is always at position zero
|
||||
*/
|
||||
@@ -470,11 +471,11 @@ nocachegetattr(HeapTuple tup,
|
||||
* ----------------
|
||||
*/
|
||||
{
|
||||
int i = 0; /* current offset in bp */
|
||||
int mask; /* bit in byte we're looking at */
|
||||
char n; /* current byte in bp */
|
||||
int byte,
|
||||
finalbit;
|
||||
int i = 0; /* current offset in bp */
|
||||
int mask; /* bit in byte we're looking at */
|
||||
char n; /* current byte in bp */
|
||||
int byte,
|
||||
finalbit;
|
||||
|
||||
byte = attnum >> 3;
|
||||
finalbit = attnum & 0x07;
|
||||
@@ -486,14 +487,14 @@ nocachegetattr(HeapTuple tup,
|
||||
{
|
||||
/* check for nulls in any "earlier" bytes */
|
||||
if ((~n) != 0)
|
||||
slow=1;
|
||||
slow = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* check for nulls "before" final bit of last byte */
|
||||
mask = (1 << finalbit) - 1;
|
||||
if ((~n) & mask)
|
||||
slow=1;
|
||||
slow = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -508,8 +509,8 @@ nocachegetattr(HeapTuple tup,
|
||||
{
|
||||
if (att[attnum]->attcacheoff != -1)
|
||||
{
|
||||
return (Datum)fetchatt(&(att[attnum]),
|
||||
tp + att[attnum]->attcacheoff);
|
||||
return (Datum) fetchatt(&(att[attnum]),
|
||||
tp + att[attnum]->attcacheoff);
|
||||
}
|
||||
else if (attnum == 0)
|
||||
{
|
||||
@@ -517,11 +518,11 @@ nocachegetattr(HeapTuple tup,
|
||||
}
|
||||
else if (!HeapTupleAllFixed(tup))
|
||||
{
|
||||
int j = 0;
|
||||
int j = 0;
|
||||
|
||||
/*
|
||||
* In for(), we make this <= and not < because we want to
|
||||
* test if we can go past it in initializing offsets.
|
||||
* In for(), we make this <= and not < because we want to test
|
||||
* if we can go past it in initializing offsets.
|
||||
*/
|
||||
for (j = 0; j <= attnum && !slow; j++)
|
||||
if (att[j]->attlen < 1 && !VARLENA_FIXED_SIZE(att[j]))
|
||||
@@ -536,8 +537,8 @@ nocachegetattr(HeapTuple tup,
|
||||
*/
|
||||
if (!slow)
|
||||
{
|
||||
int j = 1;
|
||||
long off;
|
||||
int j = 1;
|
||||
long off;
|
||||
|
||||
/*
|
||||
* need to set cache for some atts
|
||||
@@ -554,13 +555,14 @@ nocachegetattr(HeapTuple tup,
|
||||
off = att[j - 1]->attcacheoff + att[j - 1]->atttypmod;
|
||||
|
||||
for (; j <= attnum ||
|
||||
/* Can we compute more? We will probably need them */
|
||||
(j < tup->t_natts &&
|
||||
att[j]->attcacheoff == -1 &&
|
||||
(HeapTupleNoNulls(tup) || !att_isnull(j, bp)) &&
|
||||
(HeapTupleAllFixed(tup)||
|
||||
att[j]->attlen > 0 || VARLENA_FIXED_SIZE(att[j]))); j++)
|
||||
/* Can we compute more? We will probably need them */
|
||||
(j < tup->t_natts &&
|
||||
att[j]->attcacheoff == -1 &&
|
||||
(HeapTupleNoNulls(tup) || !att_isnull(j, bp)) &&
|
||||
(HeapTupleAllFixed(tup) ||
|
||||
att[j]->attlen > 0 || VARLENA_FIXED_SIZE(att[j]))); j++)
|
||||
{
|
||||
|
||||
/*
|
||||
* Fix me when going to a machine with more than a four-byte
|
||||
* word!
|
||||
@@ -605,7 +607,7 @@ nocachegetattr(HeapTuple tup,
|
||||
break;
|
||||
case -1:
|
||||
Assert(!VARLENA_FIXED_SIZE(att[j]) ||
|
||||
att[j]->atttypmod == VARSIZE(tp + off));
|
||||
att[j]->atttypmod == VARSIZE(tp + off));
|
||||
off += VARSIZE(tp + off);
|
||||
break;
|
||||
default:
|
||||
@@ -618,9 +620,9 @@ nocachegetattr(HeapTuple tup,
|
||||
}
|
||||
else
|
||||
{
|
||||
bool usecache = true;
|
||||
int off = 0;
|
||||
int i;
|
||||
bool usecache = true;
|
||||
int off = 0;
|
||||
int i;
|
||||
|
||||
/*
|
||||
* Now we know that we have to walk the tuple CAREFULLY.
|
||||
@@ -665,7 +667,7 @@ nocachegetattr(HeapTuple tup,
|
||||
default:
|
||||
if (att[i]->attlen < sizeof(int32))
|
||||
elog(ERROR,
|
||||
"nocachegetattr2: attribute %d has len %d",
|
||||
"nocachegetattr2: attribute %d has len %d",
|
||||
i, att[i]->attlen);
|
||||
if (att[i]->attalign == 'd')
|
||||
off = DOUBLEALIGN(off);
|
||||
@@ -690,7 +692,7 @@ nocachegetattr(HeapTuple tup,
|
||||
break;
|
||||
case -1:
|
||||
Assert(!VARLENA_FIXED_SIZE(att[i]) ||
|
||||
att[i]->atttypmod == VARSIZE(tp + off));
|
||||
att[i]->atttypmod == VARSIZE(tp + off));
|
||||
off += VARSIZE(tp + off);
|
||||
if (!VARLENA_FIXED_SIZE(att[i]))
|
||||
usecache = false;
|
||||
@@ -965,9 +967,9 @@ heap_modifytuple(HeapTuple tuple,
|
||||
* ----------------
|
||||
*/
|
||||
infomask = newTuple->t_infomask;
|
||||
memmove((char *) &newTuple->t_oid, /* XXX */
|
||||
memmove((char *) &newTuple->t_oid, /* XXX */
|
||||
(char *) &tuple->t_oid,
|
||||
((char *) &tuple->t_hoff - (char *) &tuple->t_oid)); /* XXX */
|
||||
((char *) &tuple->t_hoff - (char *) &tuple->t_oid)); /* XXX */
|
||||
newTuple->t_infomask = infomask;
|
||||
newTuple->t_natts = numberOfAttributes; /* fix t_natts just in
|
||||
* case */
|
||||
@@ -993,7 +995,7 @@ heap_addheader(uint32 natts, /* max domain index */
|
||||
int structlen, /* its length */
|
||||
char *structure) /* pointer to the struct */
|
||||
{
|
||||
char *tp; /* tuple data pointer */
|
||||
char *tp; /* tuple data pointer */
|
||||
HeapTuple tup;
|
||||
long len;
|
||||
int hoff;
|
||||
@@ -1018,4 +1020,3 @@ heap_addheader(uint32 natts, /* max domain index */
|
||||
|
||||
return (tup);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/common/indextuple.c,v 1.27 1998/02/11 19:09:23 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/common/indextuple.c,v 1.28 1998/02/26 04:29:18 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -41,7 +41,7 @@ index_formtuple(TupleDesc tupleDescriptor,
|
||||
Datum value[],
|
||||
char null[])
|
||||
{
|
||||
char *tp; /* tuple pointer */
|
||||
char *tp; /* tuple pointer */
|
||||
IndexTuple tuple; /* return tuple */
|
||||
Size size,
|
||||
hoff;
|
||||
@@ -133,14 +133,14 @@ index_formtuple(TupleDesc tupleDescriptor,
|
||||
*/
|
||||
Datum
|
||||
nocache_index_getattr(IndexTuple tup,
|
||||
int attnum,
|
||||
TupleDesc tupleDesc,
|
||||
bool *isnull)
|
||||
int attnum,
|
||||
TupleDesc tupleDesc,
|
||||
bool *isnull)
|
||||
{
|
||||
char *tp; /* ptr to att in tuple */
|
||||
char *bp = NULL; /* ptr to att in tuple */
|
||||
char *tp; /* ptr to att in tuple */
|
||||
char *bp = NULL; /* ptr to att in tuple */
|
||||
int slow; /* do we have to walk nulls? */
|
||||
int data_off; /* tuple data offset */
|
||||
int data_off; /* tuple data offset */
|
||||
AttributeTupleForm *att = tupleDesc->attrs;
|
||||
|
||||
/* ----------------
|
||||
@@ -174,7 +174,7 @@ nocache_index_getattr(IndexTuple tup,
|
||||
|
||||
#ifdef IN_MACRO
|
||||
/* This is handled in the macro */
|
||||
|
||||
|
||||
/* first attribute is always at position zero */
|
||||
|
||||
if (attnum == 1)
|
||||
@@ -184,8 +184,8 @@ nocache_index_getattr(IndexTuple tup,
|
||||
if (att[attnum]->attcacheoff != -1)
|
||||
{
|
||||
return (Datum) fetchatt(&(att[attnum]),
|
||||
(char *) tup + data_off +
|
||||
att[attnum]->attcacheoff);
|
||||
(char *) tup + data_off +
|
||||
att[attnum]->attcacheoff);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -206,11 +206,11 @@ nocache_index_getattr(IndexTuple tup,
|
||||
* here! */
|
||||
#ifdef IN_MACRO
|
||||
/* This is handled in the macro */
|
||||
|
||||
|
||||
if (att_isnull(attnum, bp))
|
||||
{
|
||||
*isnull = true;
|
||||
return (Datum)NULL;
|
||||
return (Datum) NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -219,11 +219,11 @@ nocache_index_getattr(IndexTuple tup,
|
||||
* ----------------
|
||||
*/
|
||||
{
|
||||
int i = 0; /* current offset in bp */
|
||||
int mask; /* bit in byte we're looking at */
|
||||
char n; /* current byte in bp */
|
||||
int byte,
|
||||
finalbit;
|
||||
int i = 0; /* current offset in bp */
|
||||
int mask; /* bit in byte we're looking at */
|
||||
char n; /* current byte in bp */
|
||||
int byte,
|
||||
finalbit;
|
||||
|
||||
byte = attnum >> 3;
|
||||
finalbit = attnum & 0x07;
|
||||
@@ -235,14 +235,14 @@ nocache_index_getattr(IndexTuple tup,
|
||||
{
|
||||
/* check for nulls in any "earlier" bytes */
|
||||
if ((~n) != 0)
|
||||
slow=1;
|
||||
slow = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* check for nulls "before" final bit of last byte */
|
||||
mask = (1 << finalbit) - 1;
|
||||
if ((~n) & mask)
|
||||
slow=1;
|
||||
slow = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -257,7 +257,7 @@ nocache_index_getattr(IndexTuple tup,
|
||||
if (att[attnum]->attcacheoff != -1)
|
||||
{
|
||||
return (Datum) fetchatt(&(att[attnum]),
|
||||
tp + att[attnum]->attcacheoff);
|
||||
tp + att[attnum]->attcacheoff);
|
||||
}
|
||||
else if (attnum == 0)
|
||||
{
|
||||
@@ -265,7 +265,7 @@ nocache_index_getattr(IndexTuple tup,
|
||||
}
|
||||
else if (!IndexTupleAllFixed(tup))
|
||||
{
|
||||
int j = 0;
|
||||
int j = 0;
|
||||
|
||||
for (j = 0; j < attnum && !slow; j++)
|
||||
if (att[j]->attlen < 1 && !VARLENA_FIXED_SIZE(att[j]))
|
||||
@@ -281,8 +281,8 @@ nocache_index_getattr(IndexTuple tup,
|
||||
|
||||
if (!slow)
|
||||
{
|
||||
int j = 1;
|
||||
long off;
|
||||
int j = 1;
|
||||
long off;
|
||||
|
||||
/*
|
||||
* need to set cache for some atts
|
||||
@@ -293,13 +293,14 @@ nocache_index_getattr(IndexTuple tup,
|
||||
while (att[j]->attcacheoff != -1)
|
||||
j++;
|
||||
|
||||
if (!VARLENA_FIXED_SIZE(att[j-1]))
|
||||
if (!VARLENA_FIXED_SIZE(att[j - 1]))
|
||||
off = att[j - 1]->attcacheoff + att[j - 1]->attlen;
|
||||
else
|
||||
off = att[j - 1]->attcacheoff + att[j - 1]->atttypmod;
|
||||
|
||||
for (; j < attnum + 1; j++)
|
||||
{
|
||||
|
||||
/*
|
||||
* Fix me when going to a machine with more than a four-byte
|
||||
* word!
|
||||
@@ -346,9 +347,9 @@ nocache_index_getattr(IndexTuple tup,
|
||||
}
|
||||
else
|
||||
{
|
||||
bool usecache = true;
|
||||
int off = 0;
|
||||
int i;
|
||||
bool usecache = true;
|
||||
int off = 0;
|
||||
int i;
|
||||
|
||||
/*
|
||||
* Now we know that we have to walk the tuple CAREFULLY.
|
||||
@@ -387,7 +388,7 @@ nocache_index_getattr(IndexTuple tup,
|
||||
default:
|
||||
if (att[i]->attlen < sizeof(int32))
|
||||
elog(ERROR,
|
||||
"nocachegetiattr2: attribute %d has len %d",
|
||||
"nocachegetiattr2: attribute %d has len %d",
|
||||
i, att[i]->attlen);
|
||||
if (att[i]->attalign == 'd')
|
||||
off = DOUBLEALIGN(off);
|
||||
@@ -412,7 +413,7 @@ nocache_index_getattr(IndexTuple tup,
|
||||
break;
|
||||
case -1:
|
||||
Assert(!VARLENA_FIXED_SIZE(att[i]) ||
|
||||
att[i]->atttypmod == VARSIZE(tp + off));
|
||||
att[i]->atttypmod == VARSIZE(tp + off));
|
||||
off += VARSIZE(tp + off);
|
||||
if (!VARLENA_FIXED_SIZE(att[i]))
|
||||
usecache = false;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.26 1998/02/11 19:09:25 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.27 1998/02/26 04:29:20 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -124,7 +124,7 @@ printtup(HeapTuple tuple, TupleDesc typeinfo)
|
||||
{
|
||||
outputstr = fmgr(typoutput, attr,
|
||||
gettypelem(typeinfo->attrs[i]->atttypid),
|
||||
typeinfo->attrs[i]->atttypmod);
|
||||
typeinfo->attrs[i]->atttypmod);
|
||||
pq_putint(strlen(outputstr) + VARHDRSZ, VARHDRSZ);
|
||||
pq_putnchar(outputstr, strlen(outputstr));
|
||||
pfree(outputstr);
|
||||
@@ -176,8 +176,8 @@ showatts(char *name, TupleDesc tupleDesc)
|
||||
void
|
||||
debugtup(HeapTuple tuple, TupleDesc typeinfo)
|
||||
{
|
||||
int i;
|
||||
Datum attr;
|
||||
int i;
|
||||
Datum attr;
|
||||
char *value;
|
||||
bool isnull;
|
||||
Oid typoutput;
|
||||
@@ -191,7 +191,7 @@ debugtup(HeapTuple tuple, TupleDesc typeinfo)
|
||||
{
|
||||
value = fmgr(typoutput, attr,
|
||||
gettypelem(typeinfo->attrs[i]->atttypid),
|
||||
typeinfo->attrs[i]->atttypmod);
|
||||
typeinfo->attrs[i]->atttypmod);
|
||||
printatt((unsigned) i + 1, typeinfo->attrs[i], value);
|
||||
pfree(value);
|
||||
}
|
||||
@@ -313,7 +313,7 @@ printtup_internal(HeapTuple tuple, TupleDesc typeinfo)
|
||||
pq_putnchar(DatumGetPointer(attr), len);
|
||||
#ifdef IPORTAL_DEBUG
|
||||
fprintf(stderr, "byref length %d data %x\n", len,
|
||||
DatumGetPointer(attr));
|
||||
DatumGetPointer(attr));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.35 1998/02/10 16:02:46 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.36 1998/02/26 04:29:22 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
* some of the executor utility code such as "ExecTypeFromTL" should be
|
||||
@@ -306,7 +306,7 @@ TupleDescInitEntry(TupleDesc desc,
|
||||
att->attnum = attributeNumber;
|
||||
att->attnelems = attdim;
|
||||
att->attisset = attisset;
|
||||
|
||||
|
||||
att->attnotnull = false;
|
||||
att->atthasdef = false;
|
||||
|
||||
@@ -487,7 +487,7 @@ BuildDescForRelation(List *schema, char *relname)
|
||||
if (arry != NIL)
|
||||
{
|
||||
/* array of XXX is _XXX */
|
||||
sprintf(typename, "_%.*s", NAMEDATALEN-2,entry->typename->name);
|
||||
sprintf(typename, "_%.*s", NAMEDATALEN - 2, entry->typename->name);
|
||||
attdim = length(arry);
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user