00001
00002 #ifndef _NULLPO_H_
00003 #define _NULLPO_H_
00004
00005 #define NULLPO_CHECK 1
00006
00007 #if __STDC_VERSION__ < 199901L
00008 # if __GNUC__ >= 2
00009 # define __func__ __FUNCTION__
00010 # else
00011 # define __func__ ""
00012 # endif
00013 #endif
00014
00015 #ifdef LCCWIN32
00016
00017 #define __attribute__(x) // nothing
00018 #endif
00019
00020 #define NLP_MARK __FILE__, __LINE__, __func__
00021
00022
00023
00024
00025
00026 #if NULLPO_CHECK
00027
00028 void nullpo_info_core_simple(const char *file, int line, const char *func);
00029
00030 #define nullpo_ret(t) if (!(t)) { nullpo_info_core_simple(NLP_MARK); return 0; }
00031 #define nullpo_retv(t) if (!(t)) { nullpo_info_core_simple(NLP_MARK); return; }
00032 #define nullpo_retr(ret, t) if (!(t)) { nullpo_info_core_simple(NLP_MARK); return (ret); }
00033
00034 #else
00035
00036
00037 #define nullpo_ret(t) if ((t)) { ; }
00038 #define nullpo_retv(t) if ((t)) { ;}
00039 #define nullpo_retr(ret, t) if ((t)) { ; }
00040
00041 #endif
00042
00043 #endif // _NULLPO_H_