Browse Source

MT#55283 add call_strdup_str helper

Change-Id: I338f1a90890701fe202179f8079f564a50dce5f0
pull/1870/head
Richard Fuchs 1 year ago
parent
commit
1b4b0d1611
3 changed files with 10 additions and 8 deletions
  1. +3
    -6
      daemon/call.c
  2. +2
    -2
      daemon/redis.c
  3. +5
    -0
      include/call.h

+ 3
- 6
daemon/call.c View File

@ -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 || /* if not set yet */
(ml->sdp_session_name && !flags->replace_sess_name))) /* replace_sess_name = do not replace if possible*/ (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 */ /* sdp session timing */
if (flags->session_timing.len) 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 /* sdp bandwidth per session level
* 0 value is supported (e.g. b=RR:0 and b=RS:0), to be able to disable rtcp */ * 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; 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; ml->sdp_session_bandwidth.tias = flags->session_bandwidth.tias;
/* sdp session group */ /* sdp session group */
if (flags->session_group.len) 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 // reset offer ipv4/ipv6/mixed media stats


+ 2
- 2
daemon/redis.c View File

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


+ 5
- 0
include/call.h View File

@ -880,6 +880,11 @@ INLINE char *call_strdup(const char *s) {
return NULL; return NULL;
return call_strdup_len(s, strlen(s)); 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) { INLINE str call_str_cpy_len(const char *in, size_t len) {
str out; str out;
if (!in) { if (!in) {


Loading…
Cancel
Save