Re: Making tab-complete.c easier to maintain

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>, Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Making tab-complete.c easier to maintain
Date: 2015-12-30 00:13:43
Message-ID: CAB7nPqStYKa+P87cQbFPqM5PWbhtUa=fDGdSZrHAZU8r45SStQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Dec 30, 2015 at 1:21 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2015-12-30 00:14:23 Re: Making tab-complete.c easier to maintain
Previous Message Joe Conway 2015-12-30 00:08:00 Re: exposing pg_controldata and pg_config as functions