summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@php.net>2010-07-08 07:38:59 +0000
committerDmitry Stogov <dmitry@php.net>2010-07-08 07:38:59 +0000
commitdf8bf2a2de49b62265abdb412a9d96a41498884a (patch)
tree6587471e9f4a27549521b893f86942f0392aa041
parentc0c5c1ad4ce2336546e9454f69a0084ca206d879 (diff)
downloadphp-git-df8bf2a2de49b62265abdb412a9d96a41498884a.tar.gz
Fixed checks for PHP_DEBUG macro
-rw-r--r--ext/mysqlnd/mysqlnd_debug.c38
-rw-r--r--ext/mysqlnd/php_mysqlnd.c12
2 files changed, 24 insertions, 26 deletions
diff --git a/ext/mysqlnd/mysqlnd_debug.c b/ext/mysqlnd/mysqlnd_debug.c
index 5022e03edc..e49da24366 100644
--- a/ext/mysqlnd/mysqlnd_debug.c
+++ b/ext/mysqlnd/mysqlnd_debug.c
@@ -626,7 +626,7 @@ mysqlnd_debug_init(const char * skip_functions[] TSRMLS_DC)
/* {{{ _mysqlnd_debug */
PHPAPI void _mysqlnd_debug(const char * mode TSRMLS_DC)
{
-#ifdef PHP_DEBUG
+#if PHP_DEBUG
MYSQLND_DEBUG *dbg = MYSQLND_G(dbg);
if (!dbg) {
MYSQLND_G(dbg) = dbg = mysqlnd_debug_init(mysqlnd_debug_std_no_trace_funcs TSRMLS_CC);
@@ -665,12 +665,12 @@ void * _mysqlnd_emalloc(size_t size MYSQLND_MEM_D)
DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_filename, PHP_DIR_SEPARATOR) + 1, __zend_lineno);
-#ifdef PHP_DEBUG
+#if PHP_DEBUG
/* -1 is also "true" */
if (*threshold) {
#endif
ret = emalloc(REAL_SIZE(size));
-#ifdef PHP_DEBUG
+#if PHP_DEBUG
--*threshold;
} else if (*threshold == 0) {
ret = NULL;
@@ -697,12 +697,12 @@ void * _mysqlnd_pemalloc(size_t size, zend_bool persistent MYSQLND_MEM_D)
DBG_ENTER(mysqlnd_pemalloc_name);
DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_filename, PHP_DIR_SEPARATOR) + 1, __zend_lineno);
-#ifdef PHP_DEBUG
+#if PHP_DEBUG
/* -1 is also "true" */
if (*threshold) {
#endif
ret = pemalloc(REAL_SIZE(size), persistent);
-#ifdef PHP_DEBUG
+#if PHP_DEBUG
--*threshold;
} else if (*threshold == 0) {
ret = NULL;
@@ -733,12 +733,12 @@ void * _mysqlnd_ecalloc(unsigned int nmemb, size_t size MYSQLND_MEM_D)
DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_filename, PHP_DIR_SEPARATOR) + 1, __zend_lineno);
DBG_INF_FMT("before: %lu", zend_memory_usage(FALSE TSRMLS_CC));
-#ifdef PHP_DEBUG
+#if PHP_DEBUG
/* -1 is also "true" */
if (*threshold) {
#endif
ret = ecalloc(nmemb, REAL_SIZE(size));
-#ifdef PHP_DEBUG
+#if PHP_DEBUG
--*threshold;
} else if (*threshold == 0) {
ret = NULL;
@@ -765,12 +765,12 @@ void * _mysqlnd_pecalloc(unsigned int nmemb, size_t size, zend_bool persistent M
DBG_ENTER(mysqlnd_pecalloc_name);
DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_filename, PHP_DIR_SEPARATOR) + 1, __zend_lineno);
-#ifdef PHP_DEBUG
+#if PHP_DEBUG
/* -1 is also "true" */
if (*threshold) {
#endif
ret = pecalloc(nmemb, REAL_SIZE(size), persistent);
-#ifdef PHP_DEBUG
+#if PHP_DEBUG
--*threshold;
} else if (*threshold == 0) {
ret = NULL;
@@ -802,12 +802,12 @@ void * _mysqlnd_erealloc(void *ptr, size_t new_size MYSQLND_MEM_D)
DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_filename, PHP_DIR_SEPARATOR) + 1, __zend_lineno);
DBG_INF_FMT("ptr=%p old_size=%lu, new_size=%lu", ptr, old_size, new_size);
-#ifdef PHP_DEBUG
+#if PHP_DEBUG
/* -1 is also "true" */
if (*threshold) {
#endif
ret = erealloc(REAL_PTR(ptr), REAL_SIZE(new_size));
-#ifdef PHP_DEBUG
+#if PHP_DEBUG
--*threshold;
} else if (*threshold == 0) {
ret = NULL;
@@ -835,12 +835,12 @@ void * _mysqlnd_perealloc(void *ptr, size_t new_size, zend_bool persistent MYSQL
DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_filename, PHP_DIR_SEPARATOR) + 1, __zend_lineno);
DBG_INF_FMT("ptr=%p old_size=%lu new_size=%lu persistent=%u", ptr, old_size, new_size, persistent);
-#ifdef PHP_DEBUG
+#if PHP_DEBUG
/* -1 is also "true" */
if (*threshold) {
#endif
ret = perealloc(REAL_PTR(ptr), REAL_SIZE(new_size), persistent);
-#ifdef PHP_DEBUG
+#if PHP_DEBUG
--*threshold;
} else if (*threshold == 0) {
ret = NULL;
@@ -919,12 +919,12 @@ void * _mysqlnd_malloc(size_t size MYSQLND_MEM_D)
DBG_ENTER(mysqlnd_malloc_name);
DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_filename, PHP_DIR_SEPARATOR) + 1, __zend_lineno);
-#ifdef PHP_DEBUG
+#if PHP_DEBUG
/* -1 is also "true" */
if (*threshold) {
#endif
ret = malloc(REAL_SIZE(size));
-#ifdef PHP_DEBUG
+#if PHP_DEBUG
--*threshold;
} else if (*threshold == 0) {
ret = NULL;
@@ -950,12 +950,12 @@ void * _mysqlnd_calloc(unsigned int nmemb, size_t size MYSQLND_MEM_D)
DBG_ENTER(mysqlnd_calloc_name);
DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_filename, PHP_DIR_SEPARATOR) + 1, __zend_lineno);
-#ifdef PHP_DEBUG
+#if PHP_DEBUG
/* -1 is also "true" */
if (*threshold) {
#endif
ret = calloc(nmemb, REAL_SIZE(size));
-#ifdef PHP_DEBUG
+#if PHP_DEBUG
--*threshold;
} else if (*threshold == 0) {
ret = NULL;
@@ -983,12 +983,12 @@ void * _mysqlnd_realloc(void *ptr, size_t new_size MYSQLND_MEM_D)
DBG_INF_FMT("ptr=%p new_size=%lu ", new_size, ptr);
DBG_INF_FMT("before: %lu", zend_memory_usage(TRUE TSRMLS_CC));
-#ifdef PHP_DEBUG
+#if PHP_DEBUG
/* -1 is also "true" */
if (*threshold) {
#endif
ret = realloc(REAL_PTR(ptr), REAL_SIZE(new_size));
-#ifdef PHP_DEBUG
+#if PHP_DEBUG
--*threshold;
} else if (*threshold == 0) {
ret = NULL;
diff --git a/ext/mysqlnd/php_mysqlnd.c b/ext/mysqlnd/php_mysqlnd.c
index b16b7fc092..a084079f06 100644
--- a/ext/mysqlnd/php_mysqlnd.c
+++ b/ext/mysqlnd/php_mysqlnd.c
@@ -185,7 +185,7 @@ PHP_INI_BEGIN()
STD_PHP_INI_ENTRY("mysqlnd.log_mask", "0", PHP_INI_ALL, OnUpdateLong, log_mask, zend_mysqlnd_globals, mysqlnd_globals)
STD_PHP_INI_ENTRY("mysqlnd.mempool_default_size","16000", PHP_INI_ALL, OnUpdateLong, mempool_default_size, zend_mysqlnd_globals, mysqlnd_globals)
-#ifdef PHP_DEBUG
+#if PHP_DEBUG
STD_PHP_INI_ENTRY("mysqlnd.debug_emalloc_fail_threshold","-1", PHP_INI_SYSTEM, OnUpdateLong, debug_emalloc_fail_threshold, zend_mysqlnd_globals, mysqlnd_globals)
STD_PHP_INI_ENTRY("mysqlnd.debug_ecalloc_fail_threshold","-1", PHP_INI_SYSTEM, OnUpdateLong, debug_ecalloc_fail_threshold, zend_mysqlnd_globals, mysqlnd_globals)
STD_PHP_INI_ENTRY("mysqlnd.debug_erealloc_fail_threshold","-1", PHP_INI_SYSTEM, OnUpdateLong, debug_erealloc_fail_threshold, zend_mysqlnd_globals, mysqlnd_globals)
@@ -222,12 +222,11 @@ static PHP_MSHUTDOWN_FUNCTION(mysqlnd)
/* }}} */
-#if defined(PHP_DEBUG)
+#if PHP_DEBUG
/* {{{ PHP_RINIT_FUNCTION
*/
static PHP_RINIT_FUNCTION(mysqlnd)
{
-#if defined(PHP_DEBUG)
if (MYSQLND_G(debug)) {
MYSQLND_DEBUG *dbg = mysqlnd_debug_init(mysqlnd_debug_std_no_trace_funcs TSRMLS_CC);
if (!dbg) {
@@ -236,14 +235,13 @@ static PHP_RINIT_FUNCTION(mysqlnd)
dbg->m->set_mode(dbg, MYSQLND_G(debug));
MYSQLND_G(dbg) = dbg;
}
-#endif
return SUCCESS;
}
/* }}} */
#endif
-#if defined(PHP_DEBUG)
+#if PHP_DEBUG
/* {{{ PHP_RSHUTDOWN_FUNCTION
*/
static PHP_RSHUTDOWN_FUNCTION(mysqlnd)
@@ -277,12 +275,12 @@ zend_module_entry mysqlnd_module_entry = {
mysqlnd_functions,
PHP_MINIT(mysqlnd),
PHP_MSHUTDOWN(mysqlnd),
-#if defined(PHP_DEBUG)
+#if PHP_DEBUG
PHP_RINIT(mysqlnd),
#else
NULL,
#endif
-#ifdef PHP_DEBUG
+#if PHP_DEBUG
PHP_RSHUTDOWN(mysqlnd),
#else
NULL,