andrey                                   Wed, 04 May 2011 19:05:19 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=310767

Log:
reorganize the DBG_ macros, add DBG_BLOCK_XXX

Changed paths:
    U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.h
    U   php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.h
===================================================================
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.h    2011-05-04 
18:14:25 UTC (rev 310766)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.h    2011-05-04 
19:05:19 UTC (rev 310767)
@@ -90,6 +90,15 @@
 #define DBG_INF_FMT_EX(dbg_obj, ...)   do { if (dbg_skip_trace == FALSE) 
(dbg_obj)->m->log_va((dbg_obj), __LINE__, __FILE__, -1, "info : ", 
__VA_ARGS__); } while (0)
 #define DBG_ERR_FMT_EX(dbg_obj, ...)   do { if (dbg_skip_trace == FALSE) 
(dbg_obj)->m->log_va((dbg_obj), __LINE__, __FILE__, -1, "error: ", 
__VA_ARGS__); } while (0)

+#define DBG_BLOCK_ENTER_EX(dbg_obj, block_name) \
+               { \
+                       DBG_ENTER_EX(dbg_obj, (block_name));
+
+#define DBG_BLOCK_LEAVE_EX(dbg_obj) \
+                       DBG_LEAVE_EX((dbg_obj), ;) \
+               } \
+
+
 #define DBG_ENTER_EX(dbg_obj, func_name) \
                                        struct timeval __dbg_prof_tp = {0}; \
                                        uint64_t __dbg_prof_start = 0; /* 
initialization is needed */ \
@@ -103,7 +112,7 @@
                                                } \
                                        } while (0);

-#define DBG_RETURN_EX(dbg_obj, value)  \
+#define DBG_LEAVE_EX(dbg_obj, leave)   \
                        do {\
                                if ((dbg_obj)) { \
                                        uint64_t this_call_duration = 0; \
@@ -112,20 +121,15 @@
                                        } \
                                        (dbg_obj)->m->func_leave((dbg_obj), 
__LINE__, __FILE__, this_call_duration); \
                                } \
-                               return (value);\
-                       } while (0)
-#define DBG_VOID_RETURN_EX(dbg_obj)    \
-                       do {\
-                               if ((dbg_obj)) { \
-                                       uint64_t this_call_duration = 0; \
-                                       if ((dbg_obj)->flags & 
MYSQLND_DEBUG_PROFILE_CALLS) { \
-                                               
DBG_PROFILE_END_TIME(this_call_duration); \
-                                       } \
-                                       (dbg_obj)->m->func_leave((dbg_obj), 
__LINE__, __FILE__, this_call_duration); \
-                               } \
-                               return;\
-                       } while (0)
+                               leave \
+                       } while (0);

+#define DBG_RETURN_EX(dbg_obj, value) DBG_LEAVE_EX(dbg_obj, return (value);)
+
+#define DBG_VOID_RETURN_EX(dbg_obj) DBG_LEAVE_EX(dbg_obj, return;)
+
+
+
 #else
 static inline void DBG_INF_EX(MYSQLND_DEBUG * dbg_obj, const char * const msg) 
{}
 static inline void DBG_ERR_EX(MYSQLND_DEBUG * dbg_obj, const char * const msg) 
{}
@@ -134,6 +138,7 @@
 static inline void DBG_ENTER_EX(MYSQLND_DEBUG * dbg_obj, const char * const 
func_name) {}
 #define DBG_RETURN_EX(dbg_obj, value) return (value)
 #define DBG_VOID_RETURN_EX(dbg_obj) return
+#define DBG_BLOCK_LEAVE_EX(dbg_obj) ;

 #endif /* defined(__GNUC__) || (defined(_MSC_VER) && (_MSC_VER >= 1400)) */

@@ -145,8 +150,10 @@
 #define DBG_ERR_FMT(...)       DBG_ERR_FMT_EX(MYSQLND_G(dbg), __VA_ARGS__)

 #define DBG_ENTER(func_name)   DBG_ENTER_EX(MYSQLND_G(dbg), (func_name))
+#define DBG_BLOCK_ENTER(bname) DBG_BLOCK_ENTER_EX(MYSQLND_G(dbg), (bname))
 #define DBG_RETURN(value)              DBG_RETURN_EX(MYSQLND_G(dbg), (value))
 #define DBG_VOID_RETURN                        
DBG_VOID_RETURN_EX(MYSQLND_G(dbg))
+#define DBG_BLOCK_LEAVE                        
DBG_BLOCK_LEAVE_EX(MYSQLND_G(dbg))

 #elif MYSQLND_DBG_ENABLED == 0

@@ -157,8 +164,10 @@
 static inline void DBG_INF_FMT(const char * const format, ...) {}
 static inline void DBG_ERR_FMT(const char * const format, ...) {}
 static inline void DBG_ENTER(const char * const func_name) {}
-#define DBG_RETURN(value)      return (value)
-#define DBG_VOID_RETURN                return
+#define DBG_BLOCK_ENTER(bname) {
+#define DBG_RETURN(value)              return (value)
+#define DBG_VOID_RETURN                        return
+#define DBG_BLOCK_LEAVE                        }

 #endif


Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.h
===================================================================
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.h       2011-05-04 18:14:25 UTC 
(rev 310766)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.h       2011-05-04 19:05:19 UTC 
(rev 310767)
@@ -101,6 +101,15 @@
 #define DBG_INF_FMT_EX(dbg_obj, ...)   do { if (dbg_skip_trace == FALSE) 
(dbg_obj)->m->log_va((dbg_obj), __LINE__, __FILE__, -1, "info : ", 
__VA_ARGS__); } while (0)
 #define DBG_ERR_FMT_EX(dbg_obj, ...)   do { if (dbg_skip_trace == FALSE) 
(dbg_obj)->m->log_va((dbg_obj), __LINE__, __FILE__, -1, "error: ", 
__VA_ARGS__); } while (0)

+#define DBG_BLOCK_ENTER_EX(dbg_obj, block_name) \
+               { \
+                       DBG_ENTER_EX(dbg_obj, (block_name));
+
+#define DBG_BLOCK_LEAVE_EX(dbg_obj) \
+                       DBG_LEAVE_EX((dbg_obj), ;) \
+               } \
+
+
 #define DBG_ENTER_EX(dbg_obj, func_name) \
                                        struct timeval __dbg_prof_tp = {0}; \
                                        uint64_t __dbg_prof_start = 0; /* 
initialization is needed */ \
@@ -114,7 +123,7 @@
                                                } \
                                        } while (0);

-#define DBG_RETURN_EX(dbg_obj, value)  \
+#define DBG_LEAVE_EX(dbg_obj, leave)   \
                        do {\
                                if ((dbg_obj)) { \
                                        uint64_t this_call_duration = 0; \
@@ -123,20 +132,15 @@
                                        } \
                                        (dbg_obj)->m->func_leave((dbg_obj), 
__LINE__, __FILE__, this_call_duration); \
                                } \
-                               return (value);\
-                       } while (0)
-#define DBG_VOID_RETURN_EX(dbg_obj)    \
-                       do {\
-                               if ((dbg_obj)) { \
-                                       uint64_t this_call_duration = 0; \
-                                       if ((dbg_obj)->flags & 
MYSQLND_DEBUG_PROFILE_CALLS) { \
-                                               
DBG_PROFILE_END_TIME(this_call_duration); \
-                                       } \
-                                       (dbg_obj)->m->func_leave((dbg_obj), 
__LINE__, __FILE__, this_call_duration); \
-                               } \
-                               return;\
-                       } while (0)
+                               leave \
+                       } while (0);

+#define DBG_RETURN_EX(dbg_obj, value) DBG_LEAVE_EX(dbg_obj, return (value);)
+
+#define DBG_VOID_RETURN_EX(dbg_obj) DBG_LEAVE_EX(dbg_obj, return;)
+
+
+
 #else
 static inline void DBG_INF_EX(MYSQLND_DEBUG * dbg_obj, const char * const msg) 
{}
 static inline void DBG_ERR_EX(MYSQLND_DEBUG * dbg_obj, const char * const msg) 
{}
@@ -145,6 +149,7 @@
 static inline void DBG_ENTER_EX(MYSQLND_DEBUG * dbg_obj, const char * const 
func_name) {}
 #define DBG_RETURN_EX(dbg_obj, value) return (value)
 #define DBG_VOID_RETURN_EX(dbg_obj) return
+#define DBG_BLOCK_LEAVE_EX(dbg_obj) ;

 #endif

@@ -156,8 +161,10 @@
 #define DBG_ERR_FMT(...)       DBG_ERR_FMT_EX(MYSQLND_G(dbg), __VA_ARGS__)

 #define DBG_ENTER(func_name)   DBG_ENTER_EX(MYSQLND_G(dbg), (func_name))
+#define DBG_BLOCK_ENTER(bname) DBG_BLOCK_ENTER_EX(MYSQLND_G(dbg), (bname))
 #define DBG_RETURN(value)              DBG_RETURN_EX(MYSQLND_G(dbg), (value))
 #define DBG_VOID_RETURN                        
DBG_VOID_RETURN_EX(MYSQLND_G(dbg))
+#define DBG_BLOCK_LEAVE                        
DBG_BLOCK_LEAVE_EX(MYSQLND_G(dbg))

 #elif MYSQLND_DBG_ENABLED == 0

@@ -166,8 +173,10 @@
 static inline void DBG_INF_FMT(const char * const format, ...) {}
 static inline void DBG_ERR_FMT(const char * const format, ...) {}
 static inline void DBG_ENTER(const char * const func_name) {}
-#define DBG_RETURN(value)      return (value)
-#define DBG_VOID_RETURN                return
+#define DBG_BLOCK_ENTER(bname) {
+#define DBG_RETURN(value)              return (value)
+#define DBG_VOID_RETURN                        return
+#define DBG_BLOCK_LEAVE                        }

 #endif


-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to