From 5604697de2e8507e991448d5fc3aa425ea585367 Mon Sep 17 00:00:00 2001 From: Yoshio HANAWA Date: Wed, 21 Nov 2012 23:45:55 +0900 Subject: [PATCH] Fix memory leak / Add version info for phpinfo() --- php_timecop.h | 2 ++ timecop.c | 11 ++++------- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/php_timecop.h b/php_timecop.h index 6a6e8a6..d0ac89e 100644 --- a/php_timecop.h +++ b/php_timecop.h @@ -21,6 +21,8 @@ #ifndef PHP_TIMECOP_H #define PHP_TIMECOP_H +#define PHP_TIMECOP_VERSION "1.0.0" + extern zend_module_entry timecop_module_entry; #define phpext_timecop_ptr &timecop_module_entry diff --git a/timecop.c b/timecop.c index 0043032..d83937a 100644 --- a/timecop.c +++ b/timecop.c @@ -191,7 +191,7 @@ static zend_function_entry timecop_datetime_class_functions[] = { static void timecop_globals_ctor(zend_timecop_globals *globals TSRMLS_DC); -static int init_timecop_datetime(TSRMLS_D); +static int register_timecop_classes(TSRMLS_D); static int timecop_func_override(TSRMLS_D); static int timecop_class_override(TSRMLS_D); static int timecop_func_override_clear(TSRMLS_D); @@ -259,6 +259,7 @@ PHP_MINIT_FUNCTION(timecop) { ZEND_INIT_MODULE_GLOBALS(timecop, timecop_globals_ctor, NULL); REGISTER_INI_ENTRIES(); + register_timecop_classes(TSRMLS_C); return SUCCESS; } /* }}} */ @@ -278,8 +279,6 @@ PHP_RINIT_FUNCTION(timecop) int ret; zend_class_entry *parent_ce; - init_timecop_datetime(TSRMLS_C); - if (TIMECOP_G(func_override)) { if (SUCCESS != timecop_func_override(TSRMLS_C) || SUCCESS != timecop_class_override(TSRMLS_C)) { @@ -287,9 +286,6 @@ PHP_RINIT_FUNCTION(timecop) } } - - - return SUCCESS; } /* }}} */ @@ -319,13 +315,14 @@ PHP_MINFO_FUNCTION(timecop) { php_info_print_table_start(); php_info_print_table_header(2, "timecop", "enabled"); + php_info_print_table_row(2, "Version", PHP_TIMECOP_VERSION); php_info_print_table_end(); DISPLAY_INI_ENTRIES(); } /* }}} */ -static int init_timecop_datetime(TSRMLS_D) +static int register_timecop_classes(TSRMLS_D) { zend_class_entry **pce; zend_class_entry ce;