1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-13 07:41:39 +03:00

pgindent run for release 9.3

This is the first run of the Perl-based pgindent script.  Also update
pgindent instructions.
This commit is contained in:
Bruce Momjian
2013-05-29 16:58:43 -04:00
parent 07ab261ef3
commit 9af4159fce
367 changed files with 4222 additions and 3829 deletions

View File

@ -28,7 +28,7 @@ static char *get_canonical_locale_name(int category, const char *locale);
* fix_path_separator
* For non-Windows, just return the argument.
* For Windows convert any forward slash to a backslash
* such as is suitable for arguments to builtin commands
* such as is suitable for arguments to builtin commands
* like RMDIR and DEL.
*/
static char *
@ -36,8 +36,8 @@ fix_path_separator(char *path)
{
#ifdef WIN32
char *result;
char *c;
char *result;
char *c;
result = pg_strdup(path);
@ -46,11 +46,9 @@ fix_path_separator(char *path)
*c = '\\';
return result;
#else
return path;
#endif
}
@ -156,21 +154,21 @@ check_new_cluster(void)
check_is_super_user(&new_cluster);
/*
* We don't restore our own user, so both clusters must match have
* matching install-user oids.
* We don't restore our own user, so both clusters must match have
* matching install-user oids.
*/
if (old_cluster.install_role_oid != new_cluster.install_role_oid)
pg_log(PG_FATAL,
"Old and new cluster install users have different values for pg_authid.oid.\n");
"Old and new cluster install users have different values for pg_authid.oid.\n");
/*
* We only allow the install user in the new cluster because other
* defined users might match users defined in the old cluster and
* generate an error during pg_dump restore.
* We only allow the install user in the new cluster because other defined
* users might match users defined in the old cluster and generate an
* error during pg_dump restore.
*/
if (new_cluster.role_count != 1)
pg_log(PG_FATAL, "Only the install user can be defined in the new cluster.\n");
check_for_prepared_transactions(&new_cluster);
}
@ -247,14 +245,14 @@ output_completion_banner(char *analyze_script_file_name,
if (deletion_script_file_name)
pg_log(PG_REPORT,
"Running this script will delete the old cluster's data files:\n"
"Running this script will delete the old cluster's data files:\n"
" %s\n",
deletion_script_file_name);
else
pg_log(PG_REPORT,
"Could not create a script to delete the old cluster's data\n"
"files because user-defined tablespaces exist in the old cluster\n"
"directory. The old cluster's contents must be deleted manually.\n");
"files because user-defined tablespaces exist in the old cluster\n"
"directory. The old cluster's contents must be deleted manually.\n");
}
@ -323,8 +321,8 @@ check_cluster_compatibility(bool live_check)
/* We read the real port number for PG >= 9.1 */
if (live_check && GET_MAJOR_VERSION(old_cluster.major_version) < 901 &&
old_cluster.port == DEF_PGUPORT)
pg_log(PG_FATAL, "When checking a pre-PG 9.1 live old server, "
"you must specify the old server's port number.\n");
pg_log(PG_FATAL, "When checking a pre-PG 9.1 live old server, "
"you must specify the old server's port number.\n");
if (live_check && old_cluster.port == new_cluster.port)
pg_log(PG_FATAL, "When checking a live server, "
@ -366,18 +364,18 @@ set_locale_and_encoding(ClusterInfo *cluster)
if (GET_MAJOR_VERSION(cluster->major_version) < 902)
{
/*
* Pre-9.2 did not canonicalize the supplied locale names
* to match what the system returns, while 9.2+ does, so
* convert pre-9.2 to match.
* Pre-9.2 did not canonicalize the supplied locale names to match
* what the system returns, while 9.2+ does, so convert pre-9.2 to
* match.
*/
ctrl->lc_collate = get_canonical_locale_name(LC_COLLATE,
pg_strdup(PQgetvalue(res, 0, i_datcollate)));
pg_strdup(PQgetvalue(res, 0, i_datcollate)));
ctrl->lc_ctype = get_canonical_locale_name(LC_CTYPE,
pg_strdup(PQgetvalue(res, 0, i_datctype)));
}
pg_strdup(PQgetvalue(res, 0, i_datctype)));
}
else
{
ctrl->lc_collate = pg_strdup(PQgetvalue(res, 0, i_datcollate));
ctrl->lc_collate = pg_strdup(PQgetvalue(res, 0, i_datcollate));
ctrl->lc_ctype = pg_strdup(PQgetvalue(res, 0, i_datctype));
}
@ -410,21 +408,21 @@ check_locale_and_encoding(ControlData *oldctrl,
ControlData *newctrl)
{
/*
* These are often defined with inconsistent case, so use pg_strcasecmp().
* They also often use inconsistent hyphenation, which we cannot fix, e.g.
* UTF-8 vs. UTF8, so at least we display the mismatching values.
* These are often defined with inconsistent case, so use pg_strcasecmp().
* They also often use inconsistent hyphenation, which we cannot fix, e.g.
* UTF-8 vs. UTF8, so at least we display the mismatching values.
*/
if (pg_strcasecmp(oldctrl->lc_collate, newctrl->lc_collate) != 0)
pg_log(PG_FATAL,
"lc_collate cluster values do not match: old \"%s\", new \"%s\"\n",
"lc_collate cluster values do not match: old \"%s\", new \"%s\"\n",
oldctrl->lc_collate, newctrl->lc_collate);
if (pg_strcasecmp(oldctrl->lc_ctype, newctrl->lc_ctype) != 0)
pg_log(PG_FATAL,
"lc_ctype cluster values do not match: old \"%s\", new \"%s\"\n",
"lc_ctype cluster values do not match: old \"%s\", new \"%s\"\n",
oldctrl->lc_ctype, newctrl->lc_ctype);
if (pg_strcasecmp(oldctrl->encoding, newctrl->encoding) != 0)
pg_log(PG_FATAL,
"encoding cluster values do not match: old \"%s\", new \"%s\"\n",
"encoding cluster values do not match: old \"%s\", new \"%s\"\n",
oldctrl->encoding, newctrl->encoding);
}
@ -597,16 +595,16 @@ create_script_for_old_cluster_deletion(char **deletion_script_file_name)
SCRIPT_EXT);
/*
* Some users (oddly) create tablespaces inside the cluster data
* directory. We can't create a proper old cluster delete script
* in that case.
* Some users (oddly) create tablespaces inside the cluster data
* directory. We can't create a proper old cluster delete script in that
* case.
*/
strlcpy(old_cluster_pgdata, old_cluster.pgdata, MAXPGPATH);
canonicalize_path(old_cluster_pgdata);
for (tblnum = 0; tblnum < os_info.num_old_tablespaces; tblnum++)
{
char old_tablespace_dir[MAXPGPATH];
strlcpy(old_tablespace_dir, os_info.old_tablespaces[tblnum], MAXPGPATH);
canonicalize_path(old_tablespace_dir);
if (path_is_prefix_of_path(old_cluster_pgdata, old_tablespace_dir))
@ -649,7 +647,7 @@ create_script_for_old_cluster_deletion(char **deletion_script_file_name)
/* remove PG_VERSION? */
if (GET_MAJOR_VERSION(old_cluster.major_version) <= 804)
fprintf(script, RM_CMD " %s%s%cPG_VERSION\n",
fix_path_separator(os_info.old_tablespaces[tblnum]),
fix_path_separator(os_info.old_tablespaces[tblnum]),
fix_path_separator(old_cluster.tablespace_suffix),
PATH_SEPARATOR);
@ -668,7 +666,7 @@ create_script_for_old_cluster_deletion(char **deletion_script_file_name)
* or a version-specific subdirectory.
*/
fprintf(script, RMDIR_CMD " %s%s\n",
fix_path_separator(os_info.old_tablespaces[tblnum]),
fix_path_separator(os_info.old_tablespaces[tblnum]),
fix_path_separator(old_cluster.tablespace_suffix));
}
@ -997,7 +995,7 @@ get_canonical_locale_name(int category, const char *locale)
save = setlocale(category, NULL);
if (!save)
pg_log(PG_FATAL, "failed to get the current locale\n");
pg_log(PG_FATAL, "failed to get the current locale\n");
/* 'save' may be pointing at a modifiable scratch variable, so copy it. */
save = pg_strdup(save);
@ -1006,13 +1004,13 @@ get_canonical_locale_name(int category, const char *locale)
res = setlocale(category, locale);
if (!res)
pg_log(PG_FATAL, "failed to get system local name for \"%s\"\n", res);
pg_log(PG_FATAL, "failed to get system local name for \"%s\"\n", res);
res = pg_strdup(res);
/* restore old value. */
if (!setlocale(category, save))
pg_log(PG_FATAL, "failed to restore old locale \"%s\"\n", save);
pg_log(PG_FATAL, "failed to restore old locale \"%s\"\n", save);
pg_free(save);