[asterisk-dev] Janitor Project - ast_debug() conversion

Russell Bryant russell at digium.com
Tue Jun 12 14:57:30 CDT 2007


Michael Neuhauser wrote:
> On Tue, 2007-06-12 at 11:18 -0500, Russell Bryant wrote:
>> Currently, you will see code like:
>>
>> if (option_debug)
>>     ast_log(LOG_DEBUG, ...);
>>
>> if (option debug > 3)
>>     ast_log(LOG_DEBUG, ...);
>>
>> Now, that would look like
>>
>> ast_debug(1, ...);
>>
>> ast_debug(3, ...);
> 
> Shouldn't this be ast_debug(4, ...) since ast_debug(level, ...) checks
> for option_debug >= level?

Yes, you are right.  Please excuse my poor example.  :)

> (It also may be a good idea to put parenthesis around "level" in the
> macro definition, i.e., "if (option_debug >= (level))" - who knows what
> complex expressions are passed for level ...)

Agreed.  I will make that change now.

-- 
Russell Bryant
Software Engineer
Digium, Inc.


More information about the asterisk-dev mailing list