From 00877eff13cdc174724afa3955439742dbf26102 Mon Sep 17 00:00:00 2001 From: Andrey Hristov Date: Tue, 29 Jan 2008 11:59:53 +0000 Subject: Moved initialization code into a function. --- ext/mysqlnd/mysqlnd_statistics.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'ext/mysqlnd/mysqlnd_statistics.c') diff --git a/ext/mysqlnd/mysqlnd_statistics.c b/ext/mysqlnd/mysqlnd_statistics.c index 3a6a0d51d4..7aaf30ca94 100644 --- a/ext/mysqlnd/mysqlnd_statistics.c +++ b/ext/mysqlnd/mysqlnd_statistics.c @@ -145,6 +145,32 @@ PHPAPI void _mysqlnd_get_client_stats(zval *return_value TSRMLS_DC ZEND_FILE_LIN /* }}} */ +/* {{{ 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 -- cgit v1.2.1