summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane2006-12-24 19:14:41 +0000
committerTom Lane2006-12-24 19:14:41 +0000
commitfd3cadd683325bbb40010fa7c874be87a06c1e6f (patch)
tree94aa0133e77f4e24697ccf26a8fe2ca243edb87d
parentcb68aac46fdfb99d8b8ae085adde8aaadf07e7be (diff)
Make HISTCONTROL=ignoredups work again (broken by misordering of
operations during recent code refactoring). Per bug #2840 from Ned Crigler.
-rw-r--r--src/bin/psql/input.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/bin/psql/input.c b/src/bin/psql/input.c
index 43da55b1c2..d21c4bb6c5 100644
--- a/src/bin/psql/input.c
+++ b/src/bin/psql/input.c
@@ -111,6 +111,12 @@ pg_send_history(PQExpBuffer history_buf)
static char *prev_hist = NULL;
char *s = history_buf->data;
+ int i;
+
+ /* Trim any trailing \n's (OK to scribble on history_buf) */
+ for (i = strlen(s) - 1; i >= 0 && s[i] == '\n'; i--)
+ ;
+ s[i + 1] = '\0';
if (useHistory && s[0])
{
@@ -123,12 +129,6 @@ pg_send_history(PQExpBuffer history_buf)
}
else
{
- int i;
-
- /* Trim any trailing \n's (OK to scribble on history_buf) */
- for (i = strlen(s) - 1; i >= 0 && s[i] == '\n'; i--)
- ;
- s[i + 1] = '\0';
/* Save each previous line for ignoredups processing */
if (prev_hist)
free(prev_hist);