[Asterisk-code-review] ARI: Deleting log channels (asterisk[master])

Ashley Sanders asteriskteam at digium.com
Thu Aug 6 16:04:10 CDT 2015


Ashley Sanders has posted comments on this change.

Change subject: ARI: Deleting log channels
......................................................................


Patch Set 1: Code-Review-1

(1 comment)

https://gerrit.asterisk.org/#/c/1049/1/main/logger.c
File main/logger.c:

Line 1098: int ast_logger_remove_channel(const char *log_channel)
         : {
         : 	struct logchannel *chan;
         : 	struct ast_str *filename = ast_str_create(64);
         : 
         : 	if (!filename) {
         : 		return -1;
         : 	}
         : 
         : 	ast_str_append(&filename, 0, "%s/%s", ast_config_AST_LOG_DIR, log_channel);
         : 
         : 	AST_RWLIST_WRLOCK(&logchannels);
         : 	AST_RWLIST_TRAVERSE_SAFE_BEGIN(&logchannels, chan, list) {
         : 		if (chan->dynamic && !strcmp(chan->filename, ast_str_buffer(filename))) {
         : 			AST_RWLIST_REMOVE_CURRENT(list);
         : 			break;
         : 		}
         : 	}
         : 	AST_RWLIST_TRAVERSE_SAFE_END;
         : 	AST_RWLIST_UNLOCK(&logchannels);
         : 
         : 	if (!chan) {
         : 		return 1;
         : 	}
         : 
         : 	if (chan->fileptr) {
         : 		fclose(chan->fileptr);
         : 		chan->fileptr = NULL;
         : 	}
         : 	ast_free(chan);
         : 	chan = NULL;
         : 
         : 	return 0;
         : }
I suggest using enums or constants as your return values, to make the code cleaner, like I suggested in review #1042.


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Id6eeb54ebcc511595f0418d586ff55914bc3aae6
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Scott Emidy <jemidy at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Ashley Sanders <asanders at digium.com>
Gerrit-HasComments: Yes



More information about the asterisk-code-review mailing list