Re: [PATCH 5/6] psql: print_aligned_text uses table formatting
Roger Leigh <rleigh@codelibre.net>
From: Roger Leigh <rleigh@codelibre.net>
To: Alvaro Herrera <alvherre@commandprompt.com>
Cc: Roger Leigh <rleigh@debian.org>, pgsql-hackers@postgresql.org
Date: 2009-08-23T16:43:16Z
Lists: pgsql-hackers
On Sun, Aug 23, 2009 at 11:47:02AM -0400, Alvaro Herrera wrote:
> Roger Leigh wrote:
> > Convert print_aligned_text, and its helper function, to use
> > table formatting in place of hardcoded ASCII characters.
>
> > @@ -841,7 +856,10 @@ print_aligned_text(const printTableContent *cont, const printTextFormat *format,
> >
> > /* left border */
> > if (opt_border == 2)
> > - fputs("| ", fout);
> > + {
> > + fputs(format->vrule, fout);
> > + fputc(' ', fout);
> > + }
> > else if (opt_border == 1)
> > fputc(' ', fout);
>
> Wouldn't it be better to do a single fprintf call here instead of
> fputc + fputs?
It's certainly possible to change it; the above might be slightly more
efficient than a call to fprintf since you skip parsing the format
string, but otherwise I have no real preference for one over the
other.
Regards,
Roger
--
.''`. Roger Leigh
: :' : Debian GNU/Linux http://people.debian.org/~rleigh/
`. `' Printing on GNU/Linux? http://gutenprint.sourceforge.net/
`- GPG Public Key: 0x25BFB848 Please GPG sign your mail.