Skip to content

Commit

Permalink
Mark error functions as "cold"
Browse files Browse the repository at this point in the history
  • Loading branch information
dstogov committed Aug 24, 2015
1 parent fd5e0dc commit 96ea4a0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
16 changes: 8 additions & 8 deletions main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ PHPAPI int php_get_module_initialized(void)

/* {{{ php_log_err
*/
PHPAPI void php_log_err(char *log_message)
PHPAPI ZEND_COLD void php_log_err(char *log_message)
{
int fd = -1;
time_t error_time;
Expand Down Expand Up @@ -703,7 +703,7 @@ PHPAPI size_t php_printf(const char *format, ...)
* html error messages if correcponding ini setting (html_errors) is activated.
* See: CODING_STANDARDS for details.
*/
PHPAPI void php_verror(const char *docref, const char *params, int type, const char *format, va_list args)
PHPAPI ZEND_COLD void php_verror(const char *docref, const char *params, int type, const char *format, va_list args)
{
zend_string *replace_buffer = NULL, *replace_origin = NULL;
char *buffer = NULL, *docref_buf = NULL, *target = NULL;
Expand Down Expand Up @@ -888,7 +888,7 @@ PHPAPI void php_verror(const char *docref, const char *params, int type, const c

/* {{{ php_error_docref0 */
/* See: CODING_STANDARDS for details. */
PHPAPI void php_error_docref0(const char *docref, int type, const char *format, ...)
PHPAPI ZEND_COLD void php_error_docref0(const char *docref, int type, const char *format, ...)
{
va_list args;

Expand All @@ -900,7 +900,7 @@ PHPAPI void php_error_docref0(const char *docref, int type, const char *format,

/* {{{ php_error_docref1 */
/* See: CODING_STANDARDS for details. */
PHPAPI void php_error_docref1(const char *docref, const char *param1, int type, const char *format, ...)
PHPAPI ZEND_COLD void php_error_docref1(const char *docref, const char *param1, int type, const char *format, ...)
{
va_list args;

Expand All @@ -912,7 +912,7 @@ PHPAPI void php_error_docref1(const char *docref, const char *param1, int type,

/* {{{ php_error_docref2 */
/* See: CODING_STANDARDS for details. */
PHPAPI void php_error_docref2(const char *docref, const char *param1, const char *param2, int type, const char *format, ...)
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;
Expand All @@ -929,7 +929,7 @@ PHPAPI void php_error_docref2(const char *docref, const char *param1, const char

#ifdef PHP_WIN32
#define PHP_WIN32_ERROR_MSG_BUFFER_SIZE 512
PHPAPI void php_win32_docref2_from_error(DWORD error, const char *param1, const char *param2) {
PHPAPI ZEND_COLD void php_win32_docref2_from_error(DWORD error, const char *param1, const char *param2) {
if (error == 0) {
php_error_docref2(NULL, param1, param2, E_WARNING, "%s", strerror(errno));
} else {
Expand Down Expand Up @@ -957,7 +957,7 @@ PHPAPI void php_html_puts(const char *str, size_t size)

/* {{{ php_error_cb
extended error handling function */
static void php_error_cb(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args)
static ZEND_COLD void php_error_cb(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args)
{
char *buffer;
int buffer_len, display;
Expand Down Expand Up @@ -1411,7 +1411,7 @@ static void php_free_request_globals(void)

/* {{{ php_message_handler_for_zend
*/
static void php_message_handler_for_zend(zend_long message, const void *data)
static ZEND_COLD void php_message_handler_for_zend(zend_long message, const void *data)
{
switch (message) {
case ZMSG_FAILED_INCLUDE_FOPEN:
Expand Down
12 changes: 6 additions & 6 deletions main/php.h
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ PHPAPI size_t php_write(void *buf, size_t size);
PHPAPI size_t php_printf(const char *format, ...) PHP_ATTRIBUTE_FORMAT(printf, 1,
2);
PHPAPI int php_get_module_initialized(void);
PHPAPI void php_log_err(char *log_message);
PHPAPI ZEND_COLD void php_log_err(char *log_message);
int Debug(char *format, ...) PHP_ATTRIBUTE_FORMAT(printf, 1, 2);
int cfgparse(void);
END_EXTERN_C()
Expand All @@ -295,7 +295,7 @@ static inline ZEND_ATTRIBUTE_DEPRECATED void php_set_error_handling(error_handli
}
static inline ZEND_ATTRIBUTE_DEPRECATED void php_std_error_handling() {}

PHPAPI void php_verror(const char *docref, const char *params, int type, const char *format, va_list args) PHP_ATTRIBUTE_FORMAT(printf, 4, 0);
PHPAPI ZEND_COLD void php_verror(const char *docref, const char *params, int type, const char *format, va_list args) PHP_ATTRIBUTE_FORMAT(printf, 4, 0);

#ifdef ZTS
#define PHP_ATTR_FMT_OFFSET 1
Expand All @@ -304,14 +304,14 @@ PHPAPI void php_verror(const char *docref, const char *params, int type, const c
#endif

/* PHPAPI void php_error(int type, const char *format, ...); */
PHPAPI void php_error_docref0(const char *docref, int type, const char *format, ...)
PHPAPI ZEND_COLD void php_error_docref0(const char *docref, int type, const char *format, ...)
PHP_ATTRIBUTE_FORMAT(printf, PHP_ATTR_FMT_OFFSET + 3, PHP_ATTR_FMT_OFFSET + 4);
PHPAPI void php_error_docref1(const char *docref, const char *param1, 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, PHP_ATTR_FMT_OFFSET + 4, PHP_ATTR_FMT_OFFSET + 5);
PHPAPI void php_error_docref2(const char *docref, const char *param1, const char *param2, int type, const char *format, ...)
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, PHP_ATTR_FMT_OFFSET + 5, PHP_ATTR_FMT_OFFSET + 6);
#ifdef PHP_WIN32
PHPAPI void php_win32_docref2_from_error(DWORD error, const char *param1, const char *param2);
PHPAPI ZEND_COLD void php_win32_docref2_from_error(DWORD error, const char *param1, const char *param2);
#endif
END_EXTERN_C()

Expand Down

0 comments on commit 96ea4a0

Please sign in to comment.