[Asterisk-code-review] Astobj2: Improve error logging from INTERNAL OBJ. (asterisk[master])

Richard Mudgett asteriskteam at digium.com
Tue Apr 21 12:37:13 CDT 2015


Richard Mudgett has posted comments on this change.

Change subject: Astobj2: Improve error logging from INTERNAL_OBJ.
......................................................................


Patch Set 2: Code-Review-1

(10 comments)

https://gerrit.asterisk.org/#/c/140/2/main/astobj2.c
File main/astobj2.c:

Line 135: __INTERNAL_OBJ(user_data, p ## __LINE__)
This leaves p ## __LINE__ set to non-null if it has a bad magic number.


https://gerrit.asterisk.org/#/c/140/2/main/astobj2_container.c
File main/astobj2_container.c:

Line 52: 		__ao2_ref(node->obj, -1, tag ? tag : "Remove obj from container", file, line, func);
You can use this notation rather than referencing tag twice:
tag ?: "Remove..."


Line 389: 						__ao2_ref(ret, 1, tag ? tag : "Traversal found object", file, line, func);
tag ?: "Traversal..."


Line 604: 			__ao2_ref(ret, +1, tag ? tag : "Next iterator object.", file, line, func);
tag ?: "..."


https://gerrit.asterisk.org/#/c/140/2/main/astobj2_hash.c
File main/astobj2_hash.c:

Line 239: 	__ao2_ref(obj_new, +1, tag ? tag : "Container node creation", file, line, func);
tag ?: "...


https://gerrit.asterisk.org/#/c/140/2/main/astobj2_private.h
File main/astobj2_private.h:

Line 47: int __is_ao2_object(void *user_data);
       : 
       : #define is_ao2_object(user_data, file, line, func) \
Why is this pulled out to always expose file, line, func?
Wny not
__is_ao2_object(void *user_data, file, line, func)

#define is_ao2_object(user_data) __is_ao2_object(user_data, __FILE__, __LINE__, __PRETTY_FUNCTION__)


https://gerrit.asterisk.org/#/c/140/2/main/astobj2_rbtree.c
File main/astobj2_rbtree.c:

Line 931: 	__ao2_ref(obj_new, +1, tag ? tag : "Container node creation", file, line, func);
tag ?: "...


https://gerrit.asterisk.org/#/c/140/2/res/res_musiconhold.c
File res/res_musiconhold.c:

Line 222: 		if (__ao2_ref(dup, -1, (char *) tag, (char *) file, line, funcname) == 2) {
The casts are no longer needed.


Line 229: 		__ao2_ref(class, -1, (char *) tag, (char *) file, line, funcname);
The casts are no longer needed.


Line 1376: 	if ((class = __ao2_alloc(sizeof(*class), moh_class_destructor, AO2_ALLOC_OPT_LOCK_MUTEX,
         : 		"Allocating new moh class", file, line, funcname))) {
Please pull the assignment out of the if test.


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Icf3552721fe999365ba8a8cf00a965aa6b897cc1
Gerrit-PatchSet: 2
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
Gerrit-HasComments: Yes



More information about the asterisk-code-review mailing list