diff options
author | Christopher R. Hertel <crh@samba.org> | 1998-08-11 18:56:03 +0000 |
---|---|---|
committer | Christopher R. Hertel <crh@samba.org> | 1998-08-11 18:56:03 +0000 |
commit | a0082c340a2c577e8ecec8c1e0fefc2765af90dc (patch) | |
tree | 69348f349382d1998fc0869c7148f91f5f6d1c7f /source3 | |
parent | e1b12729f6ddad97285acb4992ed46a76cca7f74 (diff) | |
download | samba-a0082c340a2c577e8ecec8c1e0fefc2765af90dc.tar.gz samba-a0082c340a2c577e8ecec8c1e0fefc2765af90dc.tar.bz2 samba-a0082c340a2c577e8ecec8c1e0fefc2765af90dc.zip |
I've come up with a different scheme for doing the DEBUG() and DEBUGADD()
macros that meets the RVALUE requirement and doesn't use the (a?b:c) format
that Andrew called "ugly". I've added the new macros but kept the old
macros within a #if 0..#else..#endif block in case I've missed somthing.
Basically, I've used
(void)( (a) && (b) )
or
(void)( (a) && (b) && (c) )
instead of
( (a) ? (void)(b) : (void)(c) )
or similar. I have this compiled and running now.
Here's the diff:
$ cvs diff smb.h
Enter passphrase for RSA key 'crh@Ruby':
Index: smb.h
===================================================================
RCS file: /data/cvs/samba/source/include/smb.h,v
retrieving revision 1.172
diff -r1.172 smb.h
143a144,145
> #if 0
>
150a153,164
>
> #else
>
> #define DEBUG( level, body ) \
> (void)( (DEBUGLEVEL >= (level)) \
> && (dbghdr( level, FILE_MACRO, FUNCTION_MACRO, (__LINE__) )) \
> && (dbgtext body) )
>
> #define DEBUGADD( level, body ) \
> (void)( (DEBUGLEVEL >= (level)) && (dbgtext body) )
>
> #endif
Chris -)-----
(This used to be commit 53b433e6ab9fd69a02016ee4f2a3f756640ea565)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/include/smb.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/source3/include/smb.h b/source3/include/smb.h index 5d408719ae..69f98dfdee 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -141,6 +141,8 @@ BOOL dbgtext(); ( (DEBUGLEVEL >= (level)) \ && dbghdr( level, FILE_MACRO, FUNCTION_MACRO, (__LINE__) ) ) +#if 0 + #define DEBUG( level, body ) \ ( ( DEBUGLEVEL >= (level) \ && dbghdr( level, FILE_MACRO, FUNCTION_MACRO, (__LINE__) ) ) \ @@ -149,6 +151,18 @@ BOOL dbgtext(); #define DEBUGADD( level, body ) \ ( (DEBUGLEVEL >= (level)) ? (void)(dbgtext body) : (void)0 ) +#else + +#define DEBUG( level, body ) \ + (void)( (DEBUGLEVEL >= (level)) \ + && (dbghdr( level, FILE_MACRO, FUNCTION_MACRO, (__LINE__) )) \ + && (dbgtext body) ) + +#define DEBUGADD( level, body ) \ + (void)( (DEBUGLEVEL >= (level)) && (dbgtext body) ) + +#endif + /* End Debugging code section. * -------------------------------------------------------------------------- ** */ |