[Asterisk-code-review] res pjsip pubsub.c: Implement "pjsip show subscriptions" com... (asterisk[master])
Mark Michelson
asteriskteam at digium.com
Fri Jan 20 16:19:53 CST 2017
Mark Michelson has posted comments on this change. ( https://gerrit.asterisk.org/4747 )
Change subject: res_pjsip_pubsub.c: Implement "pjsip show subscriptions" commands.
......................................................................
Patch Set 1: Code-Review-1
(3 comments)
https://gerrit.asterisk.org/#/c/4747/1/res/res_pjsip_pubsub.c
File res/res_pjsip_pubsub.c:
This would not compile for me because there was no inclusion of asterisk/cli.h at the top of the file.
PS1, Line 3800: ast_str_append(&buf, 0, "Resource: %s\n", sub_tree->root->resource);
: ast_str_append(&buf, 0, "Event: %s\n", sub_tree->root->handler->event_name);
: ast_str_append(&buf, 0, "Expiry: %d\n", cli_subscription_expiry(sub_tree));
:
: sip_subscription_to_ami(sub_tree, &buf);
:
: /* Convert AMI \r\n to \n line terminators. */
: src = strchr(ast_str_buffer(buf), '\r');
: if (src) {
: dest = src;
: ++src;
: while (*src) {
: if (*src == '\r') {
: ++src;
: continue;
: }
: *dest++ = *src++;
: }
: *dest = '\0';
: ast_str_update(buf);
: }
:
: ast_cli(cli->a->fd, "%s", ast_str_buffer(buf));
: ast_free(buf);
I hate to be that guy, but the output of this CLI command is completely inconsistent with the rest of the "pjsip show X" commands.
Line 4131: cli.like = ast_calloc(1, sizeof(*cli.like));
Out of curiosity, why are cli.like and cli.buf heap-allocated? Is there a fear of a stack overflow if they were stack-allocated instead?
--
To view, visit https://gerrit.asterisk.org/4747
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Ifb8a3b61f447aedc58a8e6b36a810f7566018567
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>
Gerrit-HasComments: Yes
More information about the asterisk-code-review
mailing list