changeset 35188:36d09dcaf732

vd_black: simplify code Simplify code by using macro and removing redundant if statement.
author upsuper
date Tue, 30 Oct 2012 15:40:41 +0000
parents 0c3fae9845fd
children 33e13b4ddfcb
files libmpcodecs/vd_black.c
diffstat 1 files changed, 3 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/vd_black.c	Tue Oct 30 11:33:14 2012 +0000
+++ b/libmpcodecs/vd_black.c	Tue Oct 30 15:40:41 2012 +0000
@@ -152,10 +152,8 @@
     vd_black_ctx *ctx = sh->context;
 
     for (i = 0; i < MP_MAX_PLANES; ++i) {
-        if (ctx->planes[i]) {
-            free(ctx->planes[i]);
-            ctx->planes[i] = NULL;
-        }
+        free(ctx->planes[i]);
+        ctx->planes[i] = NULL;
     }
 
     free(ctx);
@@ -168,8 +166,7 @@
     vd_black_ctx *ctx = sh->context;
     int i;
 
-    if (sh->num_buffered_pts !=
-            sizeof(sh->buffered_pts) / sizeof(sh->buffered_pts[0]) - 1)
+    if (sh->num_buffered_pts != FF_ARRAY_ELEMS(sh->buffered_pts) - 1)
         return NULL;
 
     mpi = mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, MP_IMGFLAG_PRESERVE,