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

pgindent run for 8.2.

This commit is contained in:
Bruce Momjian
2006-10-04 00:30:14 +00:00
parent 451e419e98
commit f99a569a2e
522 changed files with 21297 additions and 17170 deletions

View File

@@ -10,7 +10,7 @@
* Written by Peter Eisentraut <peter_e@gmx.net>.
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.353 2006/10/03 21:11:54 momjian Exp $
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.354 2006/10/04 00:30:03 momjian Exp $
*
*--------------------------------------------------------------------
*/
@@ -204,6 +204,7 @@ static char *log_error_verbosity_str;
static char *log_statement_str;
static char *log_min_error_statement_str;
static char *log_destination_string;
#ifdef HAVE_SYSLOG
static char *syslog_facility_str;
static char *syslog_ident_str;
@@ -220,7 +221,7 @@ static char *locale_ctype;
static char *regex_flavor_string;
static char *server_encoding_string;
static char *server_version_string;
static int server_version_num;
static int server_version_num;
static char *timezone_string;
static char *timezone_abbreviations_string;
static char *XactIsoLevel_string;
@@ -992,9 +993,9 @@ static struct config_bool ConfigureNamesBool[] =
{
{"allow_system_table_mods", PGC_POSTMASTER, DEVELOPER_OPTIONS,
gettext_noop("Allows modifications of the structure of system tables."),
NULL,
GUC_NOT_IN_SAMPLE
gettext_noop("Allows modifications of the structure of system tables."),
NULL,
GUC_NOT_IN_SAMPLE
},
&allowSystemTableMods,
false, NULL, NULL
@@ -1002,10 +1003,10 @@ static struct config_bool ConfigureNamesBool[] =
{
{"ignore_system_indexes", PGC_BACKEND, DEVELOPER_OPTIONS,
gettext_noop("Disables reading from system indexes."),
gettext_noop("It does not prevent updating the indexes, so it is safe "
"to use. The worst consequence is slowness."),
GUC_NOT_IN_SAMPLE
gettext_noop("Disables reading from system indexes."),
gettext_noop("It does not prevent updating the indexes, so it is safe "
"to use. The worst consequence is slowness."),
GUC_NOT_IN_SAMPLE
},
&IgnoreSystemIndexes,
false, NULL, NULL
@@ -1022,19 +1023,19 @@ static struct config_int ConfigureNamesInt[] =
{
{
{"archive_timeout", PGC_SIGHUP, WAL_SETTINGS,
gettext_noop("Forces a switch to the next xlog file if a "
"new file has not been started within N seconds."),
NULL,
GUC_UNIT_S
gettext_noop("Forces a switch to the next xlog file if a "
"new file has not been started within N seconds."),
NULL,
GUC_UNIT_S
},
&XLogArchiveTimeout,
0, 0, INT_MAX, NULL, NULL
},
{
{"post_auth_delay", PGC_BACKEND, DEVELOPER_OPTIONS,
gettext_noop("Waits N seconds on connection startup after authentication."),
gettext_noop("This allows attaching a debugger to the process."),
GUC_NOT_IN_SAMPLE | GUC_UNIT_S
gettext_noop("Waits N seconds on connection startup after authentication."),
gettext_noop("This allows attaching a debugger to the process."),
GUC_NOT_IN_SAMPLE | GUC_UNIT_S
},
&PostAuthDelay,
0, 0, INT_MAX, NULL, NULL
@@ -1863,7 +1864,7 @@ static struct config_string ConfigureNamesString[] =
{"default_tablespace", PGC_USERSET, CLIENT_CONN_STATEMENT,
gettext_noop("Sets the default tablespace to create tables and indexes in."),
gettext_noop("An empty string selects the database's default tablespace."),
GUC_IS_NAME
GUC_IS_NAME
},
&default_tablespace,
"", assign_default_tablespace, NULL
@@ -2295,7 +2296,7 @@ static void ReportGUCOption(struct config_generic * record);
static void ShowGUCConfigOption(const char *name, DestReceiver *dest);
static void ShowAllGUCConfig(DestReceiver *dest);
static char *_ShowOption(struct config_generic * record, bool use_units);
static bool is_newvalue_equal(struct config_generic *record, const char *newvalue);
static bool is_newvalue_equal(struct config_generic * record, const char *newvalue);
/*
@@ -3584,7 +3585,7 @@ parse_int(const char *value, int *result, int flags)
if ((flags & GUC_UNIT_MEMORY) && endptr != value)
{
bool used = false;
bool used = false;
while (*endptr == ' ')
endptr++;
@@ -3612,10 +3613,10 @@ parse_int(const char *value, int *result, int flags)
switch (flags & GUC_UNIT_MEMORY)
{
case GUC_UNIT_BLOCKS:
val /= (BLCKSZ/1024);
val /= (BLCKSZ / 1024);
break;
case GUC_UNIT_XBLOCKS:
val /= (XLOG_BLCKSZ/1024);
val /= (XLOG_BLCKSZ / 1024);
break;
}
}
@@ -3623,7 +3624,7 @@ parse_int(const char *value, int *result, int flags)
if ((flags & GUC_UNIT_TIME) && endptr != value)
{
bool used = false;
bool used = false;
while (*endptr == ' ')
endptr++;
@@ -3662,12 +3663,12 @@ parse_int(const char *value, int *result, int flags)
{
switch (flags & GUC_UNIT_TIME)
{
case GUC_UNIT_S:
val /= MS_PER_S;
break;
case GUC_UNIT_MIN:
val /= MS_PER_MIN;
break;
case GUC_UNIT_S:
val /= MS_PER_S;
break;
case GUC_UNIT_MIN:
val /= MS_PER_MIN;
break;
}
}
}
@@ -4173,9 +4174,10 @@ set_config_option(const char *name, const char *value,
newval = guc_strdup(elevel, value);
if (newval == NULL)
return false;
/*
* The only sort of "parsing" check we need to do is
* apply truncation if GUC_IS_NAME.
* The only sort of "parsing" check we need to do is apply
* truncation if GUC_IS_NAME.
*/
if (conf->gen.flags & GUC_IS_NAME)
truncate_identifier(newval, strlen(newval), true);
@@ -4988,11 +4990,11 @@ GetConfigOptionByNum(int varnum, const char **values, bool *noshow)
values[2] = "kB";
break;
case GUC_UNIT_BLOCKS:
snprintf(buf, sizeof(buf), "%dkB", BLCKSZ/1024);
snprintf(buf, sizeof(buf), "%dkB", BLCKSZ / 1024);
values[2] = buf;
break;
case GUC_UNIT_XBLOCKS:
snprintf(buf, sizeof(buf), "%dkB", XLOG_BLCKSZ/1024);
snprintf(buf, sizeof(buf), "%dkB", XLOG_BLCKSZ / 1024);
values[2] = buf;
break;
case GUC_UNIT_MS:
@@ -5271,18 +5273,18 @@ _ShowOption(struct config_generic * record, bool use_units)
val = (*conf->show_hook) ();
else
{
char unit[4];
int result = *conf->variable;
char unit[4];
int result = *conf->variable;
if (use_units && result > 0 && (record->flags & GUC_UNIT_MEMORY))
{
switch (record->flags & GUC_UNIT_MEMORY)
{
case GUC_UNIT_BLOCKS:
result *= BLCKSZ/1024;
result *= BLCKSZ / 1024;
break;
case GUC_UNIT_XBLOCKS:
result *= XLOG_BLCKSZ/1024;
result *= XLOG_BLCKSZ / 1024;
break;
}
@@ -5342,7 +5344,7 @@ _ShowOption(struct config_generic * record, bool use_units)
strcpy(unit, "");
snprintf(buffer, sizeof(buffer), "%d%s",
(int)result, unit);
(int) result, unit);
val = buffer;
}
}
@@ -5387,37 +5389,37 @@ _ShowOption(struct config_generic * record, bool use_units)
static bool
is_newvalue_equal(struct config_generic *record, const char *newvalue)
is_newvalue_equal(struct config_generic * record, const char *newvalue)
{
switch (record->vartype)
{
case PGC_BOOL:
{
struct config_bool *conf = (struct config_bool *) record;
bool newval;
{
struct config_bool *conf = (struct config_bool *) record;
bool newval;
return parse_bool(newvalue, &newval) && *conf->variable == newval;
}
return parse_bool(newvalue, &newval) && *conf->variable == newval;
}
case PGC_INT:
{
struct config_int *conf = (struct config_int *) record;
int newval;
{
struct config_int *conf = (struct config_int *) record;
int newval;
return parse_int(newvalue, &newval, record->flags) && *conf->variable == newval;
}
return parse_int(newvalue, &newval, record->flags) && *conf->variable == newval;
}
case PGC_REAL:
{
struct config_real *conf = (struct config_real *) record;
double newval;
{
struct config_real *conf = (struct config_real *) record;
double newval;
return parse_real(newvalue, &newval) && *conf->variable == newval;
}
return parse_real(newvalue, &newval) && *conf->variable == newval;
}
case PGC_STRING:
{
struct config_string *conf = (struct config_string *) record;
{
struct config_string *conf = (struct config_string *) record;
return strcmp(*conf->variable, newvalue) == 0;
}
return strcmp(*conf->variable, newvalue) == 0;
}
}
return false;
@@ -6251,7 +6253,7 @@ assign_debug_assertions(bool newval, bool doit, GucSource source)
if (newval)
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("assertion checking is not supported by this build")));
errmsg("assertion checking is not supported by this build")));
#endif
return true;
}
@@ -6338,12 +6340,11 @@ static const char *
assign_backslash_quote(const char *newval, bool doit, GucSource source)
{
BackslashQuoteType bq;
bool bqbool;
bool bqbool;
/*
* Although only "on", "off", and "safe_encoding" are documented,
* we use parse_bool so we can accept all the likely variants of
* "on" and "off".
* Although only "on", "off", and "safe_encoding" are documented, we use
* parse_bool so we can accept all the likely variants of "on" and "off".
*/
if (pg_strcasecmp(newval, "safe_encoding") == 0)
bq = BACKSLASH_QUOTE_SAFE_ENCODING;
@@ -6367,14 +6368,14 @@ assign_timezone_abbreviations(const char *newval, bool doit, GucSource source)
* The powerup value shown above for timezone_abbreviations is "UNKNOWN".
* When we see this we just do nothing. If this value isn't overridden
* from the config file then pg_timezone_abbrev_initialize() will
* eventually replace it with "Default". This hack has two purposes:
* to avoid wasting cycles loading values that might soon be overridden
* from the config file, and to avoid trying to read the timezone abbrev
* files during InitializeGUCOptions(). The latter doesn't work in an
* EXEC_BACKEND subprocess because my_exec_path hasn't been set yet and
* so we can't locate PGSHAREDIR. (Essentially the same hack is used
* to delay initializing TimeZone ... if we have any more, we should
* try to clean up and centralize this mechanism ...)
* eventually replace it with "Default". This hack has two purposes: to
* avoid wasting cycles loading values that might soon be overridden from
* the config file, and to avoid trying to read the timezone abbrev files
* during InitializeGUCOptions(). The latter doesn't work in an
* EXEC_BACKEND subprocess because my_exec_path hasn't been set yet and so
* we can't locate PGSHAREDIR. (Essentially the same hack is used to
* delay initializing TimeZone ... if we have any more, we should try to
* clean up and centralize this mechanism ...)
*/
if (strcmp(newval, "UNKNOWN") == 0)
{
@@ -6385,11 +6386,11 @@ assign_timezone_abbreviations(const char *newval, bool doit, GucSource source)
if (timezone_abbreviations_string == NULL ||
strcmp(timezone_abbreviations_string, newval) != 0)
{
int elevel;
int elevel;
/*
* If reading config file, only the postmaster should bleat loudly
* about problems. Otherwise, it's just this one process doing it,
* about problems. Otherwise, it's just this one process doing it,
* and we use WARNING message level.
*/
if (source == PGC_S_FILE)

View File

@@ -5,7 +5,7 @@
* to contain some useful information. Mechanism differs wildly across
* platforms.
*
* $PostgreSQL: pgsql/src/backend/utils/misc/ps_status.c,v 1.32 2006/09/27 18:40:10 tgl Exp $
* $PostgreSQL: pgsql/src/backend/utils/misc/ps_status.c,v 1.33 2006/10/04 00:30:04 momjian Exp $
*
* Copyright (c) 2000-2006, PostgreSQL Global Development Group
* various details abducted from various places
@@ -31,7 +31,7 @@
#include "utils/ps_status.h"
extern char **environ;
bool update_process_title = true;
bool update_process_title = true;
/*
@@ -287,7 +287,7 @@ set_ps_display(const char *activity, bool force)
if (!force && !update_process_title)
return;
#ifndef PS_USE_NONE
/* no ps display for stand-alone backend */
if (!IsUnderPostmaster)
@@ -336,8 +336,8 @@ set_ps_display(const char *activity, bool force)
#ifdef PS_USE_WIN32
{
/*
* Win32 does not support showing any changed arguments. To make it
* at all possible to track which backend is doing what, we create a
* Win32 does not support showing any changed arguments. To make it at
* all possible to track which backend is doing what, we create a
* named object that can be viewed with for example Process Explorer.
*/
static HANDLE ident_handle = INVALID_HANDLE_VALUE;
@@ -351,7 +351,6 @@ set_ps_display(const char *activity, bool force)
ident_handle = CreateEvent(NULL, TRUE, FALSE, name);
}
#endif /* PS_USE_WIN32 */
#endif /* not PS_USE_NONE */
}

View File

@@ -13,7 +13,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/misc/tzparser.c,v 1.1 2006/07/25 03:51:21 tgl Exp $
* $PostgreSQL: pgsql/src/backend/utils/misc/tzparser.c,v 1.2 2006/10/04 00:30:04 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -35,11 +35,11 @@ static int tz_elevel; /* to avoid passing this around a lot */
static bool validateTzEntry(tzEntry *tzentry);
static bool splitTzLine(const char *filename, int lineno,
char *line, tzEntry *tzentry);
static int addToArray(tzEntry **base, int *arraysize, int n,
tzEntry *entry, bool override);
static int ParseTzFile(const char *filename, int depth,
tzEntry **base, int *arraysize, int n);
char *line, tzEntry *tzentry);
static int addToArray(tzEntry **base, int *arraysize, int n,
tzEntry *entry, bool override);
static int ParseTzFile(const char *filename, int depth,
tzEntry **base, int *arraysize, int n);
/*
@@ -53,7 +53,8 @@ validateTzEntry(tzEntry *tzentry)
unsigned char *p;
/*
* Check restrictions imposed by datetkntbl storage format (see datetime.c)
* Check restrictions imposed by datetkntbl storage format (see
* datetime.c)
*/
if (strlen(tzentry->abbrev) > TOKMAXLEN)
{
@@ -77,8 +78,8 @@ validateTzEntry(tzEntry *tzentry)
/*
* Sanity-check the offset: shouldn't exceed 14 hours
*/
if (tzentry->offset > 14*60*60 ||
tzentry->offset < -14*60*60)
if (tzentry->offset > 14 * 60 * 60 ||
tzentry->offset < -14 * 60 * 60)
{
ereport(tz_elevel,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
@@ -105,11 +106,11 @@ validateTzEntry(tzEntry *tzentry)
static bool
splitTzLine(const char *filename, int lineno, char *line, tzEntry *tzentry)
{
char *abbrev;
char *offset;
char *offset_endptr;
char *remain;
char *is_dst;
char *abbrev;
char *offset;
char *offset_endptr;
char *remain;
char *is_dst;
tzentry->lineno = lineno;
tzentry->filename = filename;
@@ -130,8 +131,8 @@ splitTzLine(const char *filename, int lineno, char *line, tzEntry *tzentry)
{
ereport(tz_elevel,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("missing time zone offset in time zone file \"%s\", line %d",
filename, lineno)));
errmsg("missing time zone offset in time zone file \"%s\", line %d",
filename, lineno)));
return false;
}
tzentry->offset = strtol(offset, &offset_endptr, 10);
@@ -157,7 +158,7 @@ splitTzLine(const char *filename, int lineno, char *line, tzEntry *tzentry)
remain = is_dst;
}
if (!remain) /* no more non-whitespace chars */
if (!remain) /* no more non-whitespace chars */
return true;
if (remain[0] != '#') /* must be a comment */
@@ -186,23 +187,23 @@ static int
addToArray(tzEntry **base, int *arraysize, int n,
tzEntry *entry, bool override)
{
tzEntry* arrayptr;
tzEntry *arrayptr;
int low;
int high;
/*
* Search the array for a duplicate; as a useful side effect, the array
* is maintained in sorted order. We use strcmp() to ensure we match
* the sort order datetime.c expects.
* Search the array for a duplicate; as a useful side effect, the array is
* maintained in sorted order. We use strcmp() to ensure we match the
* sort order datetime.c expects.
*/
arrayptr = *base;
low = 0;
high = n-1;
high = n - 1;
while (low <= high)
{
int mid = (low + high) >> 1;
tzEntry *midptr = arrayptr + mid;
int cmp;
int mid = (low + high) >> 1;
tzEntry *midptr = arrayptr + mid;
int cmp;
cmp = strcmp(entry->abbrev, midptr->abbrev);
if (cmp < 0)
@@ -214,7 +215,7 @@ addToArray(tzEntry **base, int *arraysize, int n,
/*
* Found a duplicate entry; complain unless it's the same.
*/
if (midptr->offset == entry->offset &&
if (midptr->offset == entry->offset &&
midptr->is_dst == entry->is_dst)
{
/* return unchanged array */
@@ -230,8 +231,8 @@ addToArray(tzEntry **base, int *arraysize, int n,
/* same abbrev but something is different, complain */
ereport(tz_elevel,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("time zone abbreviation \"%s\" is multiply defined",
entry->abbrev),
errmsg("time zone abbreviation \"%s\" is multiply defined",
entry->abbrev),
errdetail("Time zone file \"%s\", line %d conflicts with file \"%s\", line %d.",
midptr->filename, midptr->lineno,
entry->filename, entry->lineno)));
@@ -257,7 +258,7 @@ addToArray(tzEntry **base, int *arraysize, int n,
/* Must dup the abbrev to ensure it survives */
arrayptr->abbrev = pstrdup(entry->abbrev);
return n+1;
return n + 1;
}
/*
@@ -275,15 +276,15 @@ static int
ParseTzFile(const char *filename, int depth,
tzEntry **base, int *arraysize, int n)
{
char share_path[MAXPGPATH];
char file_path[MAXPGPATH];
FILE *tzFile;
char tzbuf[1024];
char *line;
tzEntry tzentry;
int lineno = 0;
bool override = false;
const char *p;
char share_path[MAXPGPATH];
char file_path[MAXPGPATH];
FILE *tzFile;
char tzbuf[1024];
char *line;
tzEntry tzentry;
int lineno = 0;
bool override = false;
const char *p;
/*
* We enforce that the filename is all alpha characters. This may be
@@ -299,23 +300,23 @@ ParseTzFile(const char *filename, int depth,
if (depth > 0)
ereport(tz_elevel,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("invalid time zone file name \"%s\"",
filename)));
errmsg("invalid time zone file name \"%s\"",
filename)));
return -1;
}
}
/*
* The maximal recursion depth is a pretty arbitrary setting.
* It is hard to imagine that someone needs more than 3 levels so stick
* with this conservative setting until someone complains.
* The maximal recursion depth is a pretty arbitrary setting. It is hard
* to imagine that someone needs more than 3 levels so stick with this
* conservative setting until someone complains.
*/
if (depth > 3)
{
ereport(tz_elevel,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("time zone file recursion limit exceeded in file \"%s\"",
filename)));
errmsg("time zone file recursion limit exceeded in file \"%s\"",
filename)));
return -1;
}
@@ -350,13 +351,13 @@ ParseTzFile(const char *filename, int depth,
/* else we're at EOF after all */
break;
}
if (strlen(tzbuf) == sizeof(tzbuf)-1)
if (strlen(tzbuf) == sizeof(tzbuf) - 1)
{
/* the line is too long for tzbuf */
ereport(tz_elevel,
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
errmsg("line is too long in time zone file \"%s\", line %d",
filename, lineno)));
errmsg("line is too long in time zone file \"%s\", line %d",
filename, lineno)));
return -1;
}
@@ -365,15 +366,15 @@ ParseTzFile(const char *filename, int depth,
while (*line && isspace((unsigned char) *line))
line++;
if (*line == '\0') /* empty line */
if (*line == '\0') /* empty line */
continue;
if (*line == '#') /* comment line */
if (*line == '#') /* comment line */
continue;
if (pg_strncasecmp(line, "@INCLUDE", strlen("@INCLUDE")) == 0)
{
/* pstrdup so we can use filename in result data structure */
char* includeFile = pstrdup(line + strlen("@INCLUDE"));
char *includeFile = pstrdup(line + strlen("@INCLUDE"));
includeFile = strtok(includeFile, WHITESPACE);
if (!includeFile || !*includeFile)
@@ -425,15 +426,15 @@ load_tzoffsets(const char *filename, bool doit, int elevel)
{
MemoryContext tmpContext;
MemoryContext oldContext;
tzEntry *array;
tzEntry *array;
int arraysize;
int n;
tz_elevel = elevel;
/*
* Create a temp memory context to work in. This makes it easy to
* clean up afterwards.
* Create a temp memory context to work in. This makes it easy to clean
* up afterwards.
*/
tmpContext = AllocSetContextCreate(CurrentMemoryContext,
"TZParserMemory",