[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gluster-devel] Query regarding GF_ASSERT macro
From: |
Atin Mukherjee |
Subject: |
[Gluster-devel] Query regarding GF_ASSERT macro |
Date: |
Thu, 2 Jan 2014 01:14:10 -0500 (EST) |
I think GF_ASSERT macro should be modified such that in case of no debug build
if x is NULL, after logging an error message it should abort i.e. by calling
assert(). This fix is required as there are places where consecutive GF_ASSERT
macro has been called like :
GF_ASSERT (shandle);
GF_ASSERT (shandle->path);
(store.c : function : gf_store_unlink_tmppath)
Current code:
#ifdef DEBUG
#define GF_ASSERT(x) assert (x);
#else
#define GF_ASSERT(x) \
do { \
if (!(x)) { \
gf_log_callingfn ("", GF_LOG_ERROR, \
"Assertion failed: " #x); \
} \
} while (0)
#endif
Modified code:
#ifdef DEBUG
#define GF_ASSERT(x) assert (x);
#else
#define GF_ASSERT(x) \
do { \
if (!(x)) { \
gf_log_callingfn ("", GF_LOG_ERROR, \
"Assertion failed: " #x); \
assert (x); \
} \
} while (0)
#endif
Please let me know your opinion on this.
Regards,
Atin Mukherjee
Senior Software Engineer
E-9, Extn : 73196, Direct : 08039245196, Mobile: +919739491377
Email - address@hidden
- [Gluster-devel] Query regarding GF_ASSERT macro,
Atin Mukherjee <=
- Re: [Gluster-devel] Query regarding GF_ASSERT macro, Vijay Bellur, 2014/01/02
- Message not available
- Re: [Gluster-devel] Query regarding GF_ASSERT macro, Vijay Bellur, 2014/01/03
- Re: [Gluster-devel] Query regarding GF_ASSERT macro, Harshavardhana, 2014/01/03
- Re: [Gluster-devel] Query regarding GF_ASSERT macro, Xavier Hernandez, 2014/01/03
- Re: [Gluster-devel] Query regarding GF_ASSERT macro, Harshavardhana, 2014/01/03
- Re: [Gluster-devel] Query regarding GF_ASSERT macro, Vijay Bellur, 2014/01/03
- Re: [Gluster-devel] Query regarding GF_ASSERT macro, Harshavardhana, 2014/01/08
- Re: [Gluster-devel] Query regarding GF_ASSERT macro, Pranith Kumar Karampuri, 2014/01/08
- Re: [Gluster-devel] Query regarding GF_ASSERT macro, Vijay Bellur, 2014/01/08
- Re: [Gluster-devel] Query regarding GF_ASSERT macro, Harshavardhana, 2014/01/08