Skip to content

Commit

Permalink
MT#58535 rtpp_flags: deprecate usage of dict for parsing
Browse files Browse the repository at this point in the history
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
  • Loading branch information
zenichev committed Apr 2, 2024
1 parent 7b94627 commit ceb49c9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 14 deletions.
12 changes: 2 additions & 10 deletions daemon/call_interfaces.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"):
Expand Down
4 changes: 1 addition & 3 deletions daemon/control_ng_flags_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion include/control_ng_flags_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* Syntax:
* rtpp_flags: flag1=<value>, flag2-<value> ...
*/
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

0 comments on commit ceb49c9

Please sign in to comment.