From ad5a54d1707dabe723ac0e9b6b05fc2a324b3f04 Mon Sep 17 00:00:00 2001
From: Michael Meskes <meskes@postgresql.org>
Date: Fri, 16 Apr 1999 12:26:49 +0000
Subject: [PATCH] *** empty log message ***

---
 src/interfaces/ecpg/ChangeLog         |  4 ++++
 src/interfaces/ecpg/lib/ecpglib.c     | 11 +++--------
 src/interfaces/ecpg/preproc/pgc.l     |  6 ++++++
 src/interfaces/ecpg/preproc/preproc.y | 12 ++++++------
 src/interfaces/ecpg/test/test2.pgc    |  2 +-
 5 files changed, 20 insertions(+), 15 deletions(-)

diff --git a/src/interfaces/ecpg/ChangeLog b/src/interfaces/ecpg/ChangeLog
index bbe1cf517cb..a08db67ff6b 100644
--- a/src/interfaces/ecpg/ChangeLog
+++ b/src/interfaces/ecpg/ChangeLog
@@ -559,6 +559,10 @@ Mon Apr 12 17:56:14 CEST 1999
 Wed Apr 14 17:59:06 CEST 1999
 
 	- Added simple calculations for array bounds.
+
+Fri Apr 16 18:25:18 CEST 1999
+
+	- Fixed small bug in ECPGfinish().
 	- Set library version to 3.0.0
 	- Set ecpg version to 2.6.0
 
diff --git a/src/interfaces/ecpg/lib/ecpglib.c b/src/interfaces/ecpg/lib/ecpglib.c
index 9fea350eb71..5314a0a90d3 100644
--- a/src/interfaces/ecpg/lib/ecpglib.c
+++ b/src/interfaces/ecpg/lib/ecpglib.c
@@ -149,26 +149,21 @@ ECPGfinish(struct connection * act)
 		PQfinish(act->connection);
 		/* remove act from the list */
 		if (act == all_connections)
-		{
 			all_connections = act->next;
-			free(act->name);
-			free(act);
-		}
 		else
 		{
 			struct connection *con;
 
 			for (con = all_connections; con->next && con->next != act; con = con->next);
 			if (con->next)
-			{
 				con->next = act->next;
-				free(act->name);
-				free(act);
-			}
 		}
 
 		if (actual_connection == act)
 			actual_connection = all_connections;
+			
+		free(act->name);
+		free(act);
 	}
 	else
 		ECPGlog("ECPGfinish: called an extra time.\n");
diff --git a/src/interfaces/ecpg/preproc/pgc.l b/src/interfaces/ecpg/preproc/pgc.l
index b9d5bdd79e9..aa7b1852652 100644
--- a/src/interfaces/ecpg/preproc/pgc.l
+++ b/src/interfaces/ecpg/preproc/pgc.l
@@ -533,6 +533,12 @@ cppline		{space}*#.*(\\{space}*\n)*\n*
 <C>";"	      	        { return(';'); }
 <C>","	      	        { return(','); }
 <C>"*"	      	        { return('*'); }
+<C>"%"	      	        { return('%'); }
+<C>"/"	      	        { return('/'); }
+<C>"+"	      	        { return('+'); }
+<C>"-"	      	        { return('-'); }
+<C>"("	      	        { return('('); }
+<C>")"	      	        { return(')'); }
 <C>{space}		{ ECHO; }
 <C>\{			{ return('{'); }
 <C>\}			{ return('}'); }
diff --git a/src/interfaces/ecpg/preproc/preproc.y b/src/interfaces/ecpg/preproc/preproc.y
index bb5faeb75ec..c46d68383cd 100644
--- a/src/interfaces/ecpg/preproc/preproc.y
+++ b/src/interfaces/ecpg/preproc/preproc.y
@@ -3218,12 +3218,12 @@ nest_array_bounds:	'[' ']' nest_array_bounds
 
 Iresult:	Iconst			{ $$ = atol($1); }
 	|	'(' Iresult ')'		{ $$ = $2; }
-	|	Iresult '+' Iresult	{ $$ = $1 + $3};
-	|	Iresult '-' Iresult	{ $$ = $1 - $3};
-	|	Iresult '*' Iresult	{ $$ = $1 * $3};
-	|	Iresult '/' Iresult	{ $$ = $1 / $3};
-	|	Iresult '%' Iresult	{ $$ = $1 % $3};
-
+	|	Iresult '+' Iresult	{ $$ = $1 + $3; }
+	|	Iresult '-' Iresult	{ $$ = $1 - $3; }
+	|	Iresult '*' Iresult	{ $$ = $1 * $3; }
+	|	Iresult '/' Iresult	{ $$ = $1 / $3; }
+	|	Iresult '%' Iresult	{ $$ = $1 % $3; }
+	;
 
 
 /*****************************************************************************
diff --git a/src/interfaces/ecpg/test/test2.pgc b/src/interfaces/ecpg/test/test2.pgc
index 954498d0127..360dee3b34f 100644
--- a/src/interfaces/ecpg/test/test2.pgc
+++ b/src/interfaces/ecpg/test/test2.pgc
@@ -40,7 +40,7 @@ exec sql end declare section;
                 ECPGdebug(1, dbgs);
 
 	strcpy(msg, "connect");
-	exec sql connect to unix:postgresql://localhost:5432/mm; 
+	exec sql connect to unix:postgresql://localhost:5432/mm;
 
 	strcpy(msg, "create");
 	exec sql create table meskes(name char(8), born integer, age smallint, married date, children integer);
-- 
GitLab