psql patch (2)

Started by Jeroen T. Vermeulenover 23 years ago5 messagespatches
Jump to latest

I'm continuing to work on cleaning up code in psql. As things appear
now, my changes seem to work. Some possible minor bugs got squished
on the way but I can't be sure without more feedback from people who
really put the code to the test.

The new patch mostly simplifies variable handling and reduces code
duplication. Changes in the command parser eliminate some redundant
variables (boolean state + depth counter), replaces some
"else if" constructs with switches, and so on. It is meant to be
applied together with my previous patch, although I hope they don't
conflict; I went back to the CVS version for this one.

One more thing I thought should perhaps be changed: an IGNOREEOF
value of n will ignore only n-1 EOFs. I didn't want to touch this
for fear of breaking existing applications, but it does seem a tad
illogical.

Jeroen

Attachments:

psql.patch2text/plain; charset=us-asciiDownload+365-273
#2Bruce Momjian
bruce@momjian.us
In reply to: Jeroen T. Vermeulen (#1)
Re: psql patch (2)

Your patch has been added to the PostgreSQL unapplied patches list at:

http://momjian.postgresql.org/cgi-bin/pgpatches

I will try to apply it within the next 48 hours.

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

Jeroen T. Vermeulen wrote:

I'm continuing to work on cleaning up code in psql. As things appear
now, my changes seem to work. Some possible minor bugs got squished
on the way but I can't be sure without more feedback from people who
really put the code to the test.

The new patch mostly simplifies variable handling and reduces code
duplication. Changes in the command parser eliminate some redundant
variables (boolean state + depth counter), replaces some
"else if" constructs with switches, and so on. It is meant to be
applied together with my previous patch, although I hope they don't
conflict; I went back to the CVS version for this one.

One more thing I thought should perhaps be changed: an IGNOREEOF
value of n will ignore only n-1 EOFs. I didn't want to touch this
for fear of breaking existing applications, but it does seem a tad
illogical.

Jeroen

[ Attachment, skipping... ]

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
#3Bruce Momjian
bruce@momjian.us
In reply to: Jeroen T. Vermeulen (#1)
Re: psql patch (2)

Patch applied. Thanks.

I have attached the patch. I adjusted the cancelConn functions.

I also adjusted this:

	+ char parse_char(char **buf)
	+ {
	+   long l;
	+
	+   l = strtol(*buf, buf, 0);
	+   (*buf)--;
	+   return (char)l;
	+ }
	+

I added the parens around 'buf' because the compiler was saying
statement has no effect. Is this correct?

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

Jeroen T. Vermeulen wrote:

I'm continuing to work on cleaning up code in psql. As things appear
now, my changes seem to work. Some possible minor bugs got squished
on the way but I can't be sure without more feedback from people who
really put the code to the test.

The new patch mostly simplifies variable handling and reduces code
duplication. Changes in the command parser eliminate some redundant
variables (boolean state + depth counter), replaces some
"else if" constructs with switches, and so on. It is meant to be
applied together with my previous patch, although I hope they don't
conflict; I went back to the CVS version for this one.

One more thing I thought should perhaps be changed: an IGNOREEOF
value of n will ignore only n-1 EOFs. I didn't want to touch this
for fear of breaking existing applications, but it does seem a tad
illogical.

Jeroen

[ Attachment, skipping... ]

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Attachments:

/bjm/difftext/plainDownload+364-312
In reply to: Bruce Momjian (#3)
Re: psql patch (2)

On Thu, Mar 20, 2003 at 01:45:31AM -0500, Bruce Momjian wrote:

I also adjusted this:

+ char parse_char(char **buf)
+ {
+   long l;
+
+   l = strtol(*buf, buf, 0);
+   (*buf)--;
+   return (char)l;
+ }
+

I added the parens around 'buf' because the compiler was saying
statement has no effect. Is this correct?

I don't remember what this function does, but you could also write
'--*buf;' to save on parentheses (and do your bit for the environment).

Jeroen

#5Bruce Momjian
bruce@momjian.us
In reply to: Jeroen T. Vermeulen (#4)
Re: psql patch (2)

OK, fixed as you suggested.

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

Jeroen T. Vermeulen wrote:

On Thu, Mar 20, 2003 at 01:45:31AM -0500, Bruce Momjian wrote:

I also adjusted this:

+ char parse_char(char **buf)
+ {
+   long l;
+
+   l = strtol(*buf, buf, 0);
+   (*buf)--;
+   return (char)l;
+ }
+

I added the parens around 'buf' because the compiler was saying
statement has no effect. Is this correct?

I don't remember what this function does, but you could also write
'--*buf;' to save on parentheses (and do your bit for the environment).

Jeroen

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073