diff options
| author | Bruce Momjian <bruce@momjian.us> | 2011-06-09 14:32:50 -0400 |
|---|---|---|
| committer | Bruce Momjian <bruce@momjian.us> | 2011-06-09 14:32:50 -0400 |
| commit | 6560407c7db2c7e32926a46f5fb52175ac10d9e5 (patch) | |
| tree | 9641e538893819410634624a8e0cb86a13d857a6 /contrib | |
| parent | adf43b2b36ca3d7f988933990051c74a4bd0d6f8 (diff) | |
| download | postgresql-6560407c7db2c7e32926a46f5fb52175ac10d9e5.tar.gz | |
Pgindent run before 9.1 beta2.
Diffstat (limited to 'contrib')
| -rw-r--r-- | contrib/btree_gist/btree_utils_var.h | 12 | ||||
| -rw-r--r-- | contrib/pg_standby/pg_standby.c | 2 | ||||
| -rw-r--r-- | contrib/pg_upgrade/check.c | 11 | ||||
| -rw-r--r-- | contrib/pg_upgrade/controldata.c | 4 | ||||
| -rw-r--r-- | contrib/pg_upgrade/exec.c | 21 | ||||
| -rw-r--r-- | contrib/pg_upgrade/option.c | 1 | ||||
| -rw-r--r-- | contrib/pg_upgrade/pg_upgrade.h | 2 | ||||
| -rw-r--r-- | contrib/pg_upgrade/server.c | 37 | ||||
| -rw-r--r-- | contrib/pg_upgrade/util.c | 1 |
9 files changed, 49 insertions, 42 deletions
diff --git a/contrib/btree_gist/btree_utils_var.h b/contrib/btree_gist/btree_utils_var.h index fe91d122e6..57d10e80f1 100644 --- a/contrib/btree_gist/btree_utils_var.h +++ b/contrib/btree_gist/btree_utils_var.h @@ -33,12 +33,12 @@ typedef struct /* Methods */ - bool (*f_gt) (const void *, const void *, Oid); /* greater than */ - bool (*f_ge) (const void *, const void *, Oid); /* greater equal */ - bool (*f_eq) (const void *, const void *, Oid); /* equal */ - bool (*f_le) (const void *, const void *, Oid); /* less equal */ - bool (*f_lt) (const void *, const void *, Oid); /* less than */ - int32 (*f_cmp) (const void *, const void *, Oid); /* compare */ + bool (*f_gt) (const void *, const void *, Oid); /* greater than */ + bool (*f_ge) (const void *, const void *, Oid); /* greater equal */ + bool (*f_eq) (const void *, const void *, Oid); /* equal */ + bool (*f_le) (const void *, const void *, Oid); /* less equal */ + bool (*f_lt) (const void *, const void *, Oid); /* less than */ + int32 (*f_cmp) (const void *, const void *, Oid); /* compare */ GBT_VARKEY *(*f_l2n) (GBT_VARKEY *); /* convert leaf to node */ } gbtree_vinfo; diff --git a/contrib/pg_standby/pg_standby.c b/contrib/pg_standby/pg_standby.c index 281d5892ee..d2e0d582f2 100644 --- a/contrib/pg_standby/pg_standby.c +++ b/contrib/pg_standby/pg_standby.c @@ -533,7 +533,7 @@ usage(void) "Main intended use as restore_command in recovery.conf:\n" " restore_command = 'pg_standby [OPTION]... ARCHIVELOCATION %%f %%p %%r'\n" "e.g.\n" - " restore_command = 'pg_standby /mnt/server/archiverdir %%f %%p %%r'\n"); + " restore_command = 'pg_standby /mnt/server/archiverdir %%f %%p %%r'\n"); printf("\nReport bugs to <pgsql-bugs@postgresql.org>.\n"); } diff --git a/contrib/pg_upgrade/check.c b/contrib/pg_upgrade/check.c index 60c1fbbf97..fdec6e34af 100644 --- a/contrib/pg_upgrade/check.c +++ b/contrib/pg_upgrade/check.c @@ -362,7 +362,7 @@ check_new_cluster_is_empty(void) /* pg_largeobject and its index should be skipped */ if (strcmp(rel_arr->rels[relnum].nspname, "pg_catalog") != 0) pg_log(PG_FATAL, "New cluster database \"%s\" is not empty\n", - new_cluster.dbarr.dbs[dbnum].db_name); + new_cluster.dbarr.dbs[dbnum].db_name); } } @@ -381,17 +381,18 @@ check_new_cluster_is_empty(void) static void check_old_cluster_has_new_cluster_dbs(void) { - int old_dbnum, new_dbnum; + int old_dbnum, + new_dbnum; for (new_dbnum = 0; new_dbnum < new_cluster.dbarr.ndbs; new_dbnum++) { for (old_dbnum = 0; old_dbnum < old_cluster.dbarr.ndbs; old_dbnum++) if (strcmp(old_cluster.dbarr.dbs[old_dbnum].db_name, - new_cluster.dbarr.dbs[new_dbnum].db_name) == 0) + new_cluster.dbarr.dbs[new_dbnum].db_name) == 0) break; if (old_dbnum == old_cluster.dbarr.ndbs) pg_log(PG_FATAL, "New cluster database \"%s\" does not exist in the old cluster\n", - new_cluster.dbarr.dbs[new_dbnum].db_name); + new_cluster.dbarr.dbs[new_dbnum].db_name); } } @@ -495,7 +496,7 @@ check_is_super_user(ClusterInfo *cluster) if (PQntuples(res) != 1 || strcmp(PQgetvalue(res, 0, 0), "t") != 0) pg_log(PG_FATAL, "database user \"%s\" is not a superuser\n", - os_info.user); + os_info.user); PQclear(res); diff --git a/contrib/pg_upgrade/controldata.c b/contrib/pg_upgrade/controldata.c index c282ec2452..25ee81f2a0 100644 --- a/contrib/pg_upgrade/controldata.c +++ b/contrib/pg_upgrade/controldata.c @@ -90,10 +90,10 @@ get_control_data(ClusterInfo *cluster, bool live_check) pg_putenv("LC_TIME", NULL); pg_putenv("LANG", #ifndef WIN32 - NULL); + NULL); #else /* On Windows the default locale cannot be English, so force it */ - "en"); + "en"); #endif pg_putenv("LANGUAGE", NULL); pg_putenv("LC_ALL", NULL); diff --git a/contrib/pg_upgrade/exec.c b/contrib/pg_upgrade/exec.c index 93c923c556..b7d82663ff 100644 --- a/contrib/pg_upgrade/exec.c +++ b/contrib/pg_upgrade/exec.c @@ -99,16 +99,17 @@ verify_directories(void) if (access(".", R_OK | W_OK #ifndef WIN32 + /* - * Do a directory execute check only on Unix because execute permission - * on NTFS means "can execute scripts", which we don't care about. - * Also, X_OK is not defined in the Windows API. + * Do a directory execute check only on Unix because execute permission on + * NTFS means "can execute scripts", which we don't care about. Also, X_OK + * is not defined in the Windows API. */ - | X_OK + | X_OK #endif - ) != 0) + ) != 0) pg_log(PG_FATAL, - "You must have read and write access in the current directory.\n"); + "You must have read and write access in the current directory.\n"); check_bin_dir(&old_cluster); check_data_dir(old_cluster.pgdata); @@ -132,16 +133,18 @@ check_data_dir(const char *pg_data) { char subDirName[MAXPGPATH]; int subdirnum; + /* start check with top-most directory */ const char *requiredSubdirs[] = {"", "base", "global", "pg_clog", "pg_multixact", "pg_subtrans", "pg_tblspc", "pg_twophase", - "pg_xlog"}; + "pg_xlog"}; for (subdirnum = 0; subdirnum < sizeof(requiredSubdirs) / sizeof(requiredSubdirs[0]); ++subdirnum) { struct stat statBuf; + snprintf(subDirName, sizeof(subDirName), "%s/%s", pg_data, requiredSubdirs[subdirnum]); @@ -173,8 +176,8 @@ check_bin_dir(ClusterInfo *cluster) report_status(PG_FATAL, "check for %s failed: %s\n", cluster->bindir, getErrorText(errno)); else if (!S_ISDIR(statBuf.st_mode)) - report_status(PG_FATAL, "%s is not a directory\n", - cluster->bindir); + report_status(PG_FATAL, "%s is not a directory\n", + cluster->bindir); validate_exec(cluster->bindir, "postgres"); validate_exec(cluster->bindir, "pg_ctl"); diff --git a/contrib/pg_upgrade/option.c b/contrib/pg_upgrade/option.c index e545458a75..abb74a5bfa 100644 --- a/contrib/pg_upgrade/option.c +++ b/contrib/pg_upgrade/option.c @@ -158,6 +158,7 @@ parseCommandLine(int argc, char *argv[]) case 'u': pg_free(os_info.user); os_info.user = pg_strdup(optarg); + /* * Push the user name into the environment so pre-9.1 * pg_ctl/libpq uses it. diff --git a/contrib/pg_upgrade/pg_upgrade.h b/contrib/pg_upgrade/pg_upgrade.h index 1f31daecfe..a3a0856309 100644 --- a/contrib/pg_upgrade/pg_upgrade.h +++ b/contrib/pg_upgrade/pg_upgrade.h @@ -378,7 +378,7 @@ void *pg_malloc(int size); void pg_free(void *ptr); const char *getErrorText(int errNum); unsigned int str2uint(const char *str); -void pg_putenv(const char *var, const char *val); +void pg_putenv(const char *var, const char *val); /* version.c */ diff --git a/contrib/pg_upgrade/server.c b/contrib/pg_upgrade/server.c index 839f39f572..58c1234a94 100644 --- a/contrib/pg_upgrade/server.c +++ b/contrib/pg_upgrade/server.c @@ -52,8 +52,8 @@ get_db_conn(ClusterInfo *cluster, const char *db_name) char conn_opts[MAXPGPATH]; snprintf(conn_opts, sizeof(conn_opts), - "dbname = '%s' user = '%s' port = %d", db_name, os_info.user, - cluster->port); + "dbname = '%s' user = '%s' port = %d", db_name, os_info.user, + cluster->port); return PQconnectdb(conn_opts); } @@ -146,16 +146,18 @@ start_postmaster(ClusterInfo *cluster) PGconn *conn; bool exit_hook_registered = false; int pg_ctl_return = 0; + #ifndef WIN32 - char *output_filename = log_opts.filename; + char *output_filename = log_opts.filename; #else + /* * On Win32, we can't send both pg_upgrade output and pg_ctl output to the * same file because we get the error: "The process cannot access the file * because it is being used by another process." so we have to send all * other output to 'nul'. */ - char *output_filename = DEVNULL; + char *output_filename = DEVNULL; #endif if (!exit_hook_registered) @@ -180,13 +182,13 @@ start_postmaster(ClusterInfo *cluster) "-o \"-p %d %s\" start >> \"%s\" 2>&1" SYSTEMQUOTE, cluster->bindir, output_filename, cluster->pgdata, cluster->port, (cluster->controldata.cat_ver >= - BINARY_UPGRADE_SERVER_FLAG_CAT_VER) ? "-b" : - "-c autovacuum=off -c autovacuum_freeze_max_age=2000000000", + BINARY_UPGRADE_SERVER_FLAG_CAT_VER) ? "-b" : + "-c autovacuum=off -c autovacuum_freeze_max_age=2000000000", log_opts.filename); /* - * Don't throw an error right away, let connecting throw the error - * because it might supply a reason for the failure. + * Don't throw an error right away, let connecting throw the error because + * it might supply a reason for the failure. */ pg_ctl_return = exec_prog(false, "%s", cmd); @@ -196,7 +198,7 @@ start_postmaster(ClusterInfo *cluster) { pg_log(PG_REPORT, "\nconnection to database failed: %s\n", PQerrorMessage(conn)); - if (conn) + if (conn) PQfinish(conn); pg_log(PG_FATAL, "unable to connect to %s postmaster started with the command: %s\n", CLUSTER_NAME(cluster), cmd); @@ -206,8 +208,8 @@ start_postmaster(ClusterInfo *cluster) /* If the connection didn't fail, fail now */ if (pg_ctl_return != 0) pg_log(PG_FATAL, "pg_ctl failed to start the %s server\n", - CLUSTER_NAME(cluster)); - + CLUSTER_NAME(cluster)); + os_info.running_cluster = cluster; } @@ -218,11 +220,12 @@ stop_postmaster(bool fast) char cmd[MAXPGPATH]; const char *bindir; const char *datadir; + #ifndef WIN32 - char *output_filename = log_opts.filename; + char *output_filename = log_opts.filename; #else /* See comment in start_postmaster() about why win32 output is ignored. */ - char *output_filename = DEVNULL; + char *output_filename = DEVNULL; #endif if (os_info.running_cluster == &old_cluster) @@ -268,17 +271,17 @@ check_pghost_envvar(void) for (option = start; option->keyword != NULL; option++) { if (option->envvar && (strcmp(option->envvar, "PGHOST") == 0 || - strcmp(option->envvar, "PGHOSTADDR") == 0)) + strcmp(option->envvar, "PGHOSTADDR") == 0)) { const char *value = getenv(option->envvar); if (value && strlen(value) > 0 && - /* check for 'local' host values */ + /* check for 'local' host values */ (strcmp(value, "localhost") != 0 && strcmp(value, "127.0.0.1") != 0 && strcmp(value, "::1") != 0 && value[0] != '/')) pg_log(PG_FATAL, - "libpq environment variable %s has a non-local server value: %s\n", - option->envvar, value); + "libpq environment variable %s has a non-local server value: %s\n", + option->envvar, value); } } diff --git a/contrib/pg_upgrade/util.c b/contrib/pg_upgrade/util.c index 4094895f46..f6582f5e38 100644 --- a/contrib/pg_upgrade/util.c +++ b/contrib/pg_upgrade/util.c @@ -281,4 +281,3 @@ pg_putenv(const char *var, const char *val) #endif } } - |
