[Asterisk-code-review] Replace direct checks of option debug with DEBUG ATLEAST macro. (asterisk[13])

Richard Mudgett asteriskteam at digium.com
Wed Mar 7 11:02:04 CST 2018


Richard Mudgett has posted comments on this change. ( https://gerrit.asterisk.org/8451 )

Change subject: Replace direct checks of option_debug with DEBUG_ATLEAST macro.
......................................................................


Patch Set 1: Code-Review-1

(7 comments)

https://gerrit.asterisk.org/#/c/8451/1/apps/app_directory.c
File apps/app_directory.c:

https://gerrit.asterisk.org/#/c/8451/1/apps/app_directory.c@821
PS1, Line 821: 		ast_debug(2, "Listing matching entries:\n");
             : 		for (ptr = sorted, i = 0; i < count; i++, ptr++) {
             : 			ast_debug(2, "%s: %s\n", ptr[0]->exten, ptr[0]->name);
These ast_debug(2,...) should be replaced with ast_log(LOG_DEBUG,...) since they are now guarded by a common DEBUG_ATLEAST().

ast_debug has DEBUG_ATLEAST built into it.

THIS NEEDS TO BE DONE THROUGHOUT THIS PATCH.


https://gerrit.asterisk.org/#/c/8451/1/channels/chan_sip.c
File channels/chan_sip.c:

https://gerrit.asterisk.org/#/c/8451/1/channels/chan_sip.c@22335
PS1, Line 22335: 	if (!DEBUG_ATLEAST(1) && !sipdebug) {
These tests should now be swapped since DEBUG_ATLEAST is more expensive than checking sipdebug.


https://gerrit.asterisk.org/#/c/8451/1/main/sched.c
File main/sched.c:

https://gerrit.asterisk.org/#/c/8451/1/main/sched.c@37
PS1, Line 37: 	if (DEBUG_ATLEAST(1)) \
            : 		DEBUG_M(a) \
            : 	} while (0)
This should just be defined:
#define DEBUG(a) a

All uses of DEBUG in this file pass the a parameter as an ast_debug() call.


https://gerrit.asterisk.org/#/c/8451/1/main/sched.c@553
PS1, Line 553: 	if (DEBUG_ATLEAST(1))
             : 		ast_sched_dump(con);
We should just call ast_sched_dump() instead.


https://gerrit.asterisk.org/#/c/8451/1/main/sched.c@654
PS1, Line 654: 	if (DEBUG_ATLEAST(1))
             : 		ast_sched_dump(con);
We should just call ast_sched_dump() instead.


https://gerrit.asterisk.org/#/c/8451/1/main/sched.c@713
PS1, Line 713: void ast_sched_dump(struct ast_sched_context *con)
The first thing this function should do is check if DEBUG_ATLEAST() allows dumping the scheduler and the other ast_debug(1,...) calls should become ast_log(LOG_DEBUG,...) calls.


https://gerrit.asterisk.org/#/c/8451/1/res/res_rtp_asterisk.c
File res/res_rtp_asterisk.c:

https://gerrit.asterisk.org/#/c/8451/1/res/res_rtp_asterisk.c@5254
PS1, Line 5254: 			if (DEBUG_ATLEAST(1) || rtpdebug) {
Should swap these tests since DEBUG_ATLEAST() is more expensive than the rtpdebug check.



-- 
To view, visit https://gerrit.asterisk.org/8451
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-MessageType: comment
Gerrit-Change-Id: Ic342d4799a945dbc40ac085ac142681094a4ebf0
Gerrit-Change-Number: 8451
Gerrit-PatchSet: 1
Gerrit-Owner: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
Gerrit-Comment-Date: Wed, 07 Mar 2018 17:02:04 +0000
Gerrit-HasComments: Yes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180307/fbe60633/attachment.html>


More information about the asterisk-code-review mailing list