summaryrefslogtreecommitdiff
path: root/src/common/nullpo.h
diff options
context:
space:
mode:
authorFlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-11-19 03:05:16 +0000
committerFlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-11-19 03:05:16 +0000
commitaee3755b6d780c3261bdec2aef4d517bc7c7b148 (patch)
tree71dd1e301aab7780c23db9dd62de0ce7ce85a1d8 /src/common/nullpo.h
parenta0a93b21ebfbf51e3926a6819b46632703c33d90 (diff)
downloadhercules-aee3755b6d780c3261bdec2aef4d517bc7c7b148.tar.gz
hercules-aee3755b6d780c3261bdec2aef4d517bc7c7b148.tar.bz2
hercules-aee3755b6d780c3261bdec2aef4d517bc7c7b148.tar.xz
hercules-aee3755b6d780c3261bdec2aef4d517bc7c7b148.zip
* Nullpo's disabled on release builds.
* Added timestamps to the log of memory leaks. * Moved definition of __func__ to cbasetypes.h. * Configure script updated: - added option to select the memory manager - added option to enable MAPREGSQL - added option to enable DEBUG * common's Makefile deleting svnversion.h on 'clean' target. (run ./configure again to update your Makefile) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11760 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/common/nullpo.h')
-rw-r--r--src/common/nullpo.h49
1 files changed, 18 insertions, 31 deletions
diff --git a/src/common/nullpo.h b/src/common/nullpo.h
index 0238d2b6d..8ee86a782 100644
--- a/src/common/nullpo.h
+++ b/src/common/nullpo.h
@@ -5,28 +5,15 @@
#define _NULLPO_H_
-#define NULLPO_CHECK 1
- // 全体のスイッチを宣言しているヘッダがあれば
- // そこに移動していただけると
-
-#ifndef __NETBSD__
-#if __STDC_VERSION__ < 199901L
-# if __GNUC__ >= 2
-# define __func__ __FUNCTION__
-# else
-# define __func__ ""
-# endif
-#endif
-#endif
+#include "../common/cbasetypes.h"
+#define NLP_MARK __FILE__, __LINE__, __func__
-#if !defined(__GNUC__) && !defined(MINGW)
-# define __attribute__(x) /* nothing */
+// enabled by default on debug builds
+#if defined(DEBUG) && !defined(NULLPO_CHECK)
+#define NULLPO_CHECK
#endif
-
-#define NLP_MARK __FILE__, __LINE__, __func__
-
/*----------------------------------------------------------------------------
* Macros
*----------------------------------------------------------------------------
@@ -81,7 +68,7 @@
*--------------------------------------
*/
-#if NULLPO_CHECK
+#if defined(NULLPO_CHECK)
#define nullpo_ret(t) \
if (nullpo_chk(NLP_MARK, (void *)(t))) {return(0);}
@@ -137,25 +124,25 @@
// 良い方法が思いつかなかったので・・・苦肉の策です。
// 一応ワーニングは出ないはず
-#define nullpo_ret(t) if((t)){;}
-#define nullpo_retv(t) if((t)){;}
-#define nullpo_retr(ret, t) if((t)){;}
-#define nullpo_retb(t) if((t)){;}
+#define nullpo_ret(t) (void)(t)
+#define nullpo_retv(t) (void)(t)
+#define nullpo_retr(ret, t) (void)(t)
+#define nullpo_retb(t) (void)(t)
// 可変引数マクロに関する条件コンパイル
#if __STDC_VERSION__ >= 199901L
/* C99に対応 */
-#define nullpo_ret_f(t, fmt, ...) if((t)){;}
-#define nullpo_retv_f(t, fmt, ...) if((t)){;}
-#define nullpo_retr_f(ret, t, fmt, ...) if((t)){;}
-#define nullpo_retb_f(t, fmt, ...) if((t)){;}
+#define nullpo_ret_f(t, fmt, ...) (void)(t)
+#define nullpo_retv_f(t, fmt, ...) (void)(t)
+#define nullpo_retr_f(ret, t, fmt, ...) (void)(t)
+#define nullpo_retb_f(t, fmt, ...) (void)(t)
#elif __GNUC__ >= 2
/* GCC用 */
-#define nullpo_ret_f(t, fmt, args...) if((t)){;}
-#define nullpo_retv_f(t, fmt, args...) if((t)){;}
-#define nullpo_retr_f(ret, t, fmt, args...) if((t)){;}
-#define nullpo_retb_f(t, fmt, args...) if((t)){;}
+#define nullpo_ret_f(t, fmt, args...) (void)(t)
+#define nullpo_retv_f(t, fmt, args...) (void)(t)
+#define nullpo_retr_f(ret, t, fmt, args...) (void)(t)
+#define nullpo_retb_f(t, fmt, args...) (void)(t)
#else
/* その他の場合・・・ orz */