embed strings into structs
They are mostly not even as large as the talloc header used to
dynamically allocate them, and they are also not "shared" by anything.
Change-Id: I7b46d531c5d3b53984f2ce44538116973f6a074d
diff --git a/src/libosmo-mgcp/mgcp_protocol.c b/src/libosmo-mgcp/mgcp_protocol.c
index 16b7dab..736b071 100644
--- a/src/libosmo-mgcp/mgcp_protocol.c
+++ b/src/libosmo-mgcp/mgcp_protocol.c
@@ -273,7 +273,7 @@
* us for OSMUX connections. Perhaps adding a new internal API to get it
* based on conn type.
*/
- const char *addr = endp->cfg->local_ip ? : conn->end.local_addr;
+ const char *addr = strlen(endp->cfg->local_ip) ? endp->cfg->local_ip : conn->end.local_addr;
struct msgb *sdp;
int rc;
struct msgb *result;
@@ -1615,8 +1615,8 @@
cfg->net_ports.last_port = cfg->net_ports.range_start;
cfg->source_port = 2427;
- cfg->source_addr = talloc_strdup(cfg, "0.0.0.0");
- cfg->osmux_addr = talloc_strdup(cfg, "0.0.0.0");
+ osmo_strlcpy(cfg->source_addr, "0.0.0.0", sizeof(cfg->source_addr));
+ osmo_strlcpy(cfg->osmux_addr, "0.0.0.0", sizeof(cfg->osmux_addr));
cfg->rtp_processing_cb = &mgcp_rtp_processing_default;
cfg->setup_rtp_processing_cb = &mgcp_setup_rtp_processing_default;