From 270ebbb913a2ab2e2065e57d660e1892091172d7 Mon Sep 17 00:00:00 2001 From: reimar Date: Sun, 14 Feb 2010 11:17:12 +0000 Subject: Just use goto instead of reimplementing it badly with a do { } while (0) and break. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30568 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpcodecs/vd_theora.c | 29 ++++++++--------------------- 1 file changed, 8 insertions(+), 21 deletions(-) (limited to 'libmpcodecs') diff --git a/libmpcodecs/vd_theora.c b/libmpcodecs/vd_theora.c index 8844b3bcf8..f1a7db1247 100644 --- a/libmpcodecs/vd_theora.c +++ b/libmpcodecs/vd_theora.c @@ -64,18 +64,14 @@ typedef struct theora_struct_st { */ static int init(sh_video_t *sh){ theora_struct_t *context = NULL; - int failed = 1; int errorCode = 0; ogg_packet op; int i; - /* this is not a loop, just a context, from which we can break on error */ - do - { context = calloc (sizeof (theora_struct_t), 1); sh->context = context; if (!context) - break; + goto err_out; theora_info_init(&context->inf); theora_comment_init(&context->cc); @@ -88,11 +84,9 @@ static int init(sh_video_t *sh){ if ( (errorCode = theora_decode_header (&context->inf, &context->cc, &op)) ) { mp_msg(MSGT_DECAUDIO, MSGL_ERR, "Broken Theora header; errorCode=%i!\n", errorCode); - break; + goto err_out; } } - if (errorCode) - break; /* now init codec */ errorCode = theora_decode_init (&context->st, &context->inf); @@ -100,20 +94,8 @@ static int init(sh_video_t *sh){ { mp_msg(MSGT_DECVIDEO,MSGL_ERR,"Theora decode init failed: %i \n", errorCode); - break; - } - failed = 0; - } while (0); - - if (failed) - { - if (context) - { - free (context); - sh->context = NULL; + goto err_out; } - return 0; - } if(sh->aspect==0.0 && context->inf.aspect_denominator!=0) { @@ -124,6 +106,11 @@ static int init(sh_video_t *sh){ mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: Theora video init ok!\n"); return mpcodecs_config_vo (sh,context->inf.frame_width,context->inf.frame_height,IMGFMT_YV12); + +err_out: + free(context); + sh->context = NULL; + return 0; } /* -- cgit v1.2.3