From 83ee0b1acae8ac82f9724cb5b2e003e8da3a2fcb Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Sat, 11 Nov 2023 08:33:32 -0500 Subject: [PATCH] MT#55283 use g_auto for sdp_ng_flags Change-Id: I29f011df3874693d926940adba1531f0c747d30b --- daemon/call_interfaces.c | 26 +++++++++++++------------- daemon/janus.c | 8 ++++---- include/call_interfaces.h | 2 ++ 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/daemon/call_interfaces.c b/daemon/call_interfaces.c index d590f64e8..fa24ebc75 100644 --- a/daemon/call_interfaces.c +++ b/daemon/call_interfaces.c @@ -1974,7 +1974,7 @@ static const char *call_offer_answer_ng(struct ng_buffer *ngbuf, bencode_item_t struct call *call; struct call_monologue * monologues[2]; int ret; - AUTO_CLEANUP(sdp_ng_flags flags, call_ng_free_flags); + g_auto(sdp_ng_flags) flags; struct sdp_chopper *chopper; call_ng_process_flags(&flags, input, opmode); @@ -2830,7 +2830,7 @@ const char *call_start_forwarding_ng(bencode_item_t *input, bencode_item_t *outp AUTO_CLEANUP_NULL(struct call *call, call_unlock_release); struct call_monologue *monologue; const char *errstr = NULL; - AUTO_CLEANUP(sdp_ng_flags flags, call_ng_free_flags); + g_auto(sdp_ng_flags) flags; errstr = media_block_match(&call, &monologue, &flags, input, OP_OTHER); if (errstr) @@ -2859,7 +2859,7 @@ const char *call_stop_forwarding_ng(bencode_item_t *input, bencode_item_t *outpu AUTO_CLEANUP_NULL(struct call *call, call_unlock_release); struct call_monologue *monologue; const char *errstr = NULL; - AUTO_CLEANUP(sdp_ng_flags flags, call_ng_free_flags); + g_auto(sdp_ng_flags) flags; errstr = media_block_match(&call, &monologue, &flags, input, OP_OTHER); if (errstr) @@ -2938,7 +2938,7 @@ const char *call_block_dtmf_ng(bencode_item_t *input, bencode_item_t *output) { AUTO_CLEANUP_NULL(struct call *call, call_unlock_release); struct call_monologue *monologue; const char *errstr = NULL; - AUTO_CLEANUP(sdp_ng_flags flags, call_ng_free_flags); + g_auto(sdp_ng_flags) flags; errstr = media_block_match(&call, &monologue, &flags, input, OP_OTHER); if (errstr) @@ -2979,7 +2979,7 @@ const char *call_unblock_dtmf_ng(bencode_item_t *input, bencode_item_t *output) AUTO_CLEANUP_NULL(struct call *call, call_unlock_release); struct call_monologue *monologue; const char *errstr = NULL; - AUTO_CLEANUP(sdp_ng_flags flags, call_ng_free_flags); + g_auto(sdp_ng_flags) flags; errstr = media_block_match(&call, &monologue, &flags, input, OP_OTHER); if (errstr) @@ -3041,7 +3041,7 @@ static const char *call_block_silence_media(bencode_item_t *input, bool on_off, AUTO_CLEANUP_NULL(struct call *call, call_unlock_release); struct call_monologue *monologue; const char *errstr = NULL; - AUTO_CLEANUP(sdp_ng_flags flags, call_ng_free_flags); + g_auto(sdp_ng_flags) flags; errstr = media_block_match(&call, &monologue, &flags, input, OP_OTHER); if (errstr) @@ -3216,7 +3216,7 @@ const char *call_play_media_ng(bencode_item_t *input, bencode_item_t *output) { AUTO_CLEANUP_NULL(struct call *call, call_unlock_release); g_auto(GQueue) monologues; const char *err = NULL; - AUTO_CLEANUP(sdp_ng_flags flags, call_ng_free_flags); + g_auto(sdp_ng_flags) flags; err = play_media_select_party(&call, &monologues, input, &flags); if (err) @@ -3272,7 +3272,7 @@ const char *call_stop_media_ng(bencode_item_t *input, bencode_item_t *output) { g_auto(GQueue) monologues; const char *err = NULL; long long last_frame_pos = 0; - AUTO_CLEANUP(sdp_ng_flags flags, call_ng_free_flags); + g_auto(sdp_ng_flags) flags; err = play_media_select_party(&call, &monologues, input, &flags); if (err) @@ -3304,7 +3304,7 @@ const char *call_play_dtmf_ng(bencode_item_t *input, bencode_item_t *output) { AUTO_CLEANUP_NULL(struct call *call, call_unlock_release); g_auto(GQueue) monologues; const char *err = NULL; - AUTO_CLEANUP(sdp_ng_flags flags, call_ng_free_flags); + g_auto(sdp_ng_flags) flags; err = play_media_select_party(&call, &monologues, input, &flags); if (err) @@ -3405,7 +3405,7 @@ const char *call_publish_ng(struct ng_buffer *ngbuf, bencode_item_t *input, benc const char *addr, const endpoint_t *sin) { - AUTO_CLEANUP(sdp_ng_flags flags, call_ng_free_flags); + g_auto(sdp_ng_flags) flags; AUTO_CLEANUP(GQueue parsed, sdp_free) = G_QUEUE_INIT; AUTO_CLEANUP(GQueue streams, sdp_streams_free) = G_QUEUE_INIT; AUTO_CLEANUP(str sdp_in, str_free_dup) = STR_NULL; @@ -3461,7 +3461,7 @@ const char *call_publish_ng(struct ng_buffer *ngbuf, bencode_item_t *input, benc const char *call_subscribe_request_ng(bencode_item_t *input, bencode_item_t *output) { const char *err = NULL; - AUTO_CLEANUP(sdp_ng_flags flags, call_ng_free_flags); + g_auto(sdp_ng_flags) flags; char rand_buf[65]; AUTO_CLEANUP_NULL(struct call *call, call_unlock_release); AUTO_CLEANUP(GQueue srms, media_subscriptions_clear) = G_QUEUE_INIT; @@ -3594,7 +3594,7 @@ const char *call_subscribe_request_ng(bencode_item_t *input, bencode_item_t *out const char *call_subscribe_answer_ng(struct ng_buffer *ngbuf, bencode_item_t *input, bencode_item_t *output) { - AUTO_CLEANUP(sdp_ng_flags flags, call_ng_free_flags); + g_auto(sdp_ng_flags) flags; AUTO_CLEANUP(GQueue parsed, sdp_free) = G_QUEUE_INIT; AUTO_CLEANUP(GQueue streams, sdp_streams_free) = G_QUEUE_INIT; AUTO_CLEANUP_NULL(struct call *call, call_unlock_release); @@ -3636,7 +3636,7 @@ const char *call_subscribe_answer_ng(struct ng_buffer *ngbuf, bencode_item_t *in const char *call_unsubscribe_ng(bencode_item_t *input, bencode_item_t *output) { - AUTO_CLEANUP(sdp_ng_flags flags, call_ng_free_flags); + g_auto(sdp_ng_flags) flags; AUTO_CLEANUP_NULL(struct call *call, call_unlock_release); call_ng_process_flags(&flags, input, OP_REQ_ANSWER); diff --git a/daemon/janus.c b/daemon/janus.c index 71cc46e67..aafb7455e 100644 --- a/daemon/janus.c +++ b/daemon/janus.c @@ -603,7 +603,7 @@ static const char *janus_videoroom_join(struct websocket_message *wm, struct jan struct call_monologue *dest_ml = janus_get_monologue(handle->id, call, call_get_or_create_monologue); - AUTO_CLEANUP(sdp_ng_flags flags, call_ng_free_flags); + g_auto(sdp_ng_flags) flags; call_ng_flags_init(&flags, OP_REQUEST); flags.generate_mid = 1; @@ -843,7 +843,7 @@ static const char *janus_videoroom_configure(struct websocket_message *wm, struc AUTO_CLEANUP(str sdp_in, str_free_dup) = STR_INIT_DUP(jsep_sdp); - AUTO_CLEANUP(sdp_ng_flags flags, call_ng_free_flags); + g_auto(sdp_ng_flags) flags; AUTO_CLEANUP(GQueue parsed, sdp_free) = G_QUEUE_INIT; AUTO_CLEANUP(GQueue streams, sdp_streams_free) = G_QUEUE_INIT; call_ng_flags_init(&flags, OP_PUBLISH); @@ -947,7 +947,7 @@ static const char *janus_videoroom_start(struct websocket_message *wm, struct ja AUTO_CLEANUP(str sdp_in, str_free_dup) = STR_INIT_DUP(jsep_sdp); - AUTO_CLEANUP(sdp_ng_flags flags, call_ng_free_flags); + g_auto(sdp_ng_flags) flags; AUTO_CLEANUP(GQueue parsed, sdp_free) = G_QUEUE_INIT; AUTO_CLEANUP(GQueue streams, sdp_streams_free) = G_QUEUE_INIT; call_ng_flags_init(&flags, OP_PUBLISH); @@ -1619,7 +1619,7 @@ static const char *janus_trickle(JsonReader *reader, struct janus_session *sessi // top-level structures first, with auto cleanup AUTO_CLEANUP(GQueue streams, sdp_streams_free) = G_QUEUE_INIT; AUTO_CLEANUP(struct ng_buffer *ngbuf, ng_buffer_auto_release) = ng_buffer_new(NULL); - AUTO_CLEANUP(sdp_ng_flags flags, call_ng_free_flags); + g_auto(sdp_ng_flags) flags; call_ng_flags_init(&flags, OP_OTHER); // then the contained structures, and add them in diff --git a/include/call_interfaces.h b/include/call_interfaces.h index 969d5d81c..ca07a9052 100644 --- a/include/call_interfaces.h +++ b/include/call_interfaces.h @@ -256,6 +256,8 @@ void call_ng_flags_init(sdp_ng_flags *out, enum call_opmode opmode); void call_ng_free_flags(sdp_ng_flags *flags); void call_unlock_release(struct call **c); +G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(sdp_ng_flags, call_ng_free_flags) + int call_interfaces_init(void); void call_interfaces_free(void); void call_interfaces_timer(void);