summaryrefslogtreecommitdiff
path: root/src/backend/utils/misc/ps_status.c
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/backend/utils/misc/ps_status.c
parentf669c09989bda894d6ba01634ccb229f0687c08a (diff)
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/backend/utils/misc/ps_status.c')
-rw-r--r--src/backend/utils/misc/ps_status.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/backend/utils/misc/ps_status.c b/src/backend/utils/misc/ps_status.c
index 4007a17800c..5742de0802a 100644
--- a/src/backend/utils/misc/ps_status.c
+++ b/src/backend/utils/misc/ps_status.c
@@ -93,11 +93,11 @@ static const size_t ps_buffer_size = PS_BUFFER_SIZE;
static char *ps_buffer; /* will point to argv area */
static size_t ps_buffer_size; /* space determined at run time */
static size_t last_status_len; /* use to minimize length of clobber */
-#endif /* PS_USE_CLOBBER_ARGV */
+#endif /* PS_USE_CLOBBER_ARGV */
static size_t ps_buffer_cur_len; /* nominal strlen(ps_buffer) */
-static size_t ps_buffer_fixed_size; /* size of the constant prefix */
+static size_t ps_buffer_fixed_size; /* size of the constant prefix */
/* save the original argv[] location here */
static int save_argc;
@@ -183,7 +183,7 @@ save_ps_display_args(int argc, char **argv)
new_environ[i] = NULL;
environ = new_environ;
}
-#endif /* PS_USE_CLOBBER_ARGV */
+#endif /* PS_USE_CLOBBER_ARGV */
#if defined(PS_USE_CHANGE_ARGV) || defined(PS_USE_CLOBBER_ARGV)
@@ -231,7 +231,7 @@ save_ps_display_args(int argc, char **argv)
argv = new_argv;
}
-#endif /* PS_USE_CHANGE_ARGV or PS_USE_CLOBBER_ARGV */
+#endif /* PS_USE_CHANGE_ARGV or PS_USE_CLOBBER_ARGV */
return argv;
}
@@ -270,7 +270,7 @@ init_ps_display(const char *username, const char *dbname,
#ifdef PS_USE_CHANGE_ARGV
save_argv[0] = ps_buffer;
save_argv[1] = NULL;
-#endif /* PS_USE_CHANGE_ARGV */
+#endif /* PS_USE_CHANGE_ARGV */
#ifdef PS_USE_CLOBBER_ARGV
{
@@ -280,7 +280,7 @@ init_ps_display(const char *username, const char *dbname,
for (i = 1; i < save_argc; i++)
save_argv[i] = ps_buffer + ps_buffer_size;
}
-#endif /* PS_USE_CLOBBER_ARGV */
+#endif /* PS_USE_CLOBBER_ARGV */
/*
* Make fixed prefix of ps display.
@@ -313,7 +313,7 @@ init_ps_display(const char *username, const char *dbname,
ps_buffer_cur_len = ps_buffer_fixed_size = strlen(ps_buffer);
set_ps_display(initial_str, true);
-#endif /* not PS_USE_NONE */
+#endif /* not PS_USE_NONE */
}
@@ -358,12 +358,12 @@ set_ps_display(const char *activity, bool force)
pst.pst_command = ps_buffer;
pstat(PSTAT_SETCMD, pst, ps_buffer_cur_len, 0, 0);
}
-#endif /* PS_USE_PSTAT */
+#endif /* PS_USE_PSTAT */
#ifdef PS_USE_PS_STRINGS
PS_STRINGS->ps_nargvstr = 1;
PS_STRINGS->ps_argvstr = ps_buffer;
-#endif /* PS_USE_PS_STRINGS */
+#endif /* PS_USE_PS_STRINGS */
#ifdef PS_USE_CLOBBER_ARGV
/* pad unused memory; need only clobber remainder of old status string */
@@ -371,7 +371,7 @@ set_ps_display(const char *activity, bool force)
MemSet(ps_buffer + ps_buffer_cur_len, PS_PADDING,
last_status_len - ps_buffer_cur_len);
last_status_len = ps_buffer_cur_len;
-#endif /* PS_USE_CLOBBER_ARGV */
+#endif /* PS_USE_CLOBBER_ARGV */
#ifdef PS_USE_WIN32
{
@@ -390,8 +390,8 @@ set_ps_display(const char *activity, bool force)
ident_handle = CreateEvent(NULL, TRUE, FALSE, name);
}
-#endif /* PS_USE_WIN32 */
-#endif /* not PS_USE_NONE */
+#endif /* PS_USE_WIN32 */
+#endif /* not PS_USE_NONE */
}