pgsql: Improve coding of column-name parsing in psql's new crosstabview

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Improve coding of column-name parsing in psql's new crosstabview
Date: 2016-04-12 16:52:54
Message-ID: E1aq1Yc-0001q8-H8@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Improve coding of column-name parsing in psql's new crosstabview.c.

Coverity complained about this code, not without reason because it was
rather messy. Adjust it to not scribble on the passed string; that adds
one malloc/free cycle per column name, which is going to be insignificant
in context. We can actually const-ify both the string argument and the
PGresult.

Daniel Verité, with some further cleanup by me

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/7a5f8b5c59033ac153963f98b9109be9529a824a

Modified Files
--------------
src/bin/psql/crosstabview.c | 64 +++++++++++++++++++++++++++------------------
src/bin/psql/crosstabview.h | 3 ++-
2 files changed, 40 insertions(+), 27 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Alvaro Herrera 2016-04-12 17:08:04 Re: [COMMITTERS] pgsql: Avoid extra locks in GetSnapshotData if old_snapshot_threshold <
Previous Message Kevin Grittner 2016-04-12 16:49:25 pgsql: Avoid extra locks in GetSnapshotData if old_snapshot_threshold <