Commit da469050 authored by Bob Halley's avatar Bob Halley
Browse files

add RUNTIME_CHECK

parent 985687b4
/*
* 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);
......
/*
* 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 */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment