Skip to content

Commit 51a711b

Browse files
author
Ilia Alshanetsky
committed
MFH (fix for bug #21146).
# Approved by Andrei
1 parent 022e5db commit 51a711b

File tree

3 files changed

+159
-107
lines changed

3 files changed

+159
-107
lines changed

ext/ncurses/ncurses.c

+4-6
Original file line numberDiff line numberDiff line change
@@ -84,19 +84,15 @@ PHP_INI_END()
8484
#define PHP_NCURSES_CONST(x) REGISTER_LONG_CONSTANT("NCURSES_"#x, x, CONST_CS | CONST_PERSISTENT)
8585
#define PHP_NCURSES_FKEY_CONST(x) REGISTER_LONG_CONSTANT("NCURSES_KEY_F"#x, KEY_F0 + x, CONST_CS | CONST_PERSISTENT)
8686

87-
/* {{{ php_ncurses_globals_ctor */
88-
static void php_ncurses_globals_ctor(zend_ncurses_globals *pglobals)
87+
static void php_ncurses_init_globals(zend_ncurses_globals *ncurses_globals)
8988
{
90-
pglobals->registered_constants = 0;
91-
pglobals->is_initialised = 0;
89+
memset(ncurses_globals, 0, sizeof(*ncurses_globals));
9290
}
93-
/* }}} */
9491

9592
/* {{{ PHP_MINIT_FUNCTION
9693
*/
9794
PHP_MINIT_FUNCTION(ncurses)
9895
{
99-
ZEND_INIT_MODULE_GLOBALS(ncurses, php_ncurses_globals_ctor, NULL);
10096
/* color constants */
10197
PHP_NCURSES_CONST(COLOR_BLACK);
10298
PHP_NCURSES_CONST(COLOR_RED);
@@ -255,6 +251,8 @@ PHP_MINIT_FUNCTION(ncurses)
255251
PHP_NCURSES_CONST(ALL_MOUSE_EVENTS);
256252
PHP_NCURSES_CONST(REPORT_MOUSE_POSITION);
257253

254+
ZEND_INIT_MODULE_GLOBALS(ncurses, php_ncurses_init_globals, NULL);
255+
258256
le_ncurses_windows = zend_register_list_destructors_ex(ncurses_destruct_window, NULL, "ncurses_window", module_number);
259257
#if HAVE_NCURSES_PANEL
260258
le_ncurses_panels = zend_register_list_destructors_ex(ncurses_destruct_panel, NULL, "ncurses_panel", module_number);

0 commit comments

Comments
 (0)