diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2020-10-19 16:09:03 +0200 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2020-10-19 16:09:03 +0200 |
commit | cfb272defcb2aceb75a78e5d1525a45436b177ff (patch) | |
tree | d1682d53435f16a0815729166a8638c71e89edf6 /ext/opcache/zend_accelerator_debug.c | |
parent | 9426c6e9679e60665f7ed95bccc1e8bc6ce74b2f (diff) | |
download | php-git-cfb272defcb2aceb75a78e5d1525a45436b177ff.tar.gz |
Add zend_accel_error_noreturn() helper
Avoid confusing the compiler when code relies on the fact that
LOG_FATAL/LOG_ERROR will bailout/abort.
Diffstat (limited to 'ext/opcache/zend_accelerator_debug.c')
-rw-r--r-- | ext/opcache/zend_accelerator_debug.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/ext/opcache/zend_accelerator_debug.c b/ext/opcache/zend_accelerator_debug.c index f91c269975..a3db2a7215 100644 --- a/ext/opcache/zend_accelerator_debug.c +++ b/ext/opcache/zend_accelerator_debug.c @@ -28,9 +28,8 @@ #endif #include "ZendAccelerator.h" -void zend_accel_error(int type, const char *format, ...) +static void zend_accel_error_va_args(int type, const char *format, va_list args) { - va_list args; time_t timestamp; char *time_string; FILE * fLog = NULL; @@ -77,9 +76,7 @@ void zend_accel_error(int type, const char *format, ...) break; } - va_start(args, format); vfprintf(fLog, format, args); - va_end(args); fprintf(fLog, "\n"); fflush(fLog); @@ -98,3 +95,22 @@ void zend_accel_error(int type, const char *format, ...) } } + +void zend_accel_error(int type, const char *format, ...) +{ + va_list args; + va_start(args, format); + zend_accel_error_va_args(type, format, args); + va_end(args); +} + +ZEND_NORETURN void zend_accel_error_noreturn(int type, const char *format, ...) +{ + va_list args; + va_start(args, format); + ZEND_ASSERT(type == ACCEL_LOG_FATAL || type == ACCEL_LOG_ERROR); + zend_accel_error_va_args(type, format, args); + va_end(args); + /* Should never reach this. */ + abort(); +} |