3131 * ENHANCEMENTS, OR MODIFICATIONS.
3232 *
3333 * IDENTIFICATION
34- * $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.68 2002/12/30 22:10:54 tgl Exp $
34+ * $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.69 2003/02/06 17:02:11 tgl Exp $
3535 *
3636 **********************************************************************/
3737
@@ -1255,7 +1255,7 @@ static int
12551255pltcl_elog (ClientData cdata ,Tcl_Interp * interp ,
12561256int argc ,CONST84 char * argv [])
12571257{
1258- int level ;
1258+ volatile int level ;
12591259sigjmp_buf save_restart ;
12601260
12611261/************************************************************
@@ -1264,18 +1264,6 @@ pltcl_elog(ClientData cdata, Tcl_Interp *interp,
12641264if (pltcl_restart_in_progress )
12651265return TCL_ERROR ;
12661266
1267- /************************************************************
1268- * Catch the restart longjmp and begin a controlled
1269- * return though all interpreter levels if it happens
1270- ************************************************************/
1271- memcpy (& save_restart ,& Warn_restart ,sizeof (save_restart ));
1272- if (sigsetjmp (Warn_restart ,1 )!= 0 )
1273- {
1274- memcpy (& Warn_restart ,& save_restart ,sizeof (Warn_restart ));
1275- pltcl_restart_in_progress = 1 ;
1276- return TCL_ERROR ;
1277- }
1278-
12791267if (argc != 3 )
12801268{
12811269Tcl_SetResult (interp ,"syntax error - 'elog level msg'" ,
@@ -1301,17 +1289,29 @@ pltcl_elog(ClientData cdata, Tcl_Interp *interp,
13011289{
13021290Tcl_AppendResult (interp ,"Unknown elog level '" ,argv [1 ],
13031291"'" ,NULL );
1292+ return TCL_ERROR ;
1293+ }
1294+
1295+ /************************************************************
1296+ * Catch the longjmp from elog() and begin a controlled
1297+ * return though all interpreter levels if it happens
1298+ ************************************************************/
1299+ memcpy (& save_restart ,& Warn_restart ,sizeof (save_restart ));
1300+ if (sigsetjmp (Warn_restart ,1 )!= 0 )
1301+ {
13041302memcpy (& Warn_restart ,& save_restart ,sizeof (Warn_restart ));
1303+ pltcl_restart_in_progress = 1 ;
13051304return TCL_ERROR ;
13061305}
13071306
13081307/************************************************************
13091308 * Call elog(), restore the original restart address
1310- * and return to the caller (ifnot catched )
1309+ * and return to the caller (ifno longjmp )
13111310 ************************************************************/
13121311UTF_BEGIN ;
13131312elog (level ,"%s" ,UTF_U2E (argv [2 ]));
13141313UTF_END ;
1314+
13151315memcpy (& Warn_restart ,& save_restart ,sizeof (Warn_restart ));
13161316return TCL_OK ;
13171317}