Re: Making tab-complete.c easier to maintain - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: Making tab-complete.c easier to maintain
Date
Msg-id CAB7nPqStYKa+P87cQbFPqM5PWbhtUa=fDGdSZrHAZU8r45SStQ@mail.gmail.com
Whole thread Raw
In response to Re: Making tab-complete.c easier to maintain  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Wed, Dec 30, 2015 at 1:21 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> This is because of the use of strncmp instead of plain strcmp
> in most of the backslash matching rules, eg the above case is
> covered by
>
>         else if (strncmp(prev_wd, "\\df", strlen("\\df")) == 0)

Ah, OK. The length of the name and not the pattern is used in
word_matches, but we had better use something based on the pattern
shape. And the current logic for backslash commands uses the length of
the pattern, and not the word for its checks.

> I was envisioning that we'd want to convert this to something like
>
>         else if (TailMatchesCS1("\\df*"))

That's a better macro name...
-- 
Michael



pgsql-hackers by date:

Previous
From: Joe Conway
Date:
Subject: Re: exposing pg_controldata and pg_config as functions
Next
From: Michael Paquier
Date:
Subject: Re: Making tab-complete.c easier to maintain