summaryrefslogtreecommitdiffstats
path: root/libmpcodecs
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2010-02-14 11:17:12 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2010-02-14 11:17:12 +0000
commit270ebbb913a2ab2e2065e57d660e1892091172d7 (patch)
treece066ea8532064f5605ef67f33e19a679f1fa80f /libmpcodecs
parentf2488e85373a6ab1c16174c14342c6f239aeb808 (diff)
downloadmpv-270ebbb913a2ab2e2065e57d660e1892091172d7.tar.bz2
mpv-270ebbb913a2ab2e2065e57d660e1892091172d7.tar.xz
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
Diffstat (limited to 'libmpcodecs')
-rw-r--r--libmpcodecs/vd_theora.c29
1 files changed, 8 insertions, 21 deletions
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;
}
/*