mgcp: Move assignment of src_codec downwards

Currently the src_codec const variable is set to &src_end->codec
before src_end is checked against NULL. Since the assigment is just
an address operation and the memory where it points to is only
accessed after the NULL check, this does not harm technically.
Nevertheless this is potential source for errors if that code is
changed.

This commit moves the definition below the NULL check. This does not
comply with the coding style, but it cannot be split into definition
and a later assignment due to the const qualifier.

Sponsored-by: On-Waves ehf
This commit is contained in:
Jacob Erlbeck 2015-04-28 09:28:18 +02:00
parent cb43a9ac44
commit 5a2484b10e
1 changed files with 2 additions and 1 deletions

View File

@ -141,7 +141,6 @@ int mgcp_transcoding_setup(struct mgcp_endpoint *endp,
{
struct mgcp_process_rtp_state *state;
enum audio_format src_fmt, dst_fmt;
const struct mgcp_rtp_codec *src_codec = &src_end->codec;
const struct mgcp_rtp_codec *dst_codec = &dst_end->codec;
/* cleanup first */
@ -153,6 +152,8 @@ int mgcp_transcoding_setup(struct mgcp_endpoint *endp,
if (!src_end)
return 0;
const struct mgcp_rtp_codec *src_codec = &src_end->codec;
if (endp->tcfg->no_audio_transcoding) {
LOGP(DMGCP, LOGL_NOTICE,
"Transcoding disabled on endpoint 0x%x\n",