[FFmpeg-cvslog] vble: remove vble_error_close

Janne Grunau git at videolan.org
Sat Nov 12 01:24:06 CET 2011


ffmpeg | branch: master | Janne Grunau <janne-libav at jannau.net> | Fri Nov 11 18:13:36 2011 -0500| [6761b6b825c4aafff311a180a09c7013288480aa] | committer: Michael Niedermayer

vble: remove vble_error_close

It does not make much sense to factor the error handling to its own
av_always_inline function. Fixes "format not a string literal and no
format arguments" warning in the av_log.

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6761b6b825c4aafff311a180a09c7013288480aa
---

 libavcodec/vble.c |   28 ++++++++++++++--------------
 1 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/libavcodec/vble.c b/libavcodec/vble.c
index bfc9223..f354faa 100644
--- a/libavcodec/vble.c
+++ b/libavcodec/vble.c
@@ -196,14 +196,6 @@ static av_cold int vble_decode_close(AVCodecContext *avctx)
     return 0;
 }
 
-static av_always_inline int vble_error_close(AVCodecContext *avctx,
-                                             const char *message)
-{
-    av_log(avctx, AV_LOG_ERROR, message);
-    vble_decode_close(avctx);
-    return AVERROR(ENOMEM);
-}
-
 static av_cold int vble_decode_init(AVCodecContext *avctx)
 {
     VBLEContext *ctx = avctx->priv_data;
@@ -216,21 +208,29 @@ static av_cold int vble_decode_init(AVCodecContext *avctx)
     avctx->bits_per_raw_sample = 8;
     avctx->coded_frame = avcodec_alloc_frame();
 
-    if (!avctx->coded_frame)
-        return vble_error_close(avctx, "Could not allocate frame.\n");
+    if (!avctx->coded_frame) {
+        av_log(avctx, AV_LOG_ERROR, "Could not allocate frame.\n");
+        return AVERROR(ENOMEM);
+    }
 
     ctx->size = avpicture_get_size(avctx->pix_fmt,
                                    avctx->width, avctx->height);
 
     ctx->len = av_malloc(ctx->size * sizeof(*ctx->len));
 
-    if (!ctx->len)
-        return vble_error_close(avctx, "Could not allocate lengths buffer.\n");
+    if (!ctx->len) {
+        av_log(avctx, AV_LOG_ERROR, "Could not allocate lengths buffer.\n");
+        vble_decode_close(avctx);
+        return AVERROR(ENOMEM);
+    }
 
     ctx->val = av_malloc(ctx->size * sizeof(*ctx->val));
 
-    if (!ctx->val)
-        return vble_error_close(avctx, "Could not allocate values buffer.\n");
+    if (!ctx->val) {
+        av_log(avctx, AV_LOG_ERROR, "Could not allocate values buffer.\n");
+        vble_decode_close(avctx);
+        return AVERROR(ENOMEM);
+    }
 
     return 0;
 }



More information about the ffmpeg-cvslog mailing list