MT#58535 Use `call_ng_flags_flags()` for generic flags

During the parsing of `rtpp_flags` use the
`call_ng_flags_flags()` directly instead of the
`bencode_list_add_str()`, hence reduce amount
of iterations required to parse generic flags.

Additionally:

`call_ng_flags_flags()` is made visible for usage
within external files.

`helper_arg` union has been moved to the header.

Change-Id: I34399a0d3940a1276feb1210e4421cbcdf656e9d
pull/1809/head
Donat Zenichev 1 year ago
parent bc698a3fcb
commit 282f57884e

@ -32,14 +32,6 @@
#include "dtmf.h"
#include "control_ng_flags_parser.h"
typedef union {
const struct sdp_attr_helper *attr_helper;
str_q *q;
str_case_ht *sct;
str_case_value_ht *svt;
void **generic;
} helper_arg __attribute__ ((__transparent_union__));
static pcre2_code *info_re;
static pcre2_code *streams_re;
@ -988,7 +980,7 @@ INLINE int call_ng_flags_prefix(sdp_ng_flags *out, str *s_ori, const char *prefi
cb(out, &s, arg);
return 1;
}
static void call_ng_flags_flags(sdp_ng_flags *out, str *s, helper_arg dummy) {
void call_ng_flags_flags(sdp_ng_flags *out, str *s, helper_arg dummy) {
str_hyphenate(s);
switch (__csh_lookup(s)) {

@ -456,7 +456,7 @@ void parse_rtpp_flags(const str * rtpp_flags, bencode_item_t * root_dict,
generic:
/* generic one key flags */
if (!val.s)
bencode_list_add_str(flags, &key);
call_ng_flags_flags(out, &key, NULL);
/* generic flags with value, but no particular processing */
else
bencode_dictionary_str_add_str(root_dict, &key, &val);

@ -14,6 +14,14 @@ struct call_stats;
struct streambuf_stream;
struct sockaddr_in6;
typedef union {
const struct sdp_attr_helper *attr_helper;
str_q *q;
str_case_ht *sct;
str_case_value_ht *svt;
void **generic;
} helper_arg __attribute__ ((__transparent_union__));
struct sdp_ng_flags {
enum call_opmode opmode;
enum message_type message_type;
@ -278,6 +286,8 @@ int call_interfaces_init(void);
void call_interfaces_free(void);
void call_interfaces_timer(void);
void call_ng_flags_flags(sdp_ng_flags *out, str *s, helper_arg dummy);
INLINE struct sdp_manipulations *sdp_manipulations_get_by_id(const sdp_ng_flags *f, enum media_type id) {
if (id < 0 || id >= G_N_ELEMENTS(f->sdp_manipulations))
return NULL;
@ -300,4 +310,5 @@ INLINE struct sdp_manipulations *sdp_manipulations_get_by_name(sdp_ng_flags *f,
}
#endif

Loading…
Cancel
Save