From ceb49c9b54aaafc70964b984d3e99c5ce84ce8c2 Mon Sep 17 00:00:00 2001 From: Donat Zenichev Date: Sat, 30 Mar 2024 16:45:05 +0100 Subject: [PATCH] MT#58535 rtpp_flags: deprecate usage of dict for parsing Deprecate a usage of intermediate dictionary for parsing of rtpp flags. Just use the `call_ng_main_flags()` function directly with a given `bencode_buffer_t` buffer. Change-Id: I0bea13b94b6e0016799dd07a50061e1367131106 --- daemon/call_interfaces.c | 12 ++---------- daemon/control_ng_flags_parser.c | 4 +--- include/control_ng_flags_parser.h | 2 +- 3 files changed, 4 insertions(+), 14 deletions(-) diff --git a/daemon/call_interfaces.c b/daemon/call_interfaces.c index 1f25dc61af..c36925e39c 100644 --- a/daemon/call_interfaces.c +++ b/daemon/call_interfaces.c @@ -1828,16 +1828,8 @@ void call_ng_main_flags(sdp_ng_flags *out, str *key, bencode_item_t *value, break; case CSH_LOOKUP("rtpp-flags"): case CSH_LOOKUP("rtpp_flags"):; - /* new dictionary to store rtpp_flags */ - bencode_item_t * dict; - dict = bencode_dictionary(value->buffer); - assert(dict != NULL); - - /* s - parse rtpp flags */ - parse_rtpp_flags(&s, dict, opmode, out); - if (dict && dict->child) - call_ng_dict_iter(out, dict, opmode, call_ng_main_flags); /* recursive */ - + /* s - list of rtpp flags */ + parse_rtpp_flags(&s, value->buffer, opmode, out); break; case CSH_LOOKUP("SDES"): case CSH_LOOKUP("sdes"): diff --git a/daemon/control_ng_flags_parser.c b/daemon/control_ng_flags_parser.c index c1397d0944..81921edc0e 100644 --- a/daemon/control_ng_flags_parser.c +++ b/daemon/control_ng_flags_parser.c @@ -237,13 +237,12 @@ static bool parse_str_flag(str * key, str * val, const char * name, * @param rtpp_flags - raw str rtpp_flags * @param dict - root dict to store encoded flags */ -void parse_rtpp_flags(const str * rtpp_flags, bencode_item_t * root_dict, +void parse_rtpp_flags(const str * rtpp_flags, bencode_buffer_t * buf, enum call_opmode opmode, sdp_ng_flags * out) { char * start, * end, * eptr, c; str key, val; bencode_item_t * direction; - bencode_buffer_t * buf; unsigned int transport = 0; if (!rtpp_flags->s) @@ -253,7 +252,6 @@ void parse_rtpp_flags(const str * rtpp_flags, bencode_item_t * root_dict, c = rtpp_flags->s[rtpp_flags->len]; rtpp_flags->s[rtpp_flags->len] = '\0'; - buf = root_dict->buffer; start = rtpp_flags->s; end = rtpp_flags->s + rtpp_flags->len; diff --git a/include/control_ng_flags_parser.h b/include/control_ng_flags_parser.h index d8eaf82209..782f1b5760 100644 --- a/include/control_ng_flags_parser.h +++ b/include/control_ng_flags_parser.h @@ -14,7 +14,7 @@ * Syntax: * rtpp_flags: flag1=, flag2- ... */ -void parse_rtpp_flags(const str * rtpp_flags, bencode_item_t * dict, +void parse_rtpp_flags(const str * rtpp_flags, bencode_buffer_t * buf, enum call_opmode opmode, sdp_ng_flags * out); #endif \ No newline at end of file