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

Tom Lane <tgl@sss.pgh.pa.us>

Commit: 7a5f8b5c59033ac153963f98b9109be9529a824a
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2016-04-12T16:52:42Z
Releases: 9.6.0
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

Files

PathChange+/−
src/bin/psql/crosstabview.c modified +38 −26
src/bin/psql/crosstabview.h modified +2 −1