[1/3] flacdec: use av_assert0() over assert()

Message ID 1368624059-8468-1-git-send-email-jb@videolan.org
State New
Headers show

Commit Message

Jean-Baptiste Kempf May 15, 2013, 1:20 p.m.
---
 libavcodec/flacdec.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Luca Barbato May 15, 2013, 2:36 p.m. | #1
On 05/15/2013 03:20 PM, Jean-Baptiste Kempf wrote:
> ---
>  libavcodec/flacdec.c |    6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/libavcodec/flacdec.c b/libavcodec/flacdec.c
> index ec54dfc..506ceaa 100644
> --- a/libavcodec/flacdec.c
> +++ b/libavcodec/flacdec.c
> @@ -35,6 +35,7 @@
>  
>  #include "libavutil/channel_layout.h"
>  #include "libavutil/crc.h"
> +#include "libavutil/avassert.h"
>  #include "avcodec.h"
>  #include "internal.h"
>  #include "get_bits.h"
> @@ -44,9 +45,6 @@
>  #include "flacdata.h"
>  #include "flacdsp.h"
>  
> -#undef NDEBUG
> -#include <assert.h>
> -
>  typedef struct FLACContext {
>      FLACSTREAMINFO
>  
> @@ -130,7 +128,7 @@ static int allocate_buffers(FLACContext *s)
>  {
>      int buf_size;
>  
> -    assert(s->max_blocksize);
> +    av_assert0(s->max_blocksize);
>  
>      buf_size = av_samples_get_buffer_size(NULL, s->channels, s->max_blocksize,
>                                            AV_SAMPLE_FMT_S32P, 0);
> 

Can be directly removed, it cannot be zero.

lu

Patch

diff --git a/libavcodec/flacdec.c b/libavcodec/flacdec.c
index ec54dfc..506ceaa 100644
--- a/libavcodec/flacdec.c
+++ b/libavcodec/flacdec.c
@@ -35,6 +35,7 @@ 
 
 #include "libavutil/channel_layout.h"
 #include "libavutil/crc.h"
+#include "libavutil/avassert.h"
 #include "avcodec.h"
 #include "internal.h"
 #include "get_bits.h"
@@ -44,9 +45,6 @@ 
 #include "flacdata.h"
 #include "flacdsp.h"
 
-#undef NDEBUG
-#include <assert.h>
-
 typedef struct FLACContext {
     FLACSTREAMINFO
 
@@ -130,7 +128,7 @@  static int allocate_buffers(FLACContext *s)
 {
     int buf_size;
 
-    assert(s->max_blocksize);
+    av_assert0(s->max_blocksize);
 
     buf_size = av_samples_get_buffer_size(NULL, s->channels, s->max_blocksize,
                                           AV_SAMPLE_FMT_S32P, 0);