andrey Tue Jan 29 11:59:53 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/mysqlnd mysqlnd.c mysqlnd_statistics.c mysqlnd_statistics.h Log: Moved initialization code into a function. http://cvs.php.net/viewvc.cgi/php-src/ext/mysqlnd/mysqlnd.c?r1=1.5.2.11&r2=1.5.2.12&diff_format=u Index: php-src/ext/mysqlnd/mysqlnd.c diff -u php-src/ext/mysqlnd/mysqlnd.c:1.5.2.11 php-src/ext/mysqlnd/mysqlnd.c:1.5.2.12 --- php-src/ext/mysqlnd/mysqlnd.c:1.5.2.11 Mon Jan 28 23:23:08 2008 +++ php-src/ext/mysqlnd/mysqlnd.c Tue Jan 29 11:59:53 2008 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: mysqlnd.c,v 1.5.2.11 2008/01/28 23:23:08 andrey Exp $ */ +/* $Id: mysqlnd.c,v 1.5.2.12 2008/01/29 11:59:53 andrey Exp $ */ #include "php.h" #include "mysqlnd.h" #include "mysqlnd_wireprotocol.h" @@ -133,10 +133,7 @@ mysqlnd_library_initted = TRUE; _mysqlnd_init_ps_subsystem(); /* Should be calloc, as mnd_calloc will reference LOCK_access*/ - mysqlnd_global_stats = calloc(1, sizeof(MYSQLND_STATS)); -#ifdef ZTS - mysqlnd_global_stats->LOCK_access = tsrm_mutex_alloc(); -#endif + mysqlnd_stats_init(&mysqlnd_global_stats); } } /* }}} */ @@ -146,11 +143,7 @@ void mysqlnd_library_end(TSRMLS_D) { if (mysqlnd_library_initted == TRUE) { -#ifdef ZTS - tsrm_mutex_free(mysqlnd_global_stats->LOCK_access); -#endif - /* mnd_free will reference LOCK_access and crash...*/ - free(mysqlnd_global_stats); + mysqlnd_stats_end(mysqlnd_global_stats); mysqlnd_global_stats = NULL; mysqlnd_library_initted = FALSE; } http://cvs.php.net/viewvc.cgi/php-src/ext/mysqlnd/mysqlnd_statistics.c?r1=1.2.2.4&r2=1.2.2.5&diff_format=u Index: php-src/ext/mysqlnd/mysqlnd_statistics.c diff -u php-src/ext/mysqlnd/mysqlnd_statistics.c:1.2.2.4 php-src/ext/mysqlnd/mysqlnd_statistics.c:1.2.2.5 --- php-src/ext/mysqlnd/mysqlnd_statistics.c:1.2.2.4 Wed Jan 23 19:11:28 2008 +++ php-src/ext/mysqlnd/mysqlnd_statistics.c Tue Jan 29 11:59:53 2008 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: mysqlnd_statistics.c,v 1.2.2.4 2008/01/23 19:11:28 andrey Exp $ */ +/* $Id: mysqlnd_statistics.c,v 1.2.2.5 2008/01/29 11:59:53 andrey Exp $ */ #include "php.h" #include "mysqlnd.h" #include "mysqlnd_priv.h" @@ -145,6 +145,32 @@ /* }}} */ +/* {{{ mysqlnd_stats_init */ +void +mysqlnd_stats_init(MYSQLND_STATS ** stats) +{ + *stats = calloc(1, sizeof(MYSQLND_STATS)); +#ifdef ZTS + (*stats)->LOCK_access = tsrm_mutex_alloc(); +#endif + +} +/* }}} */ + + +/* {{{ mysqlnd_stats_end */ +void +mysqlnd_stats_end(MYSQLND_STATS * stats) +{ +#ifdef ZTS + tsrm_mutex_free(stats->LOCK_access); +#endif + /* mnd_free will reference LOCK_access and crash...*/ + free(stats); +} +/* }}} */ + + /* * Local variables: * tab-width: 4 http://cvs.php.net/viewvc.cgi/php-src/ext/mysqlnd/mysqlnd_statistics.h?r1=1.4.2.6&r2=1.4.2.7&diff_format=u Index: php-src/ext/mysqlnd/mysqlnd_statistics.h diff -u php-src/ext/mysqlnd/mysqlnd_statistics.h:1.4.2.6 php-src/ext/mysqlnd/mysqlnd_statistics.h:1.4.2.7 --- php-src/ext/mysqlnd/mysqlnd_statistics.h:1.4.2.6 Wed Jan 23 19:11:28 2008 +++ php-src/ext/mysqlnd/mysqlnd_statistics.h Tue Jan 29 11:59:53 2008 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: mysqlnd_statistics.h,v 1.4.2.6 2008/01/23 19:11:28 andrey Exp $ */ +/* $Id: mysqlnd_statistics.h,v 1.4.2.7 2008/01/29 11:59:53 andrey Exp $ */ #ifndef MYSQLND_STATISTICS_H #define MYSQLND_STATISTICS_H @@ -196,6 +196,10 @@ void mysqlnd_fill_stats_hash(const MYSQLND_STATS * const stats, zval *return_value TSRMLS_DC ZEND_FILE_LINE_DC); + +void mysqlnd_stats_init(MYSQLND_STATS ** stats); +void mysqlnd_stats_end(MYSQLND_STATS * stats); + #endif /* MYSQLND_STATISTICS_H */
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php