From e03e77c7117ab01d6849982f0608cce9427e94de Mon Sep 17 00:00:00 2001 From: Calvin Buckley Date: Mon, 1 Jun 2026 18:11:40 -0300 Subject: [PATCH] Remove docref1/docref2 Provide a compatibility wrapper. Tests haven't been changed yet. --- main/main.c | 39 ++------------------------------------- main/php.h | 15 +++++++++------ 2 files changed, 11 insertions(+), 43 deletions(-) diff --git a/main/main.c b/main/main.c index 9e77c99a45df..a89b252ca0f1 100644 --- a/main/main.c +++ b/main/main.c @@ -1258,37 +1258,8 @@ PHPAPI ZEND_COLD void php_error_docref_unchecked(const char *docref, int type, c } /* }}} */ -/* {{{ php_error_docref1 */ -/* See: CODING_STANDARDS.md for details. */ -PHPAPI ZEND_COLD void php_error_docref1(const char *docref, const char *param1, int type, const char *format, ...) -{ - va_list args; - - va_start(args, format); - php_verror(docref, param1, type, format, args); - va_end(args); -} -/* }}} */ - -/* {{{ php_error_docref2 */ -/* See: CODING_STANDARDS.md for details. */ -PHPAPI ZEND_COLD void php_error_docref2(const char *docref, const char *param1, const char *param2, int type, const char *format, ...) -{ - char *params; - va_list args; - - spprintf(¶ms, 0, "%s,%s", param1, param2); - va_start(args, format); - php_verror(docref, params ? params : "...", type, format, args); - va_end(args); - if (params) { - efree(params); - } -} -/* }}} */ - #ifdef PHP_WIN32 -PHPAPI ZEND_COLD void php_win32_docref1_from_error(DWORD error, const char *param1) { +PHPAPI ZEND_COLD void php_win32_docref_from_error(DWORD error, const char *param1) { char *buf = php_win32_error_to_msg(error); size_t buf_len; @@ -1297,13 +1268,7 @@ PHPAPI ZEND_COLD void php_win32_docref1_from_error(DWORD error, const char *para buf[buf_len - 1] = '\0'; buf[buf_len - 2] = '\0'; } - php_error_docref1(NULL, param1, E_WARNING, "%s (code: %lu)", buf, error); - php_win32_error_msg_free(buf); -} - -PHPAPI ZEND_COLD void php_win32_docref2_from_error(DWORD error, const char *param1, const char *param2) { - char *buf = php_win32_error_to_msg(error); - php_error_docref2(NULL, param1, param2, E_WARNING, "%s (code: %lu)", buf, error); + php_error_docref1(NULL, E_WARNING, "%s (code: %lu)", buf, error); php_win32_error_msg_free(buf); } #endif diff --git a/main/php.h b/main/php.h index 77976a68c018..e98260b0bb8e 100644 --- a/main/php.h +++ b/main/php.h @@ -303,13 +303,16 @@ PHPAPI ZEND_COLD void php_verror(const char *docref, const char *params, int typ PHPAPI ZEND_COLD void php_error_docref(const char *docref, int type, const char *format, ...) PHP_ATTRIBUTE_FORMAT(printf, 3, 4); PHPAPI ZEND_COLD void php_error_docref_unchecked(const char *docref, int type, const char *format, ...); -PHPAPI ZEND_COLD void php_error_docref1(const char *docref, const char *param1, int type, const char *format, ...) - PHP_ATTRIBUTE_FORMAT(printf, 4, 5); -PHPAPI ZEND_COLD void php_error_docref2(const char *docref, const char *param1, const char *param2, int type, const char *format, ...) - PHP_ATTRIBUTE_FORMAT(printf, 5, 6); +#define php_error_docref1(docref, param1, type, format, ...) \ + php_error_docref(docref, type, format, __VA_ARGS__) +#define php_error_docref2(docref, param1, param2, type, format, ...) \ + php_error_docref(docref, type, format, __VA_ARGS__) #ifdef PHP_WIN32 -PHPAPI ZEND_COLD void php_win32_docref1_from_error(DWORD error, const char *param1); -PHPAPI ZEND_COLD void php_win32_docref2_from_error(DWORD error, const char *param1, const char *param2); +PHPAPI ZEND_COLD void php_win32_docref_from_error(DWORD error); +#define php_win32_docref1_from_error(error, param1) \ + php_win32_docref_from_error(error) +#define php_win32_docref2_from_error(error, param1) \ + php_win32_docref_from_error(error) #endif END_EXTERN_C()