mirror of
https://github.com/postgres/postgres.git
synced 2025-08-25 20:23:07 +03:00
This patch removes a lot of unused code related to assertions and
error handling, and simplifies the code that remains. Apparently, the code that left Berkeley had a whole "error handling subsystem", which exceptions and whatnot. Since we don't use that anymore, there's no reason to keep it around. The regression tests pass with the patch applied. Unless anyone sees a problem, please apply. Neil Conway
This commit is contained in:
@@ -8,65 +8,44 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/error/assert.c,v 1.21 2002/06/20 20:29:39 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/error/assert.c,v 1.22 2002/08/10 20:29:18 momjian Exp $
|
||||
*
|
||||
* NOTE
|
||||
* This should eventually work with elog(), dlog(), etc.
|
||||
* This should eventually work with elog()
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#include "postgres.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "utils/exc.h"
|
||||
|
||||
/*
|
||||
* ExceptionalCondition - Handles the failure of an Assert()
|
||||
*/
|
||||
int
|
||||
ExceptionalCondition(char *conditionName,
|
||||
Exception *exceptionP,
|
||||
char *detail,
|
||||
char *errorType,
|
||||
char *fileName,
|
||||
int lineNumber)
|
||||
{
|
||||
ExcFileName = fileName;
|
||||
ExcLineNumber = lineNumber;
|
||||
|
||||
if (!PointerIsValid(conditionName)
|
||||
|| !PointerIsValid(fileName)
|
||||
|| !PointerIsValid(exceptionP))
|
||||
|| !PointerIsValid(errorType))
|
||||
{
|
||||
fprintf(stderr, "TRAP: ExceptionalCondition: bad arguments\n");
|
||||
|
||||
ExcAbort(exceptionP,
|
||||
(ExcDetail) detail,
|
||||
(ExcData) NULL,
|
||||
(ExcMessage) NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "TRAP: %s(\"%s:%s\", File: \"%s\", Line: %d)\n",
|
||||
exceptionP->message, conditionName,
|
||||
(detail == NULL ? "" : detail),
|
||||
fprintf(stderr, "TRAP: %s(\"%s\", File: \"%s\", Line: %d)\n",
|
||||
errorType, conditionName,
|
||||
fileName, lineNumber);
|
||||
}
|
||||
|
||||
#ifdef ABORT_ON_ASSERT
|
||||
abort();
|
||||
#endif
|
||||
#ifdef SLEEP_ON_ASSERT
|
||||
sleep(1000000);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* XXX Depending on the Exception and tracing conditions, you will XXX
|
||||
* want to stop here immediately and maybe dump core. XXX This may be
|
||||
* especially true for Assert(), etc.
|
||||
*/
|
||||
abort();
|
||||
|
||||
/* TraceDump(); dump the trace stack */
|
||||
|
||||
/* XXX FIXME: detail is lost */
|
||||
ExcRaise(exceptionP, (ExcDetail) 0, (ExcData) NULL, conditionName);
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user