[FFmpeg-devel] [PATCH] Improved selftest coverage for libavutil/fifo.c

Michael Niedermayer michael at niedermayer.cc
Sat Oct 15 00:25:24 EEST 2016


On Thu, Oct 13, 2016 at 03:13:56PM -0700, Thomas Turner wrote:
> Tested functions: av_fifo_generic_peek(), av_fifo_grow()
> 
> Signed-off-by: Thomas Turner <thomastdt at gmail.com>
> ---
>  libavutil/tests/fifo.c | 39 +++++++++++++++++++++++++++++++++++++--
>  tests/ref/fate/fifo    | 43 +++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 80 insertions(+), 2 deletions(-)
> 
> diff --git a/libavutil/tests/fifo.c b/libavutil/tests/fifo.c
> index e4d7edf..63e25c8 100644
> --- a/libavutil/tests/fifo.c
> +++ b/libavutil/tests/fifo.c
> @@ -17,14 +17,14 @@
>   */
>  
>  #include <stdio.h>
> -
> +#include <stdlib.h>
>  #include "libavutil/fifo.h"
>  
>  int main(void)
>  {
>      /* create a FIFO buffer */
>      AVFifoBuffer *fifo = av_fifo_alloc(13 * sizeof(int));
> -    int i, j, n;
> +    int i, j, n, *p;
>  
>      /* fill data */
>      for (i = 0; av_fifo_space(fifo) >= sizeof(int); i++)
> @@ -46,6 +46,24 @@ int main(void)
>      }
>      printf("\n");
>  
> +    /* generic peek at FIFO */
> +
> +    n = av_fifo_size(fifo);
> +    p = malloc(n);
> +    if (p == NULL) {
> +        fprintf(stderr, "failed to allocate memory.\n");

> +        exit(-1);

we use exit(1) everywhere else
changed and applied

thanks

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Freedom in capitalist society always remains about the same as it was in
ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20161014/9b8a365d/attachment.sig>


More information about the ffmpeg-devel mailing list