On Fri, May 29, 2020 at 01:02:34PM +0800, lance.lmw...@gmail.com wrote: > From: Limin Wang <lance.lmw...@gmail.com> > > Signed-off-by: Limin Wang <lance.lmw...@gmail.com> > --- > libavcodec/adpcmenc.c | 13 +++---------- > 1 file changed, 3 insertions(+), 10 deletions(-) > > diff --git a/libavcodec/adpcmenc.c b/libavcodec/adpcmenc.c > index bcb6783c0c..52f0f67958 100644 > --- a/libavcodec/adpcmenc.c > +++ b/libavcodec/adpcmenc.c > @@ -65,7 +65,6 @@ static av_cold int adpcm_encode_init(AVCodecContext *avctx) > ADPCMEncodeContext *s = avctx->priv_data; > uint8_t *extradata; > int i; > - int ret = AVERROR(ENOMEM); > > if (avctx->channels > 2) { > av_log(avctx, AV_LOG_ERROR, "only stereo or mono is supported\n"); > @@ -120,7 +119,7 @@ static av_cold int adpcm_encode_init(AVCodecContext > *avctx) > avctx->bits_per_coded_sample = 4; > avctx->block_align = BLKSIZE; > if (!(avctx->extradata = av_malloc(32 + > AV_INPUT_BUFFER_PADDING_SIZE))) > - goto error; > + return AVERROR(ENOMEM); > avctx->extradata_size = 32; > extradata = avctx->extradata; > bytestream_put_le16(&extradata, avctx->frame_size); > @@ -140,8 +139,7 @@ static av_cold int adpcm_encode_init(AVCodecContext > *avctx) > avctx->sample_rate != 44100) { > av_log(avctx, AV_LOG_ERROR, "Sample rate must be 11025, " > "22050 or 44100\n"); > - ret = AVERROR(EINVAL); > - goto error; > + return AVERROR(EINVAL); > } > avctx->frame_size = 512 * (avctx->sample_rate / 11025); > break; > @@ -150,13 +148,10 @@ static av_cold int adpcm_encode_init(AVCodecContext > *avctx) > avctx->block_align = BLKSIZE; > break; > default: > - ret = AVERROR(EINVAL); > - goto error; > + return AVERROR(EINVAL); > } > > return 0; > -error: > - return ret; > } > > static av_cold int adpcm_encode_close(AVCodecContext *avctx) > @@ -725,8 +720,6 @@ static int adpcm_encode_frame(AVCodecContext *avctx, > AVPacket *avpkt, > avpkt->size = pkt_size; > *got_packet_ptr = 1; > return 0; > -error: > - return AVERROR(ENOMEM); > } >
any objection for the remove for the gotos? if no, I'll continue to work on removing more such condition. > static const enum AVSampleFormat sample_fmts[] = { > -- > 2.21.0 > -- Thanks, Limin Wang _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".