Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 2 additions & 37 deletions main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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(&params, 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;

Expand All @@ -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
Expand Down
15 changes: 9 additions & 6 deletions main/php.h
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
Loading