[Asterisk-code-review] res_pjsip_pubsub: provide a display name for RLS subscriptions (asterisk[16])

Kevin Harwell asteriskteam at digium.com
Fri Feb 11 16:00:31 CST 2022


Attention is currently required from: Alexei Gradinari.
Kevin Harwell has posted comments on this change. ( https://gerrit.asterisk.org/c/asterisk/+/17954 )

Change subject: res_pjsip_pubsub: provide a display name for RLS subscriptions
......................................................................


Patch Set 2: Code-Review-1

(2 comments)

File configs/samples/pjsip.conf.sample:

https://gerrit.asterisk.org/c/asterisk/+/17954/comment/578122c8_f9ca8401 
PS2, Line 1460:                            ; If disabled the resource name will be '1234'.
If disabled I think the name is 'user1234' vs '1234' correct?


File res/res_pjsip_pubsub.c:

https://gerrit.asterisk.org/c/asterisk/+/17954/comment/b611e5bd_7cb7d1cd 
PS2, Line 1253: 		const char *resource, char *display_name, struct sip_subscription_tree *tree)
              : {
              : 	struct ast_sip_subscription *sub;
              : 	pjsip_sip_uri *contact_uri;
              : 
              : 	sub = ast_calloc(1, sizeof(*sub) + strlen(resource) + 1);
              : 	if (!sub) {
              : 		return NULL;
              : 	}
              : 	strcpy(sub->resource, resource); /* Safe */
              : 
              : 	sub->display_name = display_name;
Since the subscription here is taking ownership of the display_name memory make display_name a const parameter and then dupe it here when setting vs. requiring the caller to dupe the string prior to calling.

It's easier to trace allocation that way (done in one spot) and freeing (also done in one spot). Callers are also ensured the string they pass in is not being modified.



-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/17954
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 16
Gerrit-Change-Id: Ic5306bd5a7c73d03f5477fe235e9b0f41c69c681
Gerrit-Change-Number: 17954
Gerrit-PatchSet: 2
Gerrit-Owner: Alexei Gradinari <alex2grad at gmail.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-Attention: Alexei Gradinari <alex2grad at gmail.com>
Gerrit-Comment-Date: Fri, 11 Feb 2022 22:00:31 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20220211/62e9e803/attachment.html>


More information about the asterisk-code-review mailing list