Re: Proposed patch - psql wraps at window width

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Bryce Nesbitt <bryce2(at)obviously(dot)com>, pgsql-patches(at)postgresql(dot)org, heikki(at)enterprisedb(dot)com
Subject: Re: Proposed patch - psql wraps at window width
Date: 2008-04-17 20:55:12
Message-ID: 200804172055.m3HKtCP21261@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches


Alvaro is correct. I made most or all of these adjustments in the
updated version I posted yesterday.

---------------------------------------------------------------------------

Alvaro Herrera wrote:
> Bryce Nesbitt wrote:
> > I've attached a patch, against current 8.4 cvs, which optionally sets a
> > maximum width for psql output:
>
> Some random comments:
>
> * Don't use C++ style comments (//). Some compilers don't like these.
>
> * Beware of brace position: we use braces on their own, indented at the
> start of a new line, so
>
> ! while(--count) {
> ! lines++;
> ! lines->ptr = NULL;
> ! lines->width = 0;
> ! }
>
> becomes
>
>
> ! while(--count)
> ! {
> ! lines++;
> ! lines->ptr = NULL;
> ! lines->width = 0;
> ! }
>
> (with correct indentation anyway)
>
>
> * Always use tabs, not spaces, to indent. Tabs are 4 spaces wide.
>
> * Don't use double stars in comments.
>
> * We're not in the habit of giving credit in code comments. It gets
> messy fast.
>
> * Don't lose warning comments like this one (unless you've removed the
> assumption of course)
>
> /*
> * Assumption: This code used only on strings
> * without multibyte characters, otherwise
> * this_line->width < strlen(this_ptr) and we get
> * an overflow
> */
>
> In fact I wonder if you've introduced this assumption in the other case
> on that code (i.e. when alignment is not 'r'). I'm not seeing any
> checks for multibytes in there, but perhaps I'm missing it.
>
>
> * "} else" is forbidden too. Use two separate lines.
>
> --
> Alvaro Herrera http://www.CommandPrompt.com/
> The PostgreSQL Company - Command Prompt, Inc.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2008-04-17 20:58:10 Re: pg_terminate_backend() issues
Previous Message Alvaro Herrera 2008-04-17 20:53:08 Re: Proposed patch - psql wraps at window width

Browse pgsql-patches by date

  From Date Subject
Next Message Alvaro Herrera 2008-04-17 21:03:20 Re: Proposed patch - psql wraps at window width
Previous Message Alvaro Herrera 2008-04-17 20:53:08 Re: Proposed patch - psql wraps at window width