MT#55283 add call_strdup_str helper

Change-Id: I338f1a90890701fe202179f8079f564a50dce5f0
pull/1870/head
Richard Fuchs 8 months ago
parent b6bbf58383
commit 1b4b0d1611

@ -2675,13 +2675,11 @@ static void __call_monologue_init_from_flags(struct call_monologue *ml, struct c
(!ml->sdp_session_name || /* if not set yet */
(ml->sdp_session_name && !flags->replace_sess_name))) /* replace_sess_name = do not replace if possible*/
{
ml->sdp_session_name = call_strdup_len(flags->session_sdp_name.s,
flags->session_sdp_name.len);
ml->sdp_session_name = call_strdup_str(&flags->session_sdp_name);
}
/* sdp session timing */
if (flags->session_timing.len)
ml->sdp_session_timing = call_strdup_len(flags->session_timing.s,
flags->session_timing.len);
ml->sdp_session_timing = call_strdup_str(&flags->session_timing);
/* sdp bandwidth per session level
* 0 value is supported (e.g. b=RR:0 and b=RS:0), to be able to disable rtcp */
ml->sdp_session_bandwidth.as = flags->session_bandwidth.as;
@ -2691,8 +2689,7 @@ static void __call_monologue_init_from_flags(struct call_monologue *ml, struct c
ml->sdp_session_bandwidth.tias = flags->session_bandwidth.tias;
/* sdp session group */
if (flags->session_group.len)
ml->sdp_session_group = call_strdup_len(flags->session_group.s,
flags->session_group.len);
ml->sdp_session_group = call_strdup_str(&flags->session_group);
}
// reset offer ipv4/ipv6/mixed media stats

@ -1490,10 +1490,10 @@ static int redis_tags(call_t *c, struct redis_list *tags, parser_arg arg) {
/* s= */
if (!redis_hash_get_str(&s, rh, "sdp_session_name"))
ml->sdp_session_name = call_strdup_len(s.s, s.len);
ml->sdp_session_name = call_strdup_str(&s);
/* t= */
if (!redis_hash_get_str(&s, rh, "sdp_session_timing"))
ml->sdp_session_timing = call_strdup_len(s.s, s.len);
ml->sdp_session_timing = call_strdup_str(&s);
/* o= */
if (!redis_hash_get_str(&s, rh, "sdp_orig_parsed")) {
ml->session_sdp_orig = g_slice_alloc0(sizeof(*ml->session_sdp_orig));

@ -880,6 +880,11 @@ INLINE char *call_strdup(const char *s) {
return NULL;
return call_strdup_len(s, strlen(s));
}
INLINE char *call_strdup_str(const str *s) {
if (!s)
return NULL;
return call_strdup_len(s->s, s->len);
}
INLINE str call_str_cpy_len(const char *in, size_t len) {
str out;
if (!in) {

Loading…
Cancel
Save