pgsql: Rewrite tab completion's previous-word fetching for more sanity. - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Rewrite tab completion's previous-word fetching for more sanity.
Date
Msg-id E1RGyXX-0002rw-Cg@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Rewrite tab completion's previous-word fetching for more sanity.

Make it return empty strings when there are no more words to the left of
the current position, instead of sometimes returning NULL and other times
returning copies of the leftmost word.  Also, fetch the words in one scan,
rather than the previous wasteful approach of starting from scratch for
each word.  Make the code a bit harder to break when someone decides we
need more words of context, too.  (There was actually a memory leak here,
because whoever added prev6_wd neglected to free it.)

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/dce92c6d6abe302c58fd4e4221efed54913aefdb

Modified Files
--------------
src/bin/psql/tab-complete.c |  142 +++++++++++++++++++++++--------------------
1 files changed, 76 insertions(+), 66 deletions(-)


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Fix memory leak in tab completion.
Next
From: Tom Lane
Date:
Subject: pgsql: Simplify and improve ProcessStandbyHSFeedbackMessage logic.