Commit 7d4c99b4 authored by Bruce Momjian's avatar Bruce Momjian

Fix pgindent to properly handle 'else' and single-line comments on the

same line;  previous fix was only partial.  Re-run pgindent on files
that need it.
parent f6e8730d
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $PostgreSQL: pgsql/src/backend/access/transam/slru.c,v 1.41 2007/08/01 22:45:07 tgl Exp $ * $PostgreSQL: pgsql/src/backend/access/transam/slru.c,v 1.42 2007/11/15 23:23:44 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -168,7 +168,7 @@ SimpleLruShmemSize(int nslots, int nlsns) ...@@ -168,7 +168,7 @@ SimpleLruShmemSize(int nslots, int nlsns)
sz += MAXALIGN(nslots * sizeof(LWLockId)); /* buffer_locks[] */ sz += MAXALIGN(nslots * sizeof(LWLockId)); /* buffer_locks[] */
if (nlsns > 0) if (nlsns > 0)
sz += MAXALIGN(nslots * nlsns * sizeof(XLogRecPtr)); /* group_lsn[] */ sz += MAXALIGN(nslots * nlsns * sizeof(XLogRecPtr)); /* group_lsn[] */
return BUFFERALIGN(sz) + BLCKSZ * nslots; return BUFFERALIGN(sz) + BLCKSZ * nslots;
} }
...@@ -339,7 +339,7 @@ SimpleLruWaitIO(SlruCtl ctl, int slotno) ...@@ -339,7 +339,7 @@ SimpleLruWaitIO(SlruCtl ctl, int slotno)
/* indeed, the I/O must have failed */ /* indeed, the I/O must have failed */
if (shared->page_status[slotno] == SLRU_PAGE_READ_IN_PROGRESS) if (shared->page_status[slotno] == SLRU_PAGE_READ_IN_PROGRESS)
shared->page_status[slotno] = SLRU_PAGE_EMPTY; shared->page_status[slotno] = SLRU_PAGE_EMPTY;
else /* write_in_progress */ else /* write_in_progress */
{ {
shared->page_status[slotno] = SLRU_PAGE_VALID; shared->page_status[slotno] = SLRU_PAGE_VALID;
shared->page_dirty[slotno] = true; shared->page_dirty[slotno] = true;
...@@ -669,21 +669,22 @@ SlruPhysicalWritePage(SlruCtl ctl, int pageno, int slotno, SlruFlush fdata) ...@@ -669,21 +669,22 @@ SlruPhysicalWritePage(SlruCtl ctl, int pageno, int slotno, SlruFlush fdata)
int fd = -1; int fd = -1;
/* /*
* Honor the write-WAL-before-data rule, if appropriate, so that we do * Honor the write-WAL-before-data rule, if appropriate, so that we do not
* not write out data before associated WAL records. This is the same * write out data before associated WAL records. This is the same action
* action performed during FlushBuffer() in the main buffer manager. * performed during FlushBuffer() in the main buffer manager.
*/ */
if (shared->group_lsn != NULL) if (shared->group_lsn != NULL)
{ {
/* /*
* We must determine the largest async-commit LSN for the page. * We must determine the largest async-commit LSN for the page. This
* This is a bit tedious, but since this entire function is a slow * is a bit tedious, but since this entire function is a slow path
* path anyway, it seems better to do this here than to maintain * anyway, it seems better to do this here than to maintain a per-page
* a per-page LSN variable (which'd need an extra comparison in the * LSN variable (which'd need an extra comparison in the
* transaction-commit path). * transaction-commit path).
*/ */
XLogRecPtr max_lsn; XLogRecPtr max_lsn;
int lsnindex, lsnoff; int lsnindex,
lsnoff;
lsnindex = slotno * shared->lsn_groups_per_page; lsnindex = slotno * shared->lsn_groups_per_page;
max_lsn = shared->group_lsn[lsnindex++]; max_lsn = shared->group_lsn[lsnindex++];
...@@ -699,8 +700,8 @@ SlruPhysicalWritePage(SlruCtl ctl, int pageno, int slotno, SlruFlush fdata) ...@@ -699,8 +700,8 @@ SlruPhysicalWritePage(SlruCtl ctl, int pageno, int slotno, SlruFlush fdata)
{ {
/* /*
* As noted above, elog(ERROR) is not acceptable here, so if * As noted above, elog(ERROR) is not acceptable here, so if
* XLogFlush were to fail, we must PANIC. This isn't much of * XLogFlush were to fail, we must PANIC. This isn't much of a
* a restriction because XLogFlush is just about all critical * restriction because XLogFlush is just about all critical
* section anyway, but let's make sure. * section anyway, but let's make sure.
*/ */
START_CRIT_SECTION(); START_CRIT_SECTION();
......
This diff is collapsed.
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/rewrite/rewriteHandler.c,v 1.174 2007/09/06 17:31:58 tgl Exp $ * $PostgreSQL: pgsql/src/backend/rewrite/rewriteHandler.c,v 1.175 2007/11/15 23:23:44 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -53,7 +53,7 @@ static Node *get_assignment_input(Node *node); ...@@ -53,7 +53,7 @@ static Node *get_assignment_input(Node *node);
static void rewriteValuesRTE(RangeTblEntry *rte, Relation target_relation, static void rewriteValuesRTE(RangeTblEntry *rte, Relation target_relation,
List *attrnos); List *attrnos);
static void markQueryForLocking(Query *qry, Node *jtnode, static void markQueryForLocking(Query *qry, Node *jtnode,
bool forUpdate, bool noWait); bool forUpdate, bool noWait);
static List *matchLocks(CmdType event, RuleLock *rulelocks, static List *matchLocks(CmdType event, RuleLock *rulelocks,
int varno, Query *parsetree); int varno, Query *parsetree);
static Query *fireRIRrules(Query *parsetree, List *activeRIRs); static Query *fireRIRrules(Query *parsetree, List *activeRIRs);
...@@ -1038,11 +1038,10 @@ matchLocks(CmdType event, ...@@ -1038,11 +1038,10 @@ matchLocks(CmdType event,
RewriteRule *oneLock = rulelocks->rules[i]; RewriteRule *oneLock = rulelocks->rules[i];
/* /*
* Suppress ON INSERT/UPDATE/DELETE rules that are disabled * Suppress ON INSERT/UPDATE/DELETE rules that are disabled or
* or configured to not fire during the current sessions * configured to not fire during the current sessions replication
* replication role. ON SELECT rules will always be applied * role. ON SELECT rules will always be applied in order to keep views
* in order to keep views working even in LOCAL or REPLICA * working even in LOCAL or REPLICA role.
* role.
*/ */
if (oneLock->event != CMD_SELECT) if (oneLock->event != CMD_SELECT)
{ {
...@@ -1052,7 +1051,7 @@ matchLocks(CmdType event, ...@@ -1052,7 +1051,7 @@ matchLocks(CmdType event,
oneLock->enabled == RULE_DISABLED) oneLock->enabled == RULE_DISABLED)
continue; continue;
} }
else /* ORIGIN or LOCAL ROLE */ else /* ORIGIN or LOCAL ROLE */
{ {
if (oneLock->enabled == RULE_FIRES_ON_REPLICA || if (oneLock->enabled == RULE_FIRES_ON_REPLICA ||
oneLock->enabled == RULE_DISABLED) oneLock->enabled == RULE_DISABLED)
...@@ -1695,22 +1694,22 @@ RewriteQuery(Query *parsetree, List *rewrite_events) ...@@ -1695,22 +1694,22 @@ RewriteQuery(Query *parsetree, List *rewrite_events)
case CMD_INSERT: case CMD_INSERT:
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED), (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("cannot perform INSERT RETURNING on relation \"%s\"", errmsg("cannot perform INSERT RETURNING on relation \"%s\"",
RelationGetRelationName(rt_entry_relation)), RelationGetRelationName(rt_entry_relation)),
errhint("You need an unconditional ON INSERT DO INSTEAD rule with a RETURNING clause."))); errhint("You need an unconditional ON INSERT DO INSTEAD rule with a RETURNING clause.")));
break; break;
case CMD_UPDATE: case CMD_UPDATE:
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED), (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("cannot perform UPDATE RETURNING on relation \"%s\"", errmsg("cannot perform UPDATE RETURNING on relation \"%s\"",
RelationGetRelationName(rt_entry_relation)), RelationGetRelationName(rt_entry_relation)),
errhint("You need an unconditional ON UPDATE DO INSTEAD rule with a RETURNING clause."))); errhint("You need an unconditional ON UPDATE DO INSTEAD rule with a RETURNING clause.")));
break; break;
case CMD_DELETE: case CMD_DELETE:
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED), (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("cannot perform DELETE RETURNING on relation \"%s\"", errmsg("cannot perform DELETE RETURNING on relation \"%s\"",
RelationGetRelationName(rt_entry_relation)), RelationGetRelationName(rt_entry_relation)),
errhint("You need an unconditional ON DELETE DO INSTEAD rule with a RETURNING clause."))); errhint("You need an unconditional ON DELETE DO INSTEAD rule with a RETURNING clause.")));
break; break;
default: default:
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/tsvector_op.c,v 1.7 2007/10/24 03:30:03 tgl Exp $ * $PostgreSQL: pgsql/src/backend/utils/adt/tsvector_op.c,v 1.8 2007/11/15 23:23:44 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -254,7 +254,7 @@ tsvector_setweight(PG_FUNCTION_ARGS) ...@@ -254,7 +254,7 @@ tsvector_setweight(PG_FUNCTION_ARGS)
} }
static int static int
compareEntry(char *ptra, WordEntry * a, char *ptrb, WordEntry * b) compareEntry(char *ptra, WordEntry *a, char *ptrb, WordEntry *b)
{ {
if (a->len == b->len) if (a->len == b->len)
{ {
...@@ -271,8 +271,8 @@ compareEntry(char *ptra, WordEntry * a, char *ptrb, WordEntry * b) ...@@ -271,8 +271,8 @@ compareEntry(char *ptra, WordEntry * a, char *ptrb, WordEntry * b)
* Return the number added (might be less than expected due to overflow) * Return the number added (might be less than expected due to overflow)
*/ */
static int4 static int4
add_pos(TSVector src, WordEntry * srcptr, add_pos(TSVector src, WordEntry *srcptr,
TSVector dest, WordEntry * destptr, TSVector dest, WordEntry *destptr,
int4 maxpos) int4 maxpos)
{ {
uint16 *clen = &_POSVECPTR(dest, destptr)->npos; uint16 *clen = &_POSVECPTR(dest, destptr)->npos;
...@@ -288,7 +288,7 @@ add_pos(TSVector src, WordEntry * srcptr, ...@@ -288,7 +288,7 @@ add_pos(TSVector src, WordEntry * srcptr,
startlen = *clen; startlen = *clen;
for (i = 0; for (i = 0;
i < slen && *clen < MAXNUMPOS && i < slen && *clen < MAXNUMPOS &&
(*clen == 0 || WEP_GETPOS(dpos[*clen - 1]) != MAXENTRYPOS - 1); (*clen == 0 || WEP_GETPOS(dpos[*clen - 1]) != MAXENTRYPOS - 1);
i++) i++)
{ {
WEP_SETWEIGHT(dpos[*clen], WEP_GETWEIGHT(spos[i])); WEP_SETWEIGHT(dpos[*clen], WEP_GETWEIGHT(spos[i]));
...@@ -369,7 +369,7 @@ tsvector_concat(PG_FUNCTION_ARGS) ...@@ -369,7 +369,7 @@ tsvector_concat(PG_FUNCTION_ARGS)
memcpy(data + dataoff, _POSVECPTR(in1, ptr1), POSDATALEN(in1, ptr1) * sizeof(WordEntryPos) + sizeof(uint16)); memcpy(data + dataoff, _POSVECPTR(in1, ptr1), POSDATALEN(in1, ptr1) * sizeof(WordEntryPos) + sizeof(uint16));
dataoff += POSDATALEN(in1, ptr1) * sizeof(WordEntryPos) + sizeof(uint16); dataoff += POSDATALEN(in1, ptr1) * sizeof(WordEntryPos) + sizeof(uint16);
} }
ptr++; ptr++;
ptr1++; ptr1++;
i1--; i1--;
...@@ -415,7 +415,7 @@ tsvector_concat(PG_FUNCTION_ARGS) ...@@ -415,7 +415,7 @@ tsvector_concat(PG_FUNCTION_ARGS)
if (ptr2->haspos) if (ptr2->haspos)
dataoff += add_pos(in2, ptr2, out, ptr, maxpos) * sizeof(WordEntryPos); dataoff += add_pos(in2, ptr2, out, ptr, maxpos) * sizeof(WordEntryPos);
} }
else /* must have ptr2->haspos */ else /* must have ptr2->haspos */
{ {
int addlen = add_pos(in2, ptr2, out, ptr, maxpos); int addlen = add_pos(in2, ptr2, out, ptr, maxpos);
...@@ -482,8 +482,8 @@ tsvector_concat(PG_FUNCTION_ARGS) ...@@ -482,8 +482,8 @@ tsvector_concat(PG_FUNCTION_ARGS)
} }
/* /*
* Instead of checking each offset individually, we check for overflow * Instead of checking each offset individually, we check for overflow of
* of pos fields once at the end. * pos fields once at the end.
*/ */
if (dataoff > MAXSTRPOS) if (dataoff > MAXSTRPOS)
ereport(ERROR, ereport(ERROR,
...@@ -504,7 +504,7 @@ tsvector_concat(PG_FUNCTION_ARGS) ...@@ -504,7 +504,7 @@ tsvector_concat(PG_FUNCTION_ARGS)
* compare 2 string values * compare 2 string values
*/ */
static int4 static int4
ValCompare(CHKVAL * chkval, WordEntry * ptr, QueryOperand * item) ValCompare(CHKVAL *chkval, WordEntry *ptr, QueryOperand *item)
{ {
if (ptr->len == item->length) if (ptr->len == item->length)
return strncmp( return strncmp(
...@@ -525,7 +525,7 @@ checkclass_str(CHKVAL *chkval, WordEntry *val, QueryOperand *item) ...@@ -525,7 +525,7 @@ checkclass_str(CHKVAL *chkval, WordEntry *val, QueryOperand *item)
WordEntryPos *ptr; WordEntryPos *ptr;
uint16 len; uint16 len;
posvec = (WordEntryPosVector *) posvec = (WordEntryPosVector *)
(chkval->values + SHORTALIGN(val->pos + val->len)); (chkval->values + SHORTALIGN(val->pos + val->len));
len = posvec->npos; len = posvec->npos;
...@@ -544,9 +544,9 @@ checkclass_str(CHKVAL *chkval, WordEntry *val, QueryOperand *item) ...@@ -544,9 +544,9 @@ checkclass_str(CHKVAL *chkval, WordEntry *val, QueryOperand *item)
* is there value 'val' in array or not ? * is there value 'val' in array or not ?
*/ */
static bool static bool
checkcondition_str(void *checkval, QueryOperand * val) checkcondition_str(void *checkval, QueryOperand *val)
{ {
CHKVAL *chkval = (CHKVAL *) checkval; CHKVAL *chkval = (CHKVAL *) checkval;
WordEntry *StopLow = chkval->arrb; WordEntry *StopLow = chkval->arrb;
WordEntry *StopHigh = chkval->arre; WordEntry *StopHigh = chkval->arre;
WordEntry *StopMiddle; WordEntry *StopMiddle;
...@@ -580,8 +580,8 @@ checkcondition_str(void *checkval, QueryOperand * val) ...@@ -580,8 +580,8 @@ checkcondition_str(void *checkval, QueryOperand * val)
* *
*/ */
bool bool
TS_execute(QueryItem * curitem, void *checkval, bool calcnot, TS_execute(QueryItem *curitem, void *checkval, bool calcnot,
bool (*chkcond) (void *checkval, QueryOperand * val)) bool (*chkcond) (void *checkval, QueryOperand *val))
{ {
/* since this function recurses, it could be driven to stack overflow */ /* since this function recurses, it could be driven to stack overflow */
check_stack_depth(); check_stack_depth();
...@@ -589,7 +589,7 @@ TS_execute(QueryItem * curitem, void *checkval, bool calcnot, ...@@ -589,7 +589,7 @@ TS_execute(QueryItem * curitem, void *checkval, bool calcnot,
if (curitem->type == QI_VAL) if (curitem->type == QI_VAL)
return chkcond(checkval, (QueryOperand *) curitem); return chkcond(checkval, (QueryOperand *) curitem);
switch(curitem->operator.oper) switch (curitem->operator.oper)
{ {
case OP_NOT: case OP_NOT:
if (calcnot) if (calcnot)
...@@ -710,7 +710,7 @@ ts_match_tq(PG_FUNCTION_ARGS) ...@@ -710,7 +710,7 @@ ts_match_tq(PG_FUNCTION_ARGS)
* that have a weight equal to one of the weights in 'weight' bitmask. * that have a weight equal to one of the weights in 'weight' bitmask.
*/ */
static int static int
check_weight(TSVector txt, WordEntry * wptr, int8 weight) check_weight(TSVector txt, WordEntry *wptr, int8 weight)
{ {
int len = POSDATALEN(txt, wptr); int len = POSDATALEN(txt, wptr);
int num = 0; int num = 0;
...@@ -726,7 +726,7 @@ check_weight(TSVector txt, WordEntry * wptr, int8 weight) ...@@ -726,7 +726,7 @@ check_weight(TSVector txt, WordEntry * wptr, int8 weight)
} }
static WordEntry ** static WordEntry **
SEI_realloc(WordEntry ** in, uint32 *len) SEI_realloc(WordEntry **in, uint32 *len)
{ {
if (*len == 0 || in == NULL) if (*len == 0 || in == NULL)
{ {
...@@ -742,7 +742,7 @@ SEI_realloc(WordEntry ** in, uint32 *len) ...@@ -742,7 +742,7 @@ SEI_realloc(WordEntry ** in, uint32 *len)
} }
static int static int
compareStatWord(StatEntry * a, WordEntry * b, tsstat * stat, TSVector txt) compareStatWord(StatEntry *a, WordEntry *b, tsstat *stat, TSVector txt)
{ {
if (a->len == b->len) if (a->len == b->len)
return strncmp( return strncmp(
...@@ -754,7 +754,7 @@ compareStatWord(StatEntry * a, WordEntry * b, tsstat * stat, TSVector txt) ...@@ -754,7 +754,7 @@ compareStatWord(StatEntry * a, WordEntry * b, tsstat * stat, TSVector txt)
} }
static tsstat * static tsstat *
formstat(tsstat * stat, TSVector txt, WordEntry ** entry, uint32 len) formstat(tsstat *stat, TSVector txt, WordEntry **entry, uint32 len)
{ {
tsstat *newstat; tsstat *newstat;
uint32 totallen, uint32 totallen,
...@@ -861,16 +861,16 @@ formstat(tsstat * stat, TSVector txt, WordEntry ** entry, uint32 len) ...@@ -861,16 +861,16 @@ formstat(tsstat * stat, TSVector txt, WordEntry ** entry, uint32 len)
* This is written like a custom aggregate function, because the * This is written like a custom aggregate function, because the
* original plan was to do just that. Unfortunately, an aggregate function * original plan was to do just that. Unfortunately, an aggregate function
* can't return a set, so that plan was abandoned. If that limitation is * can't return a set, so that plan was abandoned. If that limitation is
* lifted in the future, ts_stat could be a real aggregate function so that * lifted in the future, ts_stat could be a real aggregate function so that
* you could use it like this: * you could use it like this:
* *
* SELECT ts_stat(vector_column) FROM vector_table; * SELECT ts_stat(vector_column) FROM vector_table;
* *
* where vector_column is a tsvector-type column in vector_table. * where vector_column is a tsvector-type column in vector_table.
*/ */
static tsstat * static tsstat *
ts_accum(tsstat * stat, Datum data) ts_accum(tsstat *stat, Datum data)
{ {
tsstat *newstat; tsstat *newstat;
TSVector txt = DatumGetTSVector(data); TSVector txt = DatumGetTSVector(data);
...@@ -1012,7 +1012,7 @@ ts_accum(tsstat * stat, Datum data) ...@@ -1012,7 +1012,7 @@ ts_accum(tsstat * stat, Datum data)
static void static void
ts_setup_firstcall(FunctionCallInfo fcinfo, FuncCallContext *funcctx, ts_setup_firstcall(FunctionCallInfo fcinfo, FuncCallContext *funcctx,
tsstat * stat) tsstat *stat)
{ {
TupleDesc tupdesc; TupleDesc tupdesc;
MemoryContext oldcontext; MemoryContext oldcontext;
...@@ -1232,11 +1232,11 @@ static bool ...@@ -1232,11 +1232,11 @@ static bool
istexttype(Oid typid) istexttype(Oid typid)
{ {
/* varchar(n) and char(n) are binary-compatible with text */ /* varchar(n) and char(n) are binary-compatible with text */
if (typid==TEXTOID || typid==VARCHAROID || typid==BPCHAROID) if (typid == TEXTOID || typid == VARCHAROID || typid == BPCHAROID)
return true; return true;
/* Allow domains over these types, too */ /* Allow domains over these types, too */
typid = getBaseType(typid); typid = getBaseType(typid);
if (typid==TEXTOID || typid==VARCHAROID || typid==BPCHAROID) if (typid == TEXTOID || typid == VARCHAROID || typid == BPCHAROID)
return true; return true;
return false; return false;
} }
...@@ -1280,7 +1280,7 @@ tsvector_update_trigger(PG_FUNCTION_ARGS, bool config_column) ...@@ -1280,7 +1280,7 @@ tsvector_update_trigger(PG_FUNCTION_ARGS, bool config_column)
Oid cfgId; Oid cfgId;
/* Check call context */ /* Check call context */
if (!CALLED_AS_TRIGGER(fcinfo)) /* internal error */ if (!CALLED_AS_TRIGGER(fcinfo)) /* internal error */
elog(ERROR, "tsvector_update_trigger: not fired by trigger manager"); elog(ERROR, "tsvector_update_trigger: not fired by trigger manager");
trigdata = (TriggerData *) fcinfo->context; trigdata = (TriggerData *) fcinfo->context;
...@@ -1318,7 +1318,7 @@ tsvector_update_trigger(PG_FUNCTION_ARGS, bool config_column) ...@@ -1318,7 +1318,7 @@ tsvector_update_trigger(PG_FUNCTION_ARGS, bool config_column)
/* Find the configuration to use */ /* Find the configuration to use */
if (config_column) if (config_column)
{ {
int config_attr_num; int config_attr_num;
config_attr_num = SPI_fnumber(rel->rd_att, trigger->tgargs[1]); config_attr_num = SPI_fnumber(rel->rd_att, trigger->tgargs[1]);
if (config_attr_num == SPI_ERROR_NOATTRIBUTE) if (config_attr_num == SPI_ERROR_NOATTRIBUTE)
...@@ -1342,7 +1342,7 @@ tsvector_update_trigger(PG_FUNCTION_ARGS, bool config_column) ...@@ -1342,7 +1342,7 @@ tsvector_update_trigger(PG_FUNCTION_ARGS, bool config_column)
} }
else else
{ {
List *names; List *names;
names = stringToQualifiedNameList(trigger->tgargs[1]); names = stringToQualifiedNameList(trigger->tgargs[1]);
/* require a schema so that results are not search path dependent */ /* require a schema so that results are not search path dependent */
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/mb/conv.c,v 1.63 2007/03/25 11:56:02 ishii Exp $ * $PostgreSQL: pgsql/src/backend/utils/mb/conv.c,v 1.64 2007/11/15 23:23:44 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -244,7 +244,7 @@ mic2latin_with_table(const unsigned char *mic, ...@@ -244,7 +244,7 @@ mic2latin_with_table(const unsigned char *mic,
static int static int
compare1(const void *p1, const void *p2) compare1(const void *p1, const void *p2)
{ {
uint32 v1, uint32 v1,
v2; v2;
v1 = *(uint32 *) p1; v1 = *(uint32 *) p1;
...@@ -259,7 +259,7 @@ compare1(const void *p1, const void *p2) ...@@ -259,7 +259,7 @@ compare1(const void *p1, const void *p2)
static int static int
compare2(const void *p1, const void *p2) compare2(const void *p1, const void *p2)
{ {
uint32 v1, uint32 v1,
v2; v2;
v1 = *(uint32 *) p1; v1 = *(uint32 *) p1;
...@@ -274,10 +274,13 @@ compare2(const void *p1, const void *p2) ...@@ -274,10 +274,13 @@ compare2(const void *p1, const void *p2)
static int static int
compare3(const void *p1, const void *p2) compare3(const void *p1, const void *p2)
{ {
uint32 s1, s2, d1, d2; uint32 s1,
s2,
d1,
d2;
s1 = *(uint32 *)p1; s1 = *(uint32 *) p1;
s2 = *((uint32 *)p1 + 1); s2 = *((uint32 *) p1 + 1);
d1 = ((pg_utf_to_local_combined *) p2)->utf1; d1 = ((pg_utf_to_local_combined *) p2)->utf1;
d2 = ((pg_utf_to_local_combined *) p2)->utf2; d2 = ((pg_utf_to_local_combined *) p2)->utf2;
return (s1 > d1 || (s1 == d1 && s2 > d2)) ? 1 : ((s1 == d1 && s2 == d2) ? 0 : -1); return (s1 > d1 || (s1 == d1 && s2 > d2)) ? 1 : ((s1 == d1 && s2 == d2) ? 0 : -1);
...@@ -290,7 +293,7 @@ compare3(const void *p1, const void *p2) ...@@ -290,7 +293,7 @@ compare3(const void *p1, const void *p2)
static int static int
compare4(const void *p1, const void *p2) compare4(const void *p1, const void *p2)
{ {
uint32 v1, uint32 v1,
v2; v2;
v1 = *(uint32 *) p1; v1 = *(uint32 *) p1;
...@@ -301,7 +304,8 @@ compare4(const void *p1, const void *p2) ...@@ -301,7 +304,8 @@ compare4(const void *p1, const void *p2)
/* /*
* convert 32bit wide character to mutibye stream pointed to by iso * convert 32bit wide character to mutibye stream pointed to by iso
*/ */
static unsigned char *set_iso_code(unsigned char *iso, uint32 code) static unsigned char *
set_iso_code(unsigned char *iso, uint32 code)
{ {
if (code & 0xff000000) if (code & 0xff000000)
*iso++ = code >> 24; *iso++ = code >> 24;
...@@ -330,12 +334,12 @@ static unsigned char *set_iso_code(unsigned char *iso, uint32 code) ...@@ -330,12 +334,12 @@ static unsigned char *set_iso_code(unsigned char *iso, uint32 code)
*/ */
void void
UtfToLocal(const unsigned char *utf, unsigned char *iso, UtfToLocal(const unsigned char *utf, unsigned char *iso,
const pg_utf_to_local *map, const pg_utf_to_local_combined *cmap, const pg_utf_to_local *map, const pg_utf_to_local_combined *cmap,
int size1, int size2, int encoding, int len) int size1, int size2, int encoding, int len)
{ {
uint32 iutf; uint32 iutf;
uint32 cutf[2]; uint32 cutf[2];
uint32 code; uint32 code;
pg_utf_to_local *p; pg_utf_to_local *p;
pg_utf_to_local_combined *cp; pg_utf_to_local_combined *cp;
int l; int l;
...@@ -384,10 +388,10 @@ UtfToLocal(const unsigned char *utf, unsigned char *iso, ...@@ -384,10 +388,10 @@ UtfToLocal(const unsigned char *utf, unsigned char *iso,
*/ */
if (cmap && len > l) if (cmap && len > l)
{ {
const unsigned char *utf_save = utf; const unsigned char *utf_save = utf;
int len_save = len; int len_save = len;
int l_save = l; int l_save = l;
len -= l; len -= l;
l = pg_utf_mblen(utf); l = pg_utf_mblen(utf);
...@@ -407,7 +411,7 @@ UtfToLocal(const unsigned char *utf, unsigned char *iso, ...@@ -407,7 +411,7 @@ UtfToLocal(const unsigned char *utf, unsigned char *iso,
sizeof(pg_utf_to_local), compare1); sizeof(pg_utf_to_local), compare1);
if (p == NULL) if (p == NULL)
report_untranslatable_char(PG_UTF8, encoding, report_untranslatable_char(PG_UTF8, encoding,
(const char *) (utf_save - l_save), len_save); (const char *) (utf_save - l_save), len_save);
iso = set_iso_code(iso, p->code); iso = set_iso_code(iso, p->code);
} }
...@@ -446,7 +450,7 @@ UtfToLocal(const unsigned char *utf, unsigned char *iso, ...@@ -446,7 +450,7 @@ UtfToLocal(const unsigned char *utf, unsigned char *iso,
sizeof(pg_utf_to_local), compare1); sizeof(pg_utf_to_local), compare1);
if (p == NULL) if (p == NULL)
report_untranslatable_char(PG_UTF8, encoding, report_untranslatable_char(PG_UTF8, encoding,
(const char *) (utf_save - l_save), len_save); (const char *) (utf_save - l_save), len_save);
iso = set_iso_code(iso, p->code); iso = set_iso_code(iso, p->code);
p = bsearch(&cutf[1], map, size1, p = bsearch(&cutf[1], map, size1,
...@@ -457,13 +461,13 @@ UtfToLocal(const unsigned char *utf, unsigned char *iso, ...@@ -457,13 +461,13 @@ UtfToLocal(const unsigned char *utf, unsigned char *iso,
code = p->code; code = p->code;
} }
} }
else /* no cmap or no remaining data */ else /* no cmap or no remaining data */
{ {
p = bsearch(&iutf, map, size1, p = bsearch(&iutf, map, size1,
sizeof(pg_utf_to_local), compare1); sizeof(pg_utf_to_local), compare1);
if (p == NULL) if (p == NULL)
report_untranslatable_char(PG_UTF8, encoding, report_untranslatable_char(PG_UTF8, encoding,
(const char *) (utf - l), len); (const char *) (utf - l), len);
code = p->code; code = p->code;
} }
iso = set_iso_code(iso, code); iso = set_iso_code(iso, code);
...@@ -491,7 +495,7 @@ UtfToLocal(const unsigned char *utf, unsigned char *iso, ...@@ -491,7 +495,7 @@ UtfToLocal(const unsigned char *utf, unsigned char *iso,
*/ */
void void
LocalToUtf(const unsigned char *iso, unsigned char *utf, LocalToUtf(const unsigned char *iso, unsigned char *utf,
const pg_local_to_utf *map, const pg_local_to_utf_combined *cmap, const pg_local_to_utf *map, const pg_local_to_utf_combined *cmap,
int size1, int size2, int encoding, int len) int size1, int size2, int encoding, int len)
{ {
unsigned int iiso; unsigned int iiso;
...@@ -549,13 +553,13 @@ LocalToUtf(const unsigned char *iso, unsigned char *utf, ...@@ -549,13 +553,13 @@ LocalToUtf(const unsigned char *iso, unsigned char *utf,
if (p == NULL) if (p == NULL)
{ {
/* /*
* not found in the ordinary map. if there's a combined * not found in the ordinary map. if there's a combined character
* character map, try with it * map, try with it
*/ */
if (cmap) if (cmap)
{ {
cp = bsearch(&iiso, cmap, size2, cp = bsearch(&iiso, cmap, size2,
sizeof(pg_local_to_utf_combined), compare4); sizeof(pg_local_to_utf_combined), compare4);
if (cp) if (cp)
{ {
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* Copyright (c) 2000-2007, PostgreSQL Global Development Group * Copyright (c) 2000-2007, PostgreSQL Global Development Group
* *
* $PostgreSQL: pgsql/src/bin/psql/mbprint.c,v 1.26 2007/10/13 20:18:41 tgl Exp $ * $PostgreSQL: pgsql/src/bin/psql/mbprint.c,v 1.27 2007/11/15 23:23:44 momjian Exp $
* *
* XXX this file does not really belong in psql/. Perhaps move to libpq? * XXX this file does not really belong in psql/. Perhaps move to libpq?
* It also seems that the mbvalidate function is redundant with existing * It also seems that the mbvalidate function is redundant with existing
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
* To avoid version-skew problems, this file must not use declarations * To avoid version-skew problems, this file must not use declarations
* from pg_wchar.h: the encoding IDs we are dealing with are determined * from pg_wchar.h: the encoding IDs we are dealing with are determined
* by the libpq.so we are linked with, and that might not match the * by the libpq.so we are linked with, and that might not match the
* numbers we see at compile time. (If this file were inside libpq, * numbers we see at compile time. (If this file were inside libpq,
* the problem would go away...) * the problem would go away...)
* *
* Hence, we have our own definition of pg_wchar, and we get the values * Hence, we have our own definition of pg_wchar, and we get the values
...@@ -246,7 +246,7 @@ pg_wcssize(unsigned char *pwcs, size_t len, int encoding, int *result_width, ...@@ -246,7 +246,7 @@ pg_wcssize(unsigned char *pwcs, size_t len, int encoding, int *result_width,
linewidth += 4; linewidth += 4;
format_size += 4; format_size += 4;
} }
else /* Output it as-is */ else /* Output it as-is */
{ {
linewidth += w; linewidth += w;
format_size += 1; format_size += 1;
...@@ -257,7 +257,7 @@ pg_wcssize(unsigned char *pwcs, size_t len, int encoding, int *result_width, ...@@ -257,7 +257,7 @@ pg_wcssize(unsigned char *pwcs, size_t len, int encoding, int *result_width,
linewidth += 6; /* \u0000 */ linewidth += 6; /* \u0000 */
format_size += 6; format_size += 6;
} }
else /* All other chars */ else /* All other chars */
{ {
linewidth += w; linewidth += w;
format_size += chlen; format_size += chlen;
...@@ -321,7 +321,7 @@ pg_wcsformat(unsigned char *pwcs, size_t len, int encoding, ...@@ -321,7 +321,7 @@ pg_wcsformat(unsigned char *pwcs, size_t len, int encoding,
linewidth += 4; linewidth += 4;
ptr += 4; ptr += 4;
} }
else /* Output it as-is */ else /* Output it as-is */
{ {
linewidth += w; linewidth += w;
*ptr++ = *pwcs; *ptr++ = *pwcs;
...@@ -343,7 +343,7 @@ pg_wcsformat(unsigned char *pwcs, size_t len, int encoding, ...@@ -343,7 +343,7 @@ pg_wcsformat(unsigned char *pwcs, size_t len, int encoding,
ptr += 6; ptr += 6;
linewidth += 6; linewidth += 6;
} }
else /* All other chars */ else /* All other chars */
{ {
int i; int i;
......
#!/bin/sh #!/bin/sh
# $PostgreSQL: pgsql/src/tools/pgindent/pgindent,v 1.93 2007/11/15 22:12:09 momjian Exp $ # $PostgreSQL: pgsql/src/tools/pgindent/pgindent,v 1.94 2007/11/15 23:23:44 momjian Exp $
# Known bugs: # Known bugs:
# #
...@@ -33,22 +33,31 @@ fi ...@@ -33,22 +33,31 @@ fi
for FILE for FILE
do do
cat "$FILE" | cat "$FILE" |
# convert // comments to /* */
# Convert // comments to /* */
sed 's;^\([ ]*\)//\(.*\)$;\1/* \2 */;g' | sed 's;^\([ ]*\)//\(.*\)$;\1/* \2 */;g' |
# Avoid bug that converts 'x =- 1' to 'x = -1' # Avoid bug that converts 'x =- 1' to 'x = -1'
sed 's;=- ;-= ;g' | sed 's;=- ;-= ;g' |
# mark some comments for special treatment later
# Mark some comments for special treatment later
sed 's;/\* *---;/*---X_X;g' | sed 's;/\* *---;/*---X_X;g' |
# workaround for indent bug with 'else' handling
# trim trailing space after single-line after-'else' comment # 'else' followed by a single-line comment, followed by
# so next test can be done easily # a brace on the next line confuses BSD indent, so we push
sed 's;\([} ]\)else[ ]*\(/\*.*\*/\)[ ]*$;\1else \2;g' | # the comment down to the next line, then later pull it
# indent multi-line after-'else' comment so BSD indent will move it properly # back up again.
sed 's;\([} ]\)else[ ]*\(/\*.*[^\*][^/]\)$;\1else\ sed 's;\([} ]\)else[ ]*\(/\*\)\(.*\*/\)[ ]*$;\1else\
\2PGINDENT_MOVED\3;g' |
# Indent multi-line after-'else' comment so BSD indent will move it properly.
# We already moved down single-line comments above. Check for '*' to make
# sure we are not in a single-line comment that has other text on the line.
sed 's;\([} ]\)else[ ]*\(/\*[^\*]*\)[ ]*$;\1else\
\2;g' | \2;g' |
detab -t4 -qc | detab -t4 -qc |
# work around bug where function that defines no local variables misindents # Work around bug where function that defines no local variables misindents
# switch() case lines and line after #else. Do not do for struct/enum. # switch() case lines and line after #else. Do not do for struct/enum.
awk ' BEGIN {line1 = ""; line2 = ""} awk ' BEGIN {line1 = ""; line2 = ""}
{ {
...@@ -71,7 +80,7 @@ do ...@@ -71,7 +80,7 @@ do
print line1; print line1;
}' | }' |
# prevent indenting of code in 'extern "C"' blocks # Prevent indenting of code in 'extern "C"' blocks.
awk ' BEGIN {line1 = ""; line2 = ""; skips = 0} awk ' BEGIN {line1 = ""; line2 = ""; skips = 0}
{ {
line2 = $0; line2 = $0;
...@@ -106,10 +115,10 @@ do ...@@ -106,10 +115,10 @@ do
print line1; print line1;
}' | }' |
# protect backslashes in DATA() # Protect backslashes in DATA().
sed 's;^DATA(.*$;/*&*/;' | sed 's;^DATA(.*$;/*&*/;' |
# protect wrapping in CATALOG() # Protect wrapping in CATALOG().
sed 's;^CATALOG(.*$;/*&*/;' >/tmp/$$a sed 's;^CATALOG(.*$;/*&*/;' >/tmp/$$a
# We get the list of typedef's from /src/tools/find_typedef # We get the list of typedef's from /src/tools/find_typedef
...@@ -2130,30 +2139,30 @@ do ...@@ -2130,30 +2139,30 @@ do
fi fi
cat /tmp/$$a | cat /tmp/$$a |
# restore DATA/CATALOG lines # Restore DATA/CATALOG lines.
sed 's;^/\*\(DATA(.*\)\*/$;\1;' | sed 's;^/\*\(DATA(.*\)\*/$;\1;' |
sed 's;^/\*\(CATALOG(.*\)\*/$;\1;' | sed 's;^/\*\(CATALOG(.*\)\*/$;\1;' |
# remove tabs and retab with four spaces # Remove tabs and retab with four spaces.
detab -t8 -qc | detab -t8 -qc |
entab -t4 -qc | entab -t4 -qc |
sed 's;^/\* Open extern \"C\" \*/$;{;' | sed 's;^/\* Open extern \"C\" \*/$;{;' |
sed 's;^/\* Close extern \"C\" \*/$;};' | sed 's;^/\* Close extern \"C\" \*/$;};' |
sed 's;/\*---X_X;/* ---;g' | sed 's;/\*---X_X;/* ---;g' |
# workaround indent bug for 'static' # Workaround indent bug for 'static'.
sed 's;^static[ ][ ]*;static ;g' | sed 's;^static[ ][ ]*;static ;g' |
# remove too much indenting after closing brace # Remove too much indenting after closing brace.
sed 's;^} [ ]*;} ;' | sed 's;^} [ ]*;} ;' |
# indent single-line after-'else' comment by only one tab # Indent single-line after-'else' comment by only one tab.
sed 's;\([} ]\)else[ ]*\(/\*.*\*/\)[ ]*$;\1else \2;g' | sed 's;\([} ]\)else[ ]*\(/\*.*\*/\)[ ]*$;\1else \2;g' |
# pull in #endif comments # Pull in #endif comments.
sed 's;^#endif[ ][ ]*/\*;#endif /*;' | sed 's;^#endif[ ][ ]*/\*;#endif /*;' |
# work around misindenting of function with no variables defined # Work around misindenting of function with no variables defined.
awk ' awk '
{ {
if ($0 ~ /^[ ]*int[ ]*pgindent_func_no_var_fix;/) if ($0 ~ /^[ ]*int[ ]*pgindent_func_no_var_fix;/)
...@@ -2164,13 +2173,13 @@ do ...@@ -2164,13 +2173,13 @@ do
else print $0; else print $0;
}' | }' |
# add space after comments that start on tab stops # Add space after comments that start on tab stops.
sed 's;\([^ ]\)\(/\*.*\*/\)$;\1 \2;' | sed 's;\([^ ]\)\(/\*.*\*/\)$;\1 \2;' |
# move trailing * in function return type # Move trailing * in function return type.
sed 's;^\([A-Za-z_][^ ]*\)[ ][ ]*\*$;\1 *;' | sed 's;^\([A-Za-z_][^ ]*\)[ ][ ]*\*$;\1 *;' |
# remove un-needed braces around single statements # Remove un-needed braces around single statements.
# Do not use because it uglifies PG_TRY/PG_CATCH blocks and probably # Do not use because it uglifies PG_TRY/PG_CATCH blocks and probably
# isn't needed for general use. # isn't needed for general use.
# awk ' # awk '
...@@ -2200,7 +2209,7 @@ do ...@@ -2200,7 +2209,7 @@ do
# print line2; # print line2;
# }' | # }' |
# remove blank line between opening brace and block comment # Remove blank line between opening brace and block comment.
awk ' awk '
{ {
line3 = $0; line3 = $0;
...@@ -2229,7 +2238,33 @@ do ...@@ -2229,7 +2238,33 @@ do
print line2; print line2;
}' | }' |
# remove trailing blank lines, helps with adding blank before trailing #endif # Pull up single-line comment after 'else' that was pulled down above
awk '
{
if (NR != 1)
{
if ($0 ~ "/\*PGINDENT_MOVED")
{
# remove tag
sub("PGINDENT_MOVED", "", $0);
# remove leading whitespace
sub("^[ ]*", "", $0);
# add comment with single tab prefix
print prev_line" "$0;
# throw away current line
getline;
}
else
print prev_line;
}
prev_line = $0;
}
END {
if (NR >= 1)
print prev_line;
}' |
# Remove trailing blank lines, helps with adding blank before trailing #endif.
awk ' BEGIN {blank_lines = 0;} awk ' BEGIN {blank_lines = 0;}
{ {
line1 = $0; line1 = $0;
...@@ -2243,7 +2278,7 @@ do ...@@ -2243,7 +2278,7 @@ do
} }
}' | }' |
# remove blank line before #else, #elif, and #endif # Remove blank line before #else, #elif, and #endif.
awk ' BEGIN {line1 = ""; line2 = ""; skips = 0} awk ' BEGIN {line1 = ""; line2 = ""; skips = 0}
{ {
line2 = $0; line2 = $0;
...@@ -2268,7 +2303,7 @@ do ...@@ -2268,7 +2303,7 @@ do
print line1; print line1;
}' | }' |
# add blank line before #endif if it is the last line in the file # Add blank line before #endif if it is the last line in the file.
awk ' BEGIN {line1 = ""; line2 = ""} awk ' BEGIN {line1 = ""; line2 = ""}
{ {
line2 = $0; line2 = $0;
...@@ -2326,7 +2361,7 @@ do ...@@ -2326,7 +2361,7 @@ do
else print $0; else print $0;
}' | }' |
# fix indenting of typedef caused by __cplusplus in libpq-fe.h # Fix indenting of typedef caused by __cplusplus in libpq-fe.h.
( (
if echo "$FILE" | grep -q 'libpq-fe.h$' if echo "$FILE" | grep -q 'libpq-fe.h$'
then sed 's/^[ ]*typedef enum/typedef enum/' then sed 's/^[ ]*typedef enum/typedef enum/'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment