Re: [PATCH 5/6] psql: print_aligned_text uses table formatting - Mailing list pgsql-hackers

From Roger Leigh
Subject Re: [PATCH 5/6] psql: print_aligned_text uses table formatting
Date
Msg-id 20090823164316.GA30750@codelibre.net
Whole thread Raw
In response to [PATCH 1/6] psql: Abstract table formatting characters used for different line types.  (Roger Leigh <rleigh@debian.org>)
Responses Re: [PATCH 5/6] psql: print_aligned_text uses table formatting  (Alvaro Herrera <alvherre@commandprompt.com>)
List 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. 

pgsql-hackers by date:

Previous
From: Greg Stark
Date:
Subject: Re: clang's static checker report.
Next
From: Grzegorz Jaskiewicz
Date:
Subject: Re: clang's static checker report.