neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-msc/+/35880?usp=email )
Change subject: cosmetic: rename to sdp_audio_codecs_foreach ......................................................................
cosmetic: rename to sdp_audio_codecs_foreach
Better match the pattern of sdp_audio_codecs_* instead of having foreach_ in the front. Prepare for prepending osmo_ some day, because I plan to move the SDP API to a separate library.
Change-Id: Ia96190e0bdb513886663be1c8c12be3b403b71c9 --- M include/osmocom/msc/sdp_msg.h M src/libmsc/codec_mapping.c M src/libmsc/rtp_stream.c M src/libmsc/sdp_msg.c M tests/msc_vlr/msc_vlr_test_call.c 5 files changed, 28 insertions(+), 15 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/80/35880/1
diff --git a/include/osmocom/msc/sdp_msg.h b/include/osmocom/msc/sdp_msg.h index 724440c..e3879f6 100644 --- a/include/osmocom/msc/sdp_msg.h +++ b/include/osmocom/msc/sdp_msg.h @@ -41,8 +41,8 @@ struct csd_bs_list bearer_services; };
-#define foreach_sdp_audio_codec(/* struct sdp_audio_codec* */ CODEC, \ - /* struct sdp_audio_codecs* */ AC) \ +#define sdp_audio_codecs_foreach(/* struct sdp_audio_codec* */ CODEC, \ + /* struct sdp_audio_codecs* */ AC) \ for (CODEC = (AC)->codec; \ (CODEC - (AC)->codec) < OSMO_MIN((AC)->count, ARRAY_SIZE((AC)->codec)); \ CODEC++) diff --git a/src/libmsc/codec_mapping.c b/src/libmsc/codec_mapping.c index 8eea242..bb5968f 100644 --- a/src/libmsc/codec_mapping.c +++ b/src/libmsc/codec_mapping.c @@ -371,7 +371,7 @@ const struct sdp_audio_codec *codec; int added = 0;
- foreach_sdp_audio_codec(codec, ac) { + sdp_audio_codecs_foreach(codec, ac) { added += sdp_audio_codec_add_to_bearer_cap(bearer_cap, codec); }
@@ -439,7 +439,7 @@
*scl = (struct gsm0808_speech_codec_list){};
- foreach_sdp_audio_codec(codec, ac) { + sdp_audio_codecs_foreach(codec, ac) { int rc = sdp_audio_codec_to_speech_codec_list(scl, codec); if (rc == -ENOSPC) break; @@ -472,7 +472,7 @@ .ch_indctr = GSM0808_CHAN_SPEECH, };
- foreach_sdp_audio_codec(codec, ac) { + sdp_audio_codecs_foreach(codec, ac) { const struct codec_mapping *m; int i; bool dup; diff --git a/src/libmsc/rtp_stream.c b/src/libmsc/rtp_stream.c index 1f885c5..eb9ba7e 100644 --- a/src/libmsc/rtp_stream.c +++ b/src/libmsc/rtp_stream.c @@ -322,7 +322,7 @@ * reasons we still need to translate to a struct mgcp_conn_peer representation to send it. */ struct sdp_audio_codec *codec; int i = 0; - foreach_sdp_audio_codec(codec, &rtps->codecs) { + sdp_audio_codecs_foreach(codec, &rtps->codecs) { const struct codec_mapping *m = codec_mapping_by_subtype_name(codec->subtype_name); if (!m) { LOG_RTPS(rtps, LOGL_ERROR, "Cannot map codec '%s' to MGCP: codec is unknown\n", diff --git a/src/libmsc/sdp_msg.c b/src/libmsc/sdp_msg.c index 2eda38f..9b4cd98 100644 --- a/src/libmsc/sdp_msg.c +++ b/src/libmsc/sdp_msg.c @@ -102,9 +102,9 @@ return cmp;
/* See if each codec in a is also present in b */ - foreach_sdp_audio_codec(codec_a, a) { + sdp_audio_codecs_foreach(codec_a, a) { bool match_found = false; - foreach_sdp_audio_codec(codec_b, b) { + sdp_audio_codecs_foreach(codec_b, b) { if (!sdp_audio_codec_cmp(codec_a, codec_b, cmp_fmtp, cmp_payload_type)) { match_found = true; break; @@ -175,7 +175,7 @@ bool create) { struct sdp_audio_codec *codec; - foreach_sdp_audio_codec(codec, ac) { + sdp_audio_codecs_foreach(codec, ac) { if (codec->payload_type == payload_type) return codec; } @@ -199,7 +199,7 @@ struct sdp_audio_codec *sdp_audio_codecs_by_descr(struct sdp_audio_codecs *ac, const struct sdp_audio_codec *codec) { struct sdp_audio_codec *i; - foreach_sdp_audio_codec(i, ac) { + sdp_audio_codecs_foreach(i, ac) { if (!sdp_audio_codec_cmp(i, codec, false, false)) return i; } @@ -218,7 +218,7 @@
/* Move all following entries one up */ ac->count--; - foreach_sdp_audio_codec(i, ac) { + sdp_audio_codecs_foreach(i, ac) { if (i < codec) continue; *i = *(i+1); @@ -261,12 +261,12 @@ sdp->rtp.port);
/* Append all payload type numbers to 'm=audio <port> RTP/AVP 3 4 112' line */ - foreach_sdp_audio_codec(codec, &sdp->audio_codecs) + sdp_audio_codecs_foreach(codec, &sdp->audio_codecs) OSMO_STRBUF_PRINTF(sb, " %d", codec->payload_type); OSMO_STRBUF_PRINTF(sb, "\r\n");
/* Add details for all codecs */ - foreach_sdp_audio_codec(codec, &sdp->audio_codecs) { + sdp_audio_codecs_foreach(codec, &sdp->audio_codecs) { if (!sdp_audio_codec_is_set(codec)) continue; OSMO_STRBUF_PRINTF(sb, "a=rtpmap:%d %s/%d\r\n", codec->payload_type, codec->subtype_name, @@ -624,7 +624,7 @@ const struct sdp_audio_codec *codec; if (!ac->count) OSMO_STRBUF_PRINTF(sb, "(no-codecs)"); - foreach_sdp_audio_codec(codec, ac) { + sdp_audio_codecs_foreach(codec, ac) { bool first = (codec == ac->codec); if (!first) OSMO_STRBUF_PRINTF(sb, ","); diff --git a/tests/msc_vlr/msc_vlr_test_call.c b/tests/msc_vlr/msc_vlr_test_call.c index 4306a61..14c8ea3 100644 --- a/tests/msc_vlr/msc_vlr_test_call.c +++ b/tests/msc_vlr/msc_vlr_test_call.c @@ -1214,7 +1214,7 @@ }
expect_pos = expected_codecs; - foreach_sdp_audio_codec(codec, &sdp.audio_codecs) { + sdp_audio_codecs_foreach(codec, &sdp.audio_codecs) { char subtype_name_wo_pt[16]; if (!*expect_pos) { BTW("%s: %s: ERROR: did not expect %s", func, desc, codec->subtype_name);