add RUNTIME_CHECK

This commit is contained in:
Bob Halley 1999-01-06 20:02:14 +00:00
parent 985687b4e0
commit da46905010
2 changed files with 11 additions and 2 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 1998 Internet Software Consortium.
* Copyright (C) 1998, 1999 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@ -64,6 +64,11 @@ isc_error_fatal(char *file, int line, char *format, ...) {
abort();
}
void
isc_error_runtimecheck(char *file, int line, char *expression) {
(fatal_callback)(file, line, "RUNTIME_CHECK(%s) failed.", expression);
}
static void
default_unexpected_callback(char *file, int line, char *format, va_list args) {
fprintf(stderr, "%s:%d: ", file, line);

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 1998 Internet Software Consortium.
* Copyright (C) 1998, 1999 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@ -26,8 +26,12 @@ void isc_error_setunexpected(isc_errorcallback_t);
void isc_error_setfatal(isc_errorcallback_t);
void isc_error_unexpected(char *, int, char *, ...);
void isc_error_fatal(char *, int, char *, ...);
void isc_error_runtimecheck(char *, int, char *);
#define UNEXPECTED_ERROR isc_error_unexpected
#define FATAL_ERROR isc_error_fatal
#define RUNTIME_CHECK(cond) \
((void) ((cond) || \
((isc_error_runtimecheck)(__FILE__, __LINE__, #cond), 0)))
#endif /* ISC_ERROR_H */