summaryrefslogtreecommitdiff
path: root/src/bin/psql
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2017-06-21 15:18:54 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2017-06-21 15:19:25 -0400
commitc7b8998ebbf310a156aa38022555a24d98fdbfb4 (patch)
treee85979fb1213a731b7b557f8a830df541f26b135 /src/bin/psql
parentf669c09989bda894d6ba01634ccb229f0687c08a (diff)
downloadpostgresql-c7b8998ebbf310a156aa38022555a24d98fdbfb4.tar.gz
Phase 2 of pgindent updates.
Change pg_bsd_indent to follow upstream rules for placement of comments to the right of code, and remove pgindent hack that caused comments following #endif to not obey the general rule. Commit e3860ffa4dd0dad0dd9eea4be9cc1412373a8c89 wasn't actually using the published version of pg_bsd_indent, but a hacked-up version that tried to minimize the amount of movement of comments to the right of code. The situation of interest is where such a comment has to be moved to the right of its default placement at column 33 because there's code there. BSD indent has always moved right in units of tab stops in such cases --- but in the previous incarnation, indent was working in 8-space tab stops, while now it knows we use 4-space tabs. So the net result is that in about half the cases, such comments are placed one tab stop left of before. This is better all around: it leaves more room on the line for comment text, and it means that in such cases the comment uniformly starts at the next 4-space tab stop after the code, rather than sometimes one and sometimes two tabs after. Also, ensure that comments following #endif are indented the same as comments following other preprocessor commands such as #else. That inconsistency turns out to have been self-inflicted damage from a poorly-thought-through post-indent "fixup" in pgindent. This patch is much less interesting than the first round of indent changes, but also bulkier, so I thought it best to separate the effects. Discussion: https://postgr.es/m/E1dAmxK-0006EE-1r@gemulon.postgresql.org Discussion: https://postgr.es/m/30527.1495162840@sss.pgh.pa.us
Diffstat (limited to 'src/bin/psql')
-rw-r--r--src/bin/psql/command.c2
-rw-r--r--src/bin/psql/command.h2
-rw-r--r--src/bin/psql/common.c2
-rw-r--r--src/bin/psql/common.h2
-rw-r--r--src/bin/psql/conditional.h2
-rw-r--r--src/bin/psql/copy.c2
-rw-r--r--src/bin/psql/crosstabview.h2
-rw-r--r--src/bin/psql/describe.c2
-rw-r--r--src/bin/psql/describe.h2
-rw-r--r--src/bin/psql/help.c2
-rw-r--r--src/bin/psql/input.c2
-rw-r--r--src/bin/psql/input.h6
-rw-r--r--src/bin/psql/large_obj.h2
-rw-r--r--src/bin/psql/mainloop.c2
-rw-r--r--src/bin/psql/mainloop.h2
-rw-r--r--src/bin/psql/prompt.c2
-rw-r--r--src/bin/psql/prompt.h2
-rw-r--r--src/bin/psql/settings.h2
-rw-r--r--src/bin/psql/startup.c2
-rw-r--r--src/bin/psql/stringutils.h2
-rw-r--r--src/bin/psql/tab-complete.c16
-rw-r--r--src/bin/psql/tab-complete.h2
-rw-r--r--src/bin/psql/variables.c2
-rw-r--r--src/bin/psql/variables.h2
24 files changed, 33 insertions, 33 deletions
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index b3263a9570..7faf5bc582 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -563,7 +563,7 @@ exec_command_cd(PsqlScanState scan_state, bool active_branch, const char *cmd)
* directory, so if someone wants to code this here instead...
*/
dir = "/";
-#endif /* WIN32 */
+#endif /* WIN32 */
}
if (chdir(dir) == -1)
diff --git a/src/bin/psql/command.h b/src/bin/psql/command.h
index e8ea8473e8..7aedd0d625 100644
--- a/src/bin/psql/command.h
+++ b/src/bin/psql/command.h
@@ -43,4 +43,4 @@ extern void SyncVariables(void);
extern void UnsyncVariables(void);
-#endif /* COMMAND_H */
+#endif /* COMMAND_H */
diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c
index a2f1259c1e..044cdb82a7 100644
--- a/src/bin/psql/common.c
+++ b/src/bin/psql/common.c
@@ -377,7 +377,7 @@ setup_cancel_handler(void)
SetConsoleCtrlHandler(consoleHandler, TRUE);
}
-#endif /* WIN32 */
+#endif /* WIN32 */
/* ConnectionUp
diff --git a/src/bin/psql/common.h b/src/bin/psql/common.h
index 1ceb8ae386..f34868b54e 100644
--- a/src/bin/psql/common.h
+++ b/src/bin/psql/common.h
@@ -46,4 +46,4 @@ extern void expand_tilde(char **filename);
extern bool recognized_connection_string(const char *connstr);
-#endif /* COMMON_H */
+#endif /* COMMON_H */
diff --git a/src/bin/psql/conditional.h b/src/bin/psql/conditional.h
index 00fbe90ed0..0957627742 100644
--- a/src/bin/psql/conditional.h
+++ b/src/bin/psql/conditional.h
@@ -80,4 +80,4 @@ extern void conditional_stack_set_paren_depth(ConditionalStack cstack, int depth
extern int conditional_stack_get_paren_depth(ConditionalStack cstack);
-#endif /* CONDITIONAL_H */
+#endif /* CONDITIONAL_H */
diff --git a/src/bin/psql/copy.c b/src/bin/psql/copy.c
index 12a50d215c..cd2e656911 100644
--- a/src/bin/psql/copy.c
+++ b/src/bin/psql/copy.c
@@ -102,7 +102,7 @@ parse_slash_copy(const char *args)
result = pg_malloc0(sizeof(struct copy_options));
- result->before_tofrom = pg_strdup(""); /* initialize for appending */
+ result->before_tofrom = pg_strdup(""); /* initialize for appending */
token = strtokx(args, whitespace, ".,()", "\"",
0, false, false, pset.encoding);
diff --git a/src/bin/psql/crosstabview.h b/src/bin/psql/crosstabview.h
index 97c72a5139..ad63ddef50 100644
--- a/src/bin/psql/crosstabview.h
+++ b/src/bin/psql/crosstabview.h
@@ -24,4 +24,4 @@
/* prototypes */
extern bool PrintResultsInCrosstab(const PGresult *res);
-#endif /* CROSSTABVIEW_H */
+#endif /* CROSSTABVIEW_H */
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 83c133534c..17bfedb433 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3391,7 +3391,7 @@ listTables(const char *tabtypes, const char *pattern, bool verbose, bool showSys
if (showSeq)
appendPQExpBufferStr(&buf, CppAsString2(RELKIND_SEQUENCE) ",");
if (showSystem || pattern)
- appendPQExpBufferStr(&buf, "'s',"); /* was RELKIND_SPECIAL */
+ appendPQExpBufferStr(&buf, "'s',"); /* was RELKIND_SPECIAL */
if (showForeign)
appendPQExpBufferStr(&buf, CppAsString2(RELKIND_FOREIGN_TABLE) ",");
diff --git a/src/bin/psql/describe.h b/src/bin/psql/describe.h
index b05d6bb976..14a5667f3e 100644
--- a/src/bin/psql/describe.h
+++ b/src/bin/psql/describe.h
@@ -111,4 +111,4 @@ bool describePublications(const char *pattern);
/* \dRs */
bool describeSubscriptions(const char *pattern, bool verbose);
-#endif /* DESCRIBE_H */
+#endif /* DESCRIBE_H */
diff --git a/src/bin/psql/help.c b/src/bin/psql/help.c
index f097b06594..f6acf87197 100644
--- a/src/bin/psql/help.c
+++ b/src/bin/psql/help.c
@@ -515,7 +515,7 @@ helpSQL(const char *topic, unsigned short int pager)
while (topic[j] != ' ' && j++ <= len)
wordlen++;
}
- if (wordlen >= len) /* Don't try again if the same word */
+ if (wordlen >= len) /* Don't try again if the same word */
{
if (!output)
output = PageOutput(nl_count, pager ? &(pset.popt.topt) : NULL);
diff --git a/src/bin/psql/input.c b/src/bin/psql/input.c
index b8c9a00b09..62f5f77383 100644
--- a/src/bin/psql/input.c
+++ b/src/bin/psql/input.c
@@ -333,7 +333,7 @@ decode_history(void)
}
END_ITERATE_HISTORY();
}
-#endif /* USE_READLINE */
+#endif /* USE_READLINE */
/*
diff --git a/src/bin/psql/input.h b/src/bin/psql/input.h
index f40561459d..35886dae22 100644
--- a/src/bin/psql/input.h
+++ b/src/bin/psql/input.h
@@ -32,8 +32,8 @@
#if defined(HAVE_HISTORY_H)
#include <history.h>
#endif
-#endif /* HAVE_READLINE_READLINE_H, etc */
-#endif /* HAVE_LIBREADLINE */
+#endif /* HAVE_READLINE_READLINE_H, etc */
+#endif /* HAVE_LIBREADLINE */
#include "pqexpbuffer.h"
@@ -48,4 +48,4 @@ extern bool printHistory(const char *fname, unsigned short int pager);
extern void pg_append_history(const char *s, PQExpBuffer history_buf);
extern void pg_send_history(PQExpBuffer history_buf);
-#endif /* INPUT_H */
+#endif /* INPUT_H */
diff --git a/src/bin/psql/large_obj.h b/src/bin/psql/large_obj.h
index 7d74d5fdb7..5750b5d9cc 100644
--- a/src/bin/psql/large_obj.h
+++ b/src/bin/psql/large_obj.h
@@ -13,4 +13,4 @@ bool do_lo_import(const char *filename_arg, const char *comment_arg);
bool do_lo_unlink(const char *loid_arg);
bool do_lo_list(void);
-#endif /* LARGE_OBJ_H */
+#endif /* LARGE_OBJ_H */
diff --git a/src/bin/psql/mainloop.c b/src/bin/psql/mainloop.c
index 67e922fa94..e35b907764 100644
--- a/src/bin/psql/mainloop.c
+++ b/src/bin/psql/mainloop.c
@@ -36,7 +36,7 @@ MainLoop(FILE *source)
{
PsqlScanState scan_state; /* lexer working state */
ConditionalStack cond_stack; /* \if status stack */
- volatile PQExpBuffer query_buf; /* buffer for query being accumulated */
+ volatile PQExpBuffer query_buf; /* buffer for query being accumulated */
volatile PQExpBuffer previous_buf; /* if there isn't anything in the new
* buffer yet, use this one for \e,
* etc. */
diff --git a/src/bin/psql/mainloop.h b/src/bin/psql/mainloop.h
index 228a5e085e..8ef8cc1bd6 100644
--- a/src/bin/psql/mainloop.h
+++ b/src/bin/psql/mainloop.h
@@ -14,4 +14,4 @@ extern const PsqlScanCallbacks psqlscan_callbacks;
extern int MainLoop(FILE *source);
-#endif /* MAINLOOP_H */
+#endif /* MAINLOOP_H */
diff --git a/src/bin/psql/prompt.c b/src/bin/psql/prompt.c
index e502ff3f6e..913b23e4cd 100644
--- a/src/bin/psql/prompt.c
+++ b/src/bin/psql/prompt.c
@@ -310,7 +310,7 @@ get_prompt(promptStatus_t status, ConditionalStack cstack)
*/
buf[0] = (*p == '[') ? RL_PROMPT_START_IGNORE : RL_PROMPT_END_IGNORE;
buf[1] = '\0';
-#endif /* USE_READLINE */
+#endif /* USE_READLINE */
break;
default:
diff --git a/src/bin/psql/prompt.h b/src/bin/psql/prompt.h
index b3d2d98fd7..a7a95effb4 100644
--- a/src/bin/psql/prompt.h
+++ b/src/bin/psql/prompt.h
@@ -14,4 +14,4 @@
char *get_prompt(promptStatus_t status, ConditionalStack cstack);
-#endif /* PROMPT_H */
+#endif /* PROMPT_H */
diff --git a/src/bin/psql/settings.h b/src/bin/psql/settings.h
index 70ff1812c8..b78f151acd 100644
--- a/src/bin/psql/settings.h
+++ b/src/bin/psql/settings.h
@@ -86,7 +86,7 @@ typedef struct _psqlSettings
FILE *copyStream; /* Stream to read/write for \copy command */
- PGresult *last_error_result; /* most recent error result, if any */
+ PGresult *last_error_result; /* most recent error result, if any */
printQueryOpt popt;
diff --git a/src/bin/psql/startup.c b/src/bin/psql/startup.c
index 751ef913f0..7f767976a5 100644
--- a/src/bin/psql/startup.c
+++ b/src/bin/psql/startup.c
@@ -12,7 +12,7 @@
#else /* WIN32 */
#include <io.h>
#include <win32.h>
-#endif /* WIN32 */
+#endif /* WIN32 */
#include "getopt_long.h"
diff --git a/src/bin/psql/stringutils.h b/src/bin/psql/stringutils.h
index 360ee030a1..213473f919 100644
--- a/src/bin/psql/stringutils.h
+++ b/src/bin/psql/stringutils.h
@@ -24,4 +24,4 @@ extern void strip_quotes(char *source, char quote, char escape, int encoding);
extern char *quote_if_needed(const char *source, const char *entails_quote,
char quote, char escape, int encoding);
-#endif /* STRINGUTILS_H */
+#endif /* STRINGUTILS_H */
diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index 4ef8ed4735..20c41b7ce5 100644
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -131,8 +131,8 @@ static int completion_max_records;
*/
static const char *completion_charp; /* to pass a string */
static const char *const *completion_charpp; /* to pass a list of strings */
-static const char *completion_info_charp; /* to pass a second string */
-static const char *completion_info_charp2; /* to pass a third string */
+static const char *completion_info_charp; /* to pass a second string */
+static const char *completion_info_charp2; /* to pass a third string */
static const SchemaQuery *completion_squery; /* to pass a SchemaQuery */
static bool completion_case_sensitive; /* completion is case sensitive */
@@ -1043,8 +1043,8 @@ static const pgsql_thing_t words_after_create[] = {
{"SYSTEM", NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
- {"TEMP", NULL, NULL, THING_NO_DROP | THING_NO_ALTER}, /* for CREATE TEMP TABLE
- * ... */
+ {"TEMP", NULL, NULL, THING_NO_DROP | THING_NO_ALTER}, /* for CREATE TEMP TABLE
+ * ... */
{"TEMPLATE", Query_for_list_of_ts_templates, NULL, THING_NO_SHOW},
{"TEMPORARY", NULL, NULL, THING_NO_DROP | THING_NO_ALTER}, /* for CREATE TEMPORARY
* TABLE ... */
@@ -1052,8 +1052,8 @@ static const pgsql_thing_t words_after_create[] = {
{"TRANSFORM", NULL, NULL},
{"TRIGGER", "SELECT pg_catalog.quote_ident(tgname) FROM pg_catalog.pg_trigger WHERE substring(pg_catalog.quote_ident(tgname),1,%d)='%s' AND NOT tgisinternal"},
{"TYPE", NULL, &Query_for_list_of_datatypes},
- {"UNIQUE", NULL, NULL, THING_NO_DROP | THING_NO_ALTER}, /* for CREATE UNIQUE
- * INDEX ... */
+ {"UNIQUE", NULL, NULL, THING_NO_DROP | THING_NO_ALTER}, /* for CREATE UNIQUE
+ * INDEX ... */
{"UNLOGGED", NULL, NULL, THING_NO_DROP | THING_NO_ALTER}, /* for CREATE UNLOGGED
* TABLE ... */
{"USER", Query_for_list_of_roles},
@@ -4422,6 +4422,6 @@ dequote_file_name(char *text, char quote_char)
return s;
}
-#endif /* NOT_USED */
+#endif /* NOT_USED */
-#endif /* USE_READLINE */
+#endif /* USE_READLINE */
diff --git a/src/bin/psql/tab-complete.h b/src/bin/psql/tab-complete.h
index 9c0309dc1e..1a42ef1c66 100644
--- a/src/bin/psql/tab-complete.h
+++ b/src/bin/psql/tab-complete.h
@@ -14,4 +14,4 @@ extern PQExpBuffer tab_completion_query_buf;
extern void initialize_readline(void);
-#endif /* TAB_COMPLETE_H */
+#endif /* TAB_COMPLETE_H */
diff --git a/src/bin/psql/variables.c b/src/bin/psql/variables.c
index d9d07631a5..806d39bfbe 100644
--- a/src/bin/psql/variables.c
+++ b/src/bin/psql/variables.c
@@ -273,7 +273,7 @@ SetVariable(VariableSpace space, const char *name, const char *value)
}
}
else if (new_value)
- pg_free(new_value); /* current->value is left unchanged */
+ pg_free(new_value); /* current->value is left unchanged */
return confirmed;
}
diff --git a/src/bin/psql/variables.h b/src/bin/psql/variables.h
index 19257937c7..02d85b1bc2 100644
--- a/src/bin/psql/variables.h
+++ b/src/bin/psql/variables.h
@@ -93,4 +93,4 @@ void SetVariableHooks(VariableSpace space, const char *name,
void PsqlVarEnumError(const char *name, const char *value, const char *suggestions);
-#endif /* VARIABLES_H */
+#endif /* VARIABLES_H */