Author: ahristov
Date: 2007-09-04 16:50:02 +0200 (Tue, 04 Sep 2007)
New Revision: 981
Modified:
trunk/mysqlnd/mysqlnd_debug.c
trunk/mysqlnd/mysqlnd_palloc.c
Log:
'm' now covers also mysqlnd_pallo.c
Modified: trunk/mysqlnd/mysqlnd_debug.c
===================================================================
--- trunk/mysqlnd/mysqlnd_debug.c 2007-09-04 10:26:20 UTC (rev 980)
+++ trunk/mysqlnd/mysqlnd_debug.c 2007-09-04 14:50:02 UTC (rev 981)
@@ -57,8 +57,9 @@
static const char * mysqlnd_calloc_name = "_mysqlnd_calloc";
static const char * mysqlnd_realloc_name = "_mysqlnd_realloc";
static const char * mysqlnd_free_name = "_mysqlnd_free";
+static const char * mysqlnd_palloc_zval_ptr_dtor_name = "mysqlnd_palloc_zval_ptr_dtor";
+static const char * mysqlnd_palloc_get_zval_name = "mysqlnd_palloc_get_zval";
-
/* {{{ mysqlnd_debug::open */
static enum_func_status
MYSQLND_METHOD(mysqlnd_debug, open)(MYSQLND_DEBUG * self, zend_bool reopen)
@@ -303,7 +304,8 @@
func_name == mysqlnd_efree_name || func_name == mysqlnd_pefree_name ||
func_name == mysqlnd_efree_name || func_name == mysqlnd_pefree_name ||
func_name == mysqlnd_malloc_name || func_name == mysqlnd_calloc_name ||
- func_name == mysqlnd_realloc_name || func_name == mysqlnd_free_name)) {
+ func_name == mysqlnd_realloc_name || func_name == mysqlnd_free_name ||
+ func_name == mysqlnd_palloc_zval_ptr_dtor_name || func_name ==
mysqlnd_palloc_get_zval_name)) {
zend_stack_push(&self->call_stack, "", sizeof(""));
return FALSE;
}
Modified: trunk/mysqlnd/mysqlnd_palloc.c
===================================================================
--- trunk/mysqlnd/mysqlnd_palloc.c 2007-09-04 10:26:20 UTC (rev 980)
+++ trunk/mysqlnd/mysqlnd_palloc.c 2007-09-04 14:50:02 UTC (rev 981)
@@ -25,9 +25,7 @@
#include "mysqlnd_palloc.h"
#include "mysqlnd_debug.h"
-#define MYSQLND_SILENT
-
#ifdef ZTS
#define LOCK_PCACHE(cache) tsrm_mutex_lock((cache)->LOCK_access)
#define UNLOCK_PCACHE(cache) tsrm_mutex_unlock((cache)->LOCK_access)
@@ -49,10 +47,10 @@
{
MYSQLND_ZVAL_PCACHE *ret = calloc(1, sizeof(MYSQLND_ZVAL_PCACHE));
unsigned int i;
-#ifndef MYSQLND_SILENT
- php_printf("[mysqlnd_palloc_init_cache %p]\n", ret);
-#endif
+ DBG_ENTER("_mysqlnd_palloc_init_cache");
+ DBG_INF_FMT("cache=%p size=%u", ret, cache_size);
+
#ifdef ZTS
ret->LOCK_access = tsrm_mutex_alloc();
#endif
@@ -78,9 +76,8 @@
/* 2. Add to the free list */
*(--ret->free_list.last_added) = &(ret->block[i]);
}
-
- return ret;
+ DBG_RETURN(ret);
}
/* }}} */
@@ -108,9 +105,8 @@
*/
void _mysqlnd_palloc_free_cache(MYSQLND_ZVAL_PCACHE *cache TSRMLS_DC)
{
-#ifndef MYSQLND_SILENT
- php_printf("[mysqlnd_palloc_free_cache %p]\n", cache);
-#endif
+ DBG_ENTER("_mysqlnd_palloc_free_cache");
+ DBG_INF_FMT("cache=%p", cache);
#ifdef ZTS
tsrm_mutex_free(cache->LOCK_access);
@@ -120,6 +116,8 @@
mnd_free(cache->block);
mnd_free(cache->free_list.ptr_line);
mnd_free(cache);
+
+ DBG_VOID_RETURN;
}
/* }}} */
@@ -128,9 +126,9 @@
PHPAPI MYSQLND_THD_ZVAL_PCACHE* _mysqlnd_palloc_init_thd_cache(MYSQLND_ZVAL_PCACHE *
const cache TSRMLS_DC)
{
MYSQLND_THD_ZVAL_PCACHE *ret = calloc(1, sizeof(MYSQLND_THD_ZVAL_PCACHE));
-#ifndef MYSQLND_SILENT
- php_printf("[mysqlnd_palloc_init_thd_cache %p]\n", ret);
-#endif
+ DBG_ENTER("_mysqlnd_palloc_init_thd_cache");
+ DBG_INF_FMT("ret = %p", ret);
+
ret->parent = mysqlnd_palloc_get_cache_reference(cache);
#ifdef ZTS
@@ -144,7 +142,7 @@
/* Backward and forward looping is possible */
ret->gc_list.last_added = ret->gc_list.ptr_line;
- return ret;
+ DBG_RETURN(ret);
}
/* }}} */
@@ -172,12 +170,13 @@
static
void mysqlnd_palloc_free_thd_cache(MYSQLND_THD_ZVAL_PCACHE *cache TSRMLS_DC)
{
-#ifndef MYSQLND_SILENT
- php_printf("[mysqlnd_palloc_free_thd_cache %p]\n", cache);
-#endif
+ DBG_ENTER("mysqlnd_palloc_free_thd_cache");
+ DBG_INF_FMT("cache=%p", cache);
mnd_free(cache->gc_list.ptr_line);
mnd_free(cache);
+
+ DBG_VOID_RETURN;
}
/* }}} */
@@ -185,10 +184,9 @@
/* {{{ _mysqlnd_palloc_free_thd_cache_reference */
PHPAPI void _mysqlnd_palloc_free_thd_cache_reference(MYSQLND_THD_ZVAL_PCACHE **cache
TSRMLS_DC)
{
+ DBG_ENTER("_mysqlnd_palloc_free_thd_cache_reference");
if (*cache) {
-#ifndef MYSQLND_SILENT
- php_printf("[mysqlnd_palloc_free_thd_cache_reference %p] refs=%d\n", *cache,
(*cache)->references);
-#endif
+ DBG_INF_FMT("cache=%p refs=%d", *cache, (*cache)->references);
--(*cache)->parent->references;
if (--(*cache)->references == 0) {
@@ -196,6 +194,7 @@
}
*cache = NULL;
}
+ DBG_VOID_RETURN;
}
/* }}} */
@@ -290,12 +289,10 @@
{
void *ret = NULL;
-#if MYSQLND_DEBUG_MEMORY
DBG_ENTER("mysqlnd_palloc_get_zval");
DBG_INF_FMT("cache=%p *last_added=%p free_items=%d",
thd_cache, thd_cache? thd_cache->parent->free_list.last_added:NULL,
thd_cache->parent->free_items);
-#endif
if (thd_cache) {
MYSQLND_ZVAL_PCACHE *cache = thd_cache->parent;
@@ -330,12 +327,8 @@
ZVAL_ADDREF(&(((mysqlnd_zval *)ret)->zv));
}
-#if MYSQLND_DEBUG_MEMORY
DBG_INF_FMT("allocated=%d ret=%p", *allocated, ret);
DBG_RETURN(ret);
-#else
- return ret;
-#endif
}
/* }}} */
@@ -345,14 +338,12 @@
enum_mysqlnd_res_type type, zend_bool *copy_ctor_called TSRMLS_DC)
{
MYSQLND_ZVAL_PCACHE *cache;
-#if MYSQLND_DEBUG_MEMORY
DBG_ENTER("mysqlnd_palloc_zval_ptr_dtor");
- DBG_INF_FMT("cache=%p parent_block=%p last_in_block=%p *zv=%p type=%d refc=%d\n",
+ DBG_INF_FMT("cache=%p parent_block=%p last_in_block=%p *zv=%p refc=%d type=%d ",
thd_cache,
thd_cache->parent? thd_cache->parent->block:NULL,
thd_cache->parent? thd_cache->parent->last_in_block:NULL,
- *zv, type, ZVAL_REFCOUNT(*zv));
-#endif
+ *zv, ZVAL_REFCOUNT(*zv), type);
*copy_ctor_called = FALSE;
/* Check whether cache is used and the zval is from the cache */
if (!thd_cache || !(cache = thd_cache->parent) || ((char *)*zv < (char
*)thd_cache->parent->block ||
@@ -389,10 +380,7 @@
}
}
zval_ptr_dtor(zv);
-#if MYSQLND_DEBUG_MEMORY
DBG_VOID_RETURN;
-#endif
- return;
}
/* The zval is from our cache */
@@ -452,9 +440,7 @@
UNLOCK_PCACHE(cache);
}
-#if MYSQLND_DEBUG_MEMORY
DBG_VOID_RETURN;
-#endif
}
/* }}} */
@@ -472,9 +458,10 @@
{
MYSQLND_ZVAL_PCACHE *cache;
mysqlnd_zval **p;
-#ifndef MYSQLND_SILENT
- php_printf("[mysqlnd_palloc_rshutdown %p]\n", thd_cache);
-#endif
+
+ DBG_ENTER("_mysqlnd_palloc_rshutdown");
+ DBG_INF_FMT("cache=%p", thd_cache);
+
if (!thd_cache || !(cache = thd_cache->parent)) {
return;
}
@@ -504,6 +491,8 @@
UNLOCK_PCACHE(cache);
mysqlnd_palloc_free_thd_cache_reference(&thd_cache);
+
+ DBG_VOID_RETURN;
}
/* }}} */
| Thread |
|---|
| • PHP mysqlnd svn commit: r981 - trunk/mysqlnd | ahristov | 4 Sep |