mirror of
https://github.com/postgres/postgres.git
synced 2025-11-10 17:42:29 +03:00
pgindent run over code.
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.50 1999/03/14 20:17:20 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.51 1999/05/25 16:06:35 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
* The old interface functions have been converted to macros
|
||||
@@ -124,7 +124,7 @@ DataFill(char *data,
|
||||
*bitP |= bitmask;
|
||||
}
|
||||
|
||||
data = (char *)att_align((long)data, att[i]->attlen, att[i]->attalign);
|
||||
data = (char *) att_align((long) data, att[i]->attlen, att[i]->attalign);
|
||||
switch (att[i]->attlen)
|
||||
{
|
||||
case -1:
|
||||
@@ -151,7 +151,7 @@ DataFill(char *data,
|
||||
att[i]->attlen);
|
||||
break;
|
||||
}
|
||||
data = (char *)att_addlength((long)data, att[i]->attlen, value[i]);
|
||||
data = (char *) att_addlength((long) data, att[i]->attlen, value[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -210,7 +210,7 @@ heap_attisnull(HeapTuple tup, int attnum)
|
||||
int
|
||||
heap_sysattrlen(AttrNumber attno)
|
||||
{
|
||||
HeapTupleHeader f = NULL;
|
||||
HeapTupleHeader f = NULL;
|
||||
|
||||
switch (attno)
|
||||
{
|
||||
@@ -301,6 +301,7 @@ heap_getsysattr(HeapTuple tup, Buffer b, int attnum)
|
||||
}
|
||||
return (Datum) NULL;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* ----------------
|
||||
@@ -328,11 +329,11 @@ nocachegetattr(HeapTuple tuple,
|
||||
TupleDesc tupleDesc,
|
||||
bool *isnull)
|
||||
{
|
||||
char *tp; /* ptr to att in tuple */
|
||||
HeapTupleHeader tup = tuple->t_data;
|
||||
bits8 *bp = tup->t_bits; /* ptr to att in tuple */
|
||||
Form_pg_attribute *att = tupleDesc->attrs;
|
||||
int slow = 0; /* do we have to walk nulls? */
|
||||
char *tp; /* ptr to att in tuple */
|
||||
HeapTupleHeader tup = tuple->t_data;
|
||||
bits8 *bp = tup->t_bits; /* ptr to att in tuple */
|
||||
Form_pg_attribute *att = tupleDesc->attrs;
|
||||
int slow = 0; /* do we have to walk nulls? */
|
||||
|
||||
|
||||
#if IN_MACRO
|
||||
@@ -376,6 +377,7 @@ nocachegetattr(HeapTuple tuple,
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
/*
|
||||
* there's a null somewhere in the tuple
|
||||
*/
|
||||
@@ -404,12 +406,13 @@ nocachegetattr(HeapTuple tuple,
|
||||
int finalbit = attnum & 0x07;
|
||||
|
||||
/* check for nulls "before" final bit of last byte */
|
||||
if ((~ bp[byte]) & ((1 << finalbit) - 1))
|
||||
if ((~bp[byte]) & ((1 << finalbit) - 1))
|
||||
slow = 1;
|
||||
else
|
||||
{
|
||||
/* check for nulls in any "earlier" bytes */
|
||||
int i;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < byte; i++)
|
||||
{
|
||||
if (bp[i] != 0xFF)
|
||||
@@ -439,6 +442,7 @@ nocachegetattr(HeapTuple tuple,
|
||||
else if (!HeapTupleAllFixed(tuple))
|
||||
{
|
||||
int j;
|
||||
|
||||
/*
|
||||
* In for(), we make this <= and not < because we want to test
|
||||
* if we can go past it in initializing offsets.
|
||||
@@ -456,9 +460,9 @@ nocachegetattr(HeapTuple tuple,
|
||||
|
||||
/*
|
||||
* If slow is zero, and we got here, we know that we have a tuple with
|
||||
* no nulls or varlenas before the target attribute.
|
||||
* If possible, we also want to initialize the remainder of the
|
||||
* attribute cached offset values.
|
||||
* no nulls or varlenas before the target attribute. If possible, we
|
||||
* also want to initialize the remainder of the attribute cached
|
||||
* offset values.
|
||||
*/
|
||||
if (!slow)
|
||||
{
|
||||
@@ -570,7 +574,7 @@ heap_copytuple(HeapTuple tuple)
|
||||
newTuple->t_len = tuple->t_len;
|
||||
newTuple->t_self = tuple->t_self;
|
||||
newTuple->t_data = (HeapTupleHeader) ((char *) newTuple + HEAPTUPLESIZE);
|
||||
memmove((char *) newTuple->t_data,
|
||||
memmove((char *) newTuple->t_data,
|
||||
(char *) tuple->t_data, (int) tuple->t_len);
|
||||
return newTuple;
|
||||
}
|
||||
@@ -589,11 +593,11 @@ heap_copytuple_with_tuple(HeapTuple src, HeapTuple dest)
|
||||
dest->t_data = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
dest->t_len = src->t_len;
|
||||
dest->t_self = src->t_self;
|
||||
dest->t_data = (HeapTupleHeader) palloc(src->t_len);
|
||||
memmove((char *) dest->t_data,
|
||||
memmove((char *) dest->t_data,
|
||||
(char *) src->t_data, (int) src->t_len);
|
||||
return;
|
||||
}
|
||||
@@ -657,14 +661,14 @@ heap_formtuple(TupleDesc tupleDescriptor,
|
||||
Datum *value,
|
||||
char *nulls)
|
||||
{
|
||||
HeapTuple tuple; /* return tuple */
|
||||
HeapTupleHeader td; /* tuple data */
|
||||
int bitmaplen;
|
||||
long len;
|
||||
int hoff;
|
||||
bool hasnull = false;
|
||||
int i;
|
||||
int numberOfAttributes = tupleDescriptor->natts;
|
||||
HeapTuple tuple; /* return tuple */
|
||||
HeapTupleHeader td; /* tuple data */
|
||||
int bitmaplen;
|
||||
long len;
|
||||
int hoff;
|
||||
bool hasnull = false;
|
||||
int i;
|
||||
int numberOfAttributes = tupleDescriptor->natts;
|
||||
|
||||
len = offsetof(HeapTupleHeaderData, t_bits);
|
||||
|
||||
@@ -760,9 +764,9 @@ heap_modifytuple(HeapTuple tuple,
|
||||
if (repl[attoff] == ' ')
|
||||
{
|
||||
value[attoff] = heap_getattr(tuple,
|
||||
AttrOffsetGetAttrNumber(attoff),
|
||||
RelationGetDescr(relation),
|
||||
&isNull);
|
||||
AttrOffsetGetAttrNumber(attoff),
|
||||
RelationGetDescr(relation),
|
||||
&isNull);
|
||||
nulls[attoff] = (isNull) ? 'n' : ' ';
|
||||
|
||||
}
|
||||
@@ -790,12 +794,12 @@ heap_modifytuple(HeapTuple tuple,
|
||||
infomask = newTuple->t_data->t_infomask;
|
||||
memmove((char *) &newTuple->t_data->t_oid, /* XXX */
|
||||
(char *) &tuple->t_data->t_oid,
|
||||
((char *) &tuple->t_data->t_hoff -
|
||||
(char *) &tuple->t_data->t_oid)); /* XXX */
|
||||
((char *) &tuple->t_data->t_hoff -
|
||||
(char *) &tuple->t_data->t_oid)); /* XXX */
|
||||
newTuple->t_data->t_infomask = infomask;
|
||||
newTuple->t_data->t_natts = numberOfAttributes;
|
||||
newTuple->t_self = tuple->t_self;
|
||||
|
||||
|
||||
return newTuple;
|
||||
}
|
||||
|
||||
@@ -809,10 +813,10 @@ heap_addheader(uint32 natts, /* max domain index */
|
||||
int structlen, /* its length */
|
||||
char *structure) /* pointer to the struct */
|
||||
{
|
||||
HeapTuple tuple;
|
||||
HeapTupleHeader td; /* tuple data */
|
||||
long len;
|
||||
int hoff;
|
||||
HeapTuple tuple;
|
||||
HeapTupleHeader td; /* tuple data */
|
||||
long len;
|
||||
int hoff;
|
||||
|
||||
AssertArg(natts > 0);
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.45 1999/05/10 00:44:50 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.46 1999/05/25 16:06:39 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -25,9 +25,9 @@
|
||||
#include "libpq/pqformat.h"
|
||||
#include "utils/syscache.h"
|
||||
|
||||
static void printtup_setup(DestReceiver* self, TupleDesc typeinfo);
|
||||
static void printtup(HeapTuple tuple, TupleDesc typeinfo, DestReceiver* self);
|
||||
static void printtup_cleanup(DestReceiver* self);
|
||||
static void printtup_setup(DestReceiver * self, TupleDesc typeinfo);
|
||||
static void printtup(HeapTuple tuple, TupleDesc typeinfo, DestReceiver * self);
|
||||
static void printtup_cleanup(DestReceiver * self);
|
||||
|
||||
/* ----------------------------------------------------------------
|
||||
* printtup / debugtup support
|
||||
@@ -43,7 +43,7 @@ static void printtup_cleanup(DestReceiver* self);
|
||||
* ----------------
|
||||
*/
|
||||
int
|
||||
getTypeOutAndElem(Oid type, Oid* typOutput, Oid* typElem)
|
||||
getTypeOutAndElem(Oid type, Oid *typOutput, Oid *typElem)
|
||||
{
|
||||
HeapTuple typeTuple;
|
||||
|
||||
@@ -54,6 +54,7 @@ getTypeOutAndElem(Oid type, Oid* typOutput, Oid* typElem)
|
||||
if (HeapTupleIsValid(typeTuple))
|
||||
{
|
||||
Form_pg_type pt = (Form_pg_type) GETSTRUCT(typeTuple);
|
||||
|
||||
*typOutput = (Oid) pt->typoutput;
|
||||
*typElem = (Oid) pt->typelem;
|
||||
return OidIsValid(*typOutput);
|
||||
@@ -70,27 +71,29 @@ getTypeOutAndElem(Oid type, Oid* typOutput, Oid* typElem)
|
||||
* Private state for a printtup destination object
|
||||
* ----------------
|
||||
*/
|
||||
typedef struct { /* Per-attribute information */
|
||||
typedef struct
|
||||
{ /* Per-attribute information */
|
||||
Oid typoutput; /* Oid for the attribute's type output fn */
|
||||
Oid typelem; /* typelem value to pass to the output fn */
|
||||
FmgrInfo finfo; /* Precomputed call info for typoutput */
|
||||
} PrinttupAttrInfo;
|
||||
} PrinttupAttrInfo;
|
||||
|
||||
typedef struct {
|
||||
DestReceiver pub; /* publicly-known function pointers */
|
||||
TupleDesc attrinfo; /* The attr info we are set up for */
|
||||
int nattrs;
|
||||
PrinttupAttrInfo *myinfo; /* Cached info about each attr */
|
||||
} DR_printtup;
|
||||
typedef struct
|
||||
{
|
||||
DestReceiver pub; /* publicly-known function pointers */
|
||||
TupleDesc attrinfo; /* The attr info we are set up for */
|
||||
int nattrs;
|
||||
PrinttupAttrInfo *myinfo; /* Cached info about each attr */
|
||||
} DR_printtup;
|
||||
|
||||
/* ----------------
|
||||
* Initialize: create a DestReceiver for printtup
|
||||
* ----------------
|
||||
*/
|
||||
DestReceiver*
|
||||
DestReceiver *
|
||||
printtup_create_DR()
|
||||
{
|
||||
DR_printtup* self = (DR_printtup*) palloc(sizeof(DR_printtup));
|
||||
DR_printtup *self = (DR_printtup *) palloc(sizeof(DR_printtup));
|
||||
|
||||
self->pub.receiveTuple = printtup;
|
||||
self->pub.setup = printtup_setup;
|
||||
@@ -100,42 +103,43 @@ printtup_create_DR()
|
||||
self->nattrs = 0;
|
||||
self->myinfo = NULL;
|
||||
|
||||
return (DestReceiver*) self;
|
||||
return (DestReceiver *) self;
|
||||
}
|
||||
|
||||
static void
|
||||
printtup_setup(DestReceiver* self, TupleDesc typeinfo)
|
||||
printtup_setup(DestReceiver * self, TupleDesc typeinfo)
|
||||
{
|
||||
/* ----------------
|
||||
* We could set up the derived attr info at this time, but we postpone it
|
||||
* until the first call of printtup, for 3 reasons:
|
||||
* 1. We don't waste time (compared to the old way) if there are no
|
||||
* tuples at all to output.
|
||||
* tuples at all to output.
|
||||
* 2. Checking in printtup allows us to handle the case that the tuples
|
||||
* change type midway through (although this probably can't happen in
|
||||
* the current executor).
|
||||
* change type midway through (although this probably can't happen in
|
||||
* the current executor).
|
||||
* 3. Right now, ExecutorRun passes a NULL for typeinfo anyway :-(
|
||||
* ----------------
|
||||
*/
|
||||
}
|
||||
|
||||
static void
|
||||
printtup_prepare_info(DR_printtup* myState, TupleDesc typeinfo, int numAttrs)
|
||||
printtup_prepare_info(DR_printtup * myState, TupleDesc typeinfo, int numAttrs)
|
||||
{
|
||||
int i;
|
||||
int i;
|
||||
|
||||
if (myState->myinfo)
|
||||
pfree(myState->myinfo); /* get rid of any old data */
|
||||
pfree(myState->myinfo); /* get rid of any old data */
|
||||
myState->myinfo = NULL;
|
||||
myState->attrinfo = typeinfo;
|
||||
myState->nattrs = numAttrs;
|
||||
if (numAttrs <= 0)
|
||||
return;
|
||||
myState->myinfo = (PrinttupAttrInfo*)
|
||||
myState->myinfo = (PrinttupAttrInfo *)
|
||||
palloc(numAttrs * sizeof(PrinttupAttrInfo));
|
||||
for (i = 0; i < numAttrs; i++)
|
||||
{
|
||||
PrinttupAttrInfo* thisState = myState->myinfo + i;
|
||||
PrinttupAttrInfo *thisState = myState->myinfo + i;
|
||||
|
||||
if (getTypeOutAndElem((Oid) typeinfo->attrs[i]->atttypid,
|
||||
&thisState->typoutput, &thisState->typelem))
|
||||
fmgr_info(thisState->typoutput, &thisState->finfo);
|
||||
@@ -147,9 +151,9 @@ printtup_prepare_info(DR_printtup* myState, TupleDesc typeinfo, int numAttrs)
|
||||
* ----------------
|
||||
*/
|
||||
static void
|
||||
printtup(HeapTuple tuple, TupleDesc typeinfo, DestReceiver* self)
|
||||
printtup(HeapTuple tuple, TupleDesc typeinfo, DestReceiver * self)
|
||||
{
|
||||
DR_printtup *myState = (DR_printtup*) self;
|
||||
DR_printtup *myState = (DR_printtup *) self;
|
||||
StringInfoData buf;
|
||||
int i,
|
||||
j,
|
||||
@@ -178,7 +182,7 @@ printtup(HeapTuple tuple, TupleDesc typeinfo, DestReceiver* self)
|
||||
k = 1 << 7;
|
||||
for (i = 0; i < tuple->t_data->t_natts; ++i)
|
||||
{
|
||||
if (! heap_attisnull(tuple, i + 1))
|
||||
if (!heap_attisnull(tuple, i + 1))
|
||||
j |= k; /* set bit if not null */
|
||||
k >>= 1;
|
||||
if (k == 0) /* end of byte? */
|
||||
@@ -197,7 +201,8 @@ printtup(HeapTuple tuple, TupleDesc typeinfo, DestReceiver* self)
|
||||
*/
|
||||
for (i = 0; i < tuple->t_data->t_natts; ++i)
|
||||
{
|
||||
PrinttupAttrInfo* thisState = myState->myinfo + i;
|
||||
PrinttupAttrInfo *thisState = myState->myinfo + i;
|
||||
|
||||
attr = heap_getattr(tuple, i + 1, typeinfo, &isnull);
|
||||
if (isnull)
|
||||
continue;
|
||||
@@ -223,9 +228,10 @@ printtup(HeapTuple tuple, TupleDesc typeinfo, DestReceiver* self)
|
||||
* ----------------
|
||||
*/
|
||||
static void
|
||||
printtup_cleanup(DestReceiver* self)
|
||||
printtup_cleanup(DestReceiver * self)
|
||||
{
|
||||
DR_printtup* myState = (DR_printtup*) self;
|
||||
DR_printtup *myState = (DR_printtup *) self;
|
||||
|
||||
if (myState->myinfo)
|
||||
pfree(myState->myinfo);
|
||||
pfree(myState);
|
||||
@@ -274,7 +280,7 @@ showatts(char *name, TupleDesc tupleDesc)
|
||||
* ----------------
|
||||
*/
|
||||
void
|
||||
debugtup(HeapTuple tuple, TupleDesc typeinfo, DestReceiver* self)
|
||||
debugtup(HeapTuple tuple, TupleDesc typeinfo, DestReceiver * self)
|
||||
{
|
||||
int i;
|
||||
Datum attr;
|
||||
@@ -310,7 +316,7 @@ debugtup(HeapTuple tuple, TupleDesc typeinfo, DestReceiver* self)
|
||||
* ----------------
|
||||
*/
|
||||
void
|
||||
printtup_internal(HeapTuple tuple, TupleDesc typeinfo, DestReceiver* self)
|
||||
printtup_internal(HeapTuple tuple, TupleDesc typeinfo, DestReceiver * self)
|
||||
{
|
||||
StringInfoData buf;
|
||||
int i,
|
||||
@@ -334,7 +340,7 @@ printtup_internal(HeapTuple tuple, TupleDesc typeinfo, DestReceiver* self)
|
||||
k = 1 << 7;
|
||||
for (i = 0; i < tuple->t_data->t_natts; ++i)
|
||||
{
|
||||
if (! heap_attisnull(tuple, i + 1))
|
||||
if (!heap_attisnull(tuple, i + 1))
|
||||
j |= k; /* set bit if not null */
|
||||
k >>= 1;
|
||||
if (k == 0) /* end of byte? */
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/common/scankey.c,v 1.13 1999/02/13 23:14:13 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/common/scankey.c,v 1.14 1999/05/25 16:06:41 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -18,7 +18,7 @@
|
||||
#include <access/skey.h>
|
||||
|
||||
/*
|
||||
* ScanKeyEntryIsLegal
|
||||
* ScanKeyEntryIsLegal
|
||||
* True iff the scan key entry is legal.
|
||||
*/
|
||||
#define ScanKeyEntryIsLegal(entry) \
|
||||
@@ -28,7 +28,7 @@
|
||||
)
|
||||
|
||||
/*
|
||||
* ScanKeyEntrySetIllegal
|
||||
* ScanKeyEntrySetIllegal
|
||||
* Marks a scan key entry as illegal.
|
||||
*/
|
||||
void
|
||||
@@ -43,7 +43,7 @@ ScanKeyEntrySetIllegal(ScanKey entry)
|
||||
}
|
||||
|
||||
/*
|
||||
* ScanKeyEntryInitialize
|
||||
* ScanKeyEntryInitialize
|
||||
* Initializes an scan key entry.
|
||||
*
|
||||
* Note:
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.48 1999/02/13 23:14:14 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.49 1999/05/25 16:06:42 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
* some of the executor utility code such as "ExecTypeFromTL" should be
|
||||
@@ -487,7 +487,7 @@ BuildDescForRelation(List *schema, char *relname)
|
||||
{
|
||||
/* array of XXX is _XXX */
|
||||
snprintf(typename, NAMEDATALEN,
|
||||
"_%.*s", NAMEDATALEN - 2, entry->typename->name);
|
||||
"_%.*s", NAMEDATALEN - 2, entry->typename->name);
|
||||
attdim = length(arry);
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user