summaryrefslogtreecommitdiff
path: root/ext/mysqlnd/mysqlnd_statistics.c
diff options
context:
space:
mode:
authorAndrey Hristov <andrey@php.net>2008-01-29 12:00:52 +0000
committerAndrey Hristov <andrey@php.net>2008-01-29 12:00:52 +0000
commit2687e55829be31a1882e514b79a009526342c77b (patch)
tree33ca3d927588d0295e4fdfdba7b635a04f9fad85 /ext/mysqlnd/mysqlnd_statistics.c
parent76640a615f489a7efa8bec9e81f5094340619a04 (diff)
downloadphp-git-2687e55829be31a1882e514b79a009526342c77b.tar.gz
Moved initialization into a separate function
Diffstat (limited to 'ext/mysqlnd/mysqlnd_statistics.c')
-rw-r--r--ext/mysqlnd/mysqlnd_statistics.c26
1 files changed, 26 insertions, 0 deletions
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