Wouldn't it be better to comment it like any other function?
Sure. Attached.
--
Fabien.
diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c
index 9a00499510..00e5bf290b 100644
--- a/src/bin/psql/common.c
+++ b/src/bin/psql/common.c
@@ -523,6 +523,18 @@ PrintTiming(double elapsed_msec)
elapsed_msec, days, (int) hours, (int) minutes, seconds);
}
+/*
+ * Echo user query
+ */
+static void
+echoQuery(FILE *out, const char *query)
+{
+ fprintf(out,
+ _("********* QUERY **********\n"
+ "%s\n"
+ "**************************\n\n"), query);
+ fflush(out);
+}
/*
* PSQLexec
@@ -549,18 +561,9 @@ PSQLexec(const char *query)
if (pset.echo_hidden != PSQL_ECHO_HIDDEN_OFF)
{
- printf(_("********* QUERY **********\n"
- "%s\n"
- "**************************\n\n"), query);
- fflush(stdout);
+ echoQuery(stdout, query);
if (pset.logfile)
- {
- fprintf(pset.logfile,
- _("********* QUERY **********\n"
- "%s\n"
- "**************************\n\n"), query);
- fflush(pset.logfile);
- }
+ echoQuery(pset.logfile, query);
if (pset.echo_hidden == PSQL_ECHO_HIDDEN_NOEXEC)
return NULL;
@@ -1226,13 +1229,7 @@ SendQuery(const char *query)
}
if (pset.logfile)
- {
- fprintf(pset.logfile,
- _("********* QUERY **********\n"
- "%s\n"
- "**************************\n\n"), query);
- fflush(pset.logfile);
- }
+ echoQuery(pset.logfile, query);
SetCancelConn(pset.db);