Change in osmo-mgw[master]: mgcp_lco: get rid of struct member "string"

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

dexter gerrit-no-reply at lists.osmocom.org
Wed Jun 6 11:18:22 UTC 2018


dexter has uploaded this change for review. ( https://gerrit.osmocom.org/9473


Change subject: mgcp_lco: get rid of struct member "string"
......................................................................

mgcp_lco: get rid of struct member "string"

struct mgcp_lco there contains a struct member "string", which is
a char pointer. This pointer is populated with a copy of the LCO
string that has been received via MGCP. However, this memory is
used only when parsing the LCO options and then never again. This
struct member requires handling using talloc and complicates things
unnecessarily, so lets remove it.

- Remove struct member "string" from struct mgcp_lco

Change-Id: I6715c7178033f1b94d6561ef0a6e97fe106f67bd
---
M include/osmocom/mgcp/mgcp_internal.h
M src/libosmo-mgcp/mgcp_endp.c
M src/libosmo-mgcp/mgcp_protocol.c
3 files changed, 2 insertions(+), 8 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/73/9473/1

diff --git a/include/osmocom/mgcp/mgcp_internal.h b/include/osmocom/mgcp/mgcp_internal.h
index 7a00c98..382becb 100644
--- a/include/osmocom/mgcp/mgcp_internal.h
+++ b/include/osmocom/mgcp/mgcp_internal.h
@@ -149,7 +149,6 @@
 };
 
 struct mgcp_lco {
-	char *string;
 	char *codec;
 	int pkt_period_min; /* time in ms */
 	int pkt_period_max; /* time in ms */
diff --git a/src/libosmo-mgcp/mgcp_endp.c b/src/libosmo-mgcp/mgcp_endp.c
index fa2dd28..aebf19c 100644
--- a/src/libosmo-mgcp/mgcp_endp.c
+++ b/src/libosmo-mgcp/mgcp_endp.c
@@ -48,8 +48,6 @@
 	/* Reset endpoint parameters and states */
 	talloc_free(endp->callid);
 	endp->callid = NULL;
-	talloc_free(endp->local_options.string);
-	endp->local_options.string = NULL;
 	talloc_free(endp->local_options.codec);
 	endp->local_options.codec = NULL;
 	endp->wildcarded_req = false;
diff --git a/src/libosmo-mgcp/mgcp_protocol.c b/src/libosmo-mgcp/mgcp_protocol.c
index ded1552..9fdaf18 100644
--- a/src/libosmo-mgcp/mgcp_protocol.c
+++ b/src/libosmo-mgcp/mgcp_protocol.c
@@ -410,15 +410,12 @@
 	if (strlen(options) == 0)
 		return 0;
 
-	talloc_free(lco->string);
-	lco->string = talloc_strdup(ctx, options ? options : "");
-
-	p_opt = strstr(lco->string, "p:");
+	p_opt = strstr(options, "p:");
 	if (p_opt && sscanf(p_opt, "p:%d-%d",
 			    &lco->pkt_period_min, &lco->pkt_period_max) == 1)
 		lco->pkt_period_max = lco->pkt_period_min;
 
-	a_opt = strstr(lco->string, "a:");
+	a_opt = strstr(options, "a:");
 	if (a_opt && sscanf(a_opt, "a:%8[^,]", codec) == 1) {
 		talloc_free(lco->codec);
 		lco->codec = talloc_strdup(ctx, codec);

-- 
To view, visit https://gerrit.osmocom.org/9473
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6715c7178033f1b94d6561ef0a6e97fe106f67bd
Gerrit-Change-Number: 9473
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180606/c6c496fb/attachment.htm>


More information about the gerrit-log mailing list