Skip to content

Commit 757abf9

Browse files
committed
Address review comments
1 parent 6214e81 commit 757abf9

File tree

5 files changed

+11
-27
lines changed

5 files changed

+11
-27
lines changed

Zend/zend.c

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1768,40 +1768,30 @@ ZEND_API void zend_map_ptr_extend(size_t last)
17681768
}
17691769
}
17701770

1771-
static void zend_error_notify_callback_dtor(zend_error_notify_callback *callback)
1772-
{
1773-
}
1774-
17751771
int zend_startup_error_notify_callbacks()
17761772
{
1777-
zend_llist_init(&zend_error_notify_callbacks, sizeof(zend_error_notify_callback), (void (*)(void *)) zend_error_notify_callback_dtor, 1);
1773+
zend_llist_init(&zend_error_notify_callbacks, sizeof(zend_error_notify_cb), NULL, 1);
17781774

17791775
return SUCCESS;
17801776
}
17811777

1782-
int zend_shutdown_error_notify_callbacks()
1778+
void zend_shutdown_error_notify_callbacks()
17831779
{
17841780
zend_llist_destroy(&zend_error_notify_callbacks);
1785-
1786-
return SUCCESS;
17871781
}
17881782

17891783
void zend_register_error_notify_callback(zend_error_notify_cb cb)
17901784
{
1791-
zend_error_notify_callback callback;
1792-
1793-
callback.notify_callback = cb;
1794-
1795-
zend_llist_add_element(&zend_error_notify_callbacks, &callback);
1785+
zend_llist_add_element(&zend_error_notify_callbacks, &cb);
17961786
}
17971787

1798-
void zend_error_notify_all_callbacks(int type, const char *error_filename, const uint32_t error_lineno, zend_string *message)
1788+
void zend_error_notify_all_callbacks(int type, const char *error_filename, uint32_t error_lineno, zend_string *message)
17991789
{
18001790
zend_llist_element *element;
1801-
zend_error_notify_callback *callback;
1791+
zend_error_notify_cb callback;
18021792

18031793
for (element = zend_error_notify_callbacks.head; element; element = element->next) {
1804-
callback = (zend_error_notify_callback*) element->data;
1805-
callback->notify_callback(type, error_filename, error_lineno, message);
1794+
callback = *(zend_error_notify_cb *) (element->data);
1795+
callback(type, error_filename, error_lineno, message);
18061796
}
18071797
}

Zend/zend.h

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -354,17 +354,11 @@ ZEND_API void zend_restore_error_handling(zend_error_handling *saved);
354354
typedef void (*zend_error_notify_cb)(int type, const char *error_filename, const uint32_t error_lineno, zend_string *message);
355355

356356
BEGIN_EXTERN_C()
357-
typedef struct {
358-
zend_error_notify_cb notify_callback;
359-
} zend_error_notify_callback;
360357

361358
void zend_register_error_notify_callback(zend_error_notify_cb callback);
362359
int zend_startup_error_notify_callbacks();
363-
int zend_shutdown_error_notify_callbacks();
360+
void zend_shutdown_error_notify_callbacks();
364361
void zend_error_notify_all_callbacks(int type, const char *error_filename, const uint32_t error_lineno, zend_string *message);
365-
#if ZEND_DEBUG
366-
void report_zend_debug_error_notify_cb(int type, const char *error_filename, const uint32_t error_lineno, zend_string *message);
367-
#endif
368362
END_EXTERN_C()
369363

370364
#define DEBUG_BACKTRACE_PROVIDE_OBJECT (1<<0)

Zend/zend_dtrace.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ ZEND_API void dtrace_execute_internal(zend_execute_data *execute_data, zval *ret
109109
}
110110
}
111111

112-
void dtrace_error_notify_cb(int type, const char *error_filename, const uint32_t error_lineno, zend_string *message)
112+
void dtrace_error_notify_cb(int type, const char *error_filename, uint32_t error_lineno, zend_string *message)
113113
{
114114
if (DTRACE_ERROR_ENABLED()) {
115115
DTRACE_ERROR(ZSTR_VAL(message), (char *)error_filename, error_lineno);

Zend/zend_dtrace.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ ZEND_API void dtrace_execute_ex(zend_execute_data *execute_data);
3737
ZEND_API void dtrace_execute_internal(zend_execute_data *execute_data, zval *return_value);
3838
#include <zend_dtrace_gen.h>
3939

40-
void dtrace_error_notify_cb(int type, const char *error_filename, const uint32_t error_lineno, zend_string *message);
40+
void dtrace_error_notify_cb(int type, const char *error_filename, uint32_t error_lineno, zend_string *message);
4141

4242
#endif /* HAVE_DTRACE */
4343

main/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1201,7 +1201,7 @@ static void clear_last_error() {
12011201

12021202
#if ZEND_DEBUG
12031203
/* {{{ report_zend_debug_error_notify_cb */
1204-
void report_zend_debug_error_notify_cb(int type, const char *error_filename, const uint32_t error_lineno, zend_string *message)
1204+
static void report_zend_debug_error_notify_cb(int type, const char *error_filename, uint32_t error_lineno, zend_string *message)
12051205
{
12061206
if (PG(report_zend_debug)) {
12071207
zend_bool trigger_break;

0 commit comments

Comments
 (0)