Skip site navigation (1) Skip section navigation (2)

Re: [PATCH 5/6] psql: print_aligned_text uses table formatting

From: Roger Leigh <rleigh(at)codelibre(dot)net>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Roger Leigh <rleigh(at)debian(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [PATCH 5/6] psql: print_aligned_text uses table formatting
Date: 2009-08-23 16:43:16
Message-ID: 20090823164316.GA30750@codelibre.net (view raw or flat)
Thread:
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.

In response to

Responses

pgsql-hackers by date

Next:From: Grzegorz JaskiewiczDate: 2009-08-23 16:47:46
Subject: Re: clang's static checker report.
Previous:From: Greg StarkDate: 2009-08-23 16:41:24
Subject: Re: clang's static checker report.

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group