[PATCH] Wrap the DEBUG checks in a "unlikely"

Stefan (metze) Metzmacher metze at samba.org
Fri Dec 28 06:59:02 GMT 2007


Jeremy Allison schrieb:
> On Fri, Dec 28, 2007 at 07:51:08AM +0100, Stefan (metze) Metzmacher wrote:
>>>  #define DEBUGADDC( dbgc_class, level, body ) \
>>>    (void)( ((level) <= MAX_DEBUG_LEVEL) && \
>>> -          ((DEBUGLEVEL_CLASS[ dbgc_class ] >= (level))||  \
>>> +          unlikely((DEBUGLEVEL_CLASS[ dbgc_class ] >= (level))||  \
>>>             (!DEBUGLEVEL_CLASS_ISSET[ dbgc_class ] && \
>>>              DEBUGLEVEL_CLASS[ DBGC_ALL   ] >= (level))  ) \
>>>         && (dbgtext body) )
>> wouldn't it make sense to put the whole logic into the unlikely?
>>
>>     (void)(unlikely( ((level) <= MAX_DEBUG_LEVEL) && \
>>             ((DEBUGLEVEL_CLASS[ dbgc_class ] >= (level))||  \
>>              (!DEBUGLEVEL_CLASS_ISSET[ dbgc_class ] && \
>>               DEBUGLEVEL_CLASS[ DBGC_ALL   ] >= (level)) )) \
>>            && (dbgtest body) )
> 
> I also think the unlikely macro should be moved into
> include/includes.h for more general use.

I think replace.h would be a better location as it's something specific
to the compiler. And we would not need an extra copy in talloc.c

metze
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 249 bytes
Desc: OpenPGP digital signature
Url : http://lists.samba.org/archive/samba-technical/attachments/20071228/6825d56c/signature.bin


More information about the samba-technical mailing list