mirror of
https://github.com/isc-projects/bind9.git
synced 2026-03-12 05:32:42 -04:00
add RUNTIME_CHECK
This commit is contained in:
parent
985687b4e0
commit
da46905010
2 changed files with 11 additions and 2 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
Loading…
Reference in a new issue