[Mesa-dev] [PATCH] st/xvmc/tests: avoid non portable error.h functions

Ilia Mirkin imirkin at alum.mit.edu
Sat Aug 30 10:54:45 PDT 2014


Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu>

On Sat, Aug 30, 2014 at 1:43 PM, Jonathan Gray <jsg at jsg.id.au> wrote:
> Signed-off-by: Jonathan Gray <jsg at jsg.id.au>
> ---
>  src/gallium/state_trackers/xvmc/tests/test_blocks.c     |  6 ++++--
>  src/gallium/state_trackers/xvmc/tests/test_context.c    |  6 ++++--
>  src/gallium/state_trackers/xvmc/tests/test_rendering.c  | 13 ++++++++-----
>  src/gallium/state_trackers/xvmc/tests/test_subpicture.c |  4 ++--
>  src/gallium/state_trackers/xvmc/tests/test_surface.c    |  6 ++++--
>  5 files changed, 22 insertions(+), 13 deletions(-)
>
> diff --git a/src/gallium/state_trackers/xvmc/tests/test_blocks.c b/src/gallium/state_trackers/xvmc/tests/test_blocks.c
> index 0baed19..a35838f 100644
> --- a/src/gallium/state_trackers/xvmc/tests/test_blocks.c
> +++ b/src/gallium/state_trackers/xvmc/tests/test_blocks.c
> @@ -26,7 +26,8 @@
>   **************************************************************************/
>
>  #include <assert.h>
> -#include <error.h>
> +#include <stdio.h>
> +#include <stdlib.h>
>  #include "testlib.h"
>
>  int main(int argc, char **argv)
> @@ -62,7 +63,8 @@ int main(int argc, char **argv)
>         ))
>         {
>                 XCloseDisplay(display);
> -               error(1, 0, "Error, unable to find a good port.\n");
> +               fprintf(stderr, "Error, unable to find a good port.\n");
> +               exit(1);
>         }
>
>         if (is_overlay)
> diff --git a/src/gallium/state_trackers/xvmc/tests/test_context.c b/src/gallium/state_trackers/xvmc/tests/test_context.c
> index 1b9b040..344ac76 100644
> --- a/src/gallium/state_trackers/xvmc/tests/test_context.c
> +++ b/src/gallium/state_trackers/xvmc/tests/test_context.c
> @@ -26,7 +26,8 @@
>   **************************************************************************/
>
>  #include <assert.h>
> -#include <error.h>
> +#include <stdio.h>
> +#include <stdlib.h>
>  #include "testlib.h"
>
>  int main(int argc, char **argv)
> @@ -58,7 +59,8 @@ int main(int argc, char **argv)
>         ))
>         {
>                 XCloseDisplay(display);
> -               error(1, 0, "Error, unable to find a good port.\n");
> +               fprintf(stderr, "Error, unable to find a good port.\n");
> +               exit(1);
>         }
>
>         if (is_overlay)
> diff --git a/src/gallium/state_trackers/xvmc/tests/test_rendering.c b/src/gallium/state_trackers/xvmc/tests/test_rendering.c
> index 5bfbea7..b3b3794 100644
> --- a/src/gallium/state_trackers/xvmc/tests/test_rendering.c
> +++ b/src/gallium/state_trackers/xvmc/tests/test_rendering.c
> @@ -28,7 +28,7 @@
>  #include <assert.h>
>  #include <stdio.h>
>  #include <string.h>
> -#include <error.h>
> +#include <stdlib.h>
>  #include "testlib.h"
>
>  #define BLOCK_WIDTH                    8
> @@ -84,9 +84,9 @@ static void ParseArgs(int argc, char **argv, unsigned int *output_width, unsigne
>         }
>
>         if (fail)
> -               error
> -               (
> -                       1, 0,
> +       {
> +               fprintf(
> +                       stderr,
>                         "Bad argument.\n"
>                         "\n"
>                         "Usage: %s [options]\n"
> @@ -96,6 +96,8 @@ static void ParseArgs(int argc, char **argv, unsigned int *output_width, unsigne
>                         "\t-p\tPrompt for quit\n",
>                         argv[0]
>                 );
> +               exit(1);
> +       }
>  }
>
>  static void Gradient(short *block, unsigned int start, unsigned int stop, int horizontal, unsigned int intra_unsigned)
> @@ -166,7 +168,8 @@ int main(int argc, char **argv)
>         ))
>         {
>                 XCloseDisplay(display);
> -               error(1, 0, "Error, unable to find a good port.\n");
> +               fprintf(stderr, "Error, unable to find a good port.\n");
> +               exit(1);
>         }
>
>         if (is_overlay)
> diff --git a/src/gallium/state_trackers/xvmc/tests/test_subpicture.c b/src/gallium/state_trackers/xvmc/tests/test_subpicture.c
> index 8bd4d6d..ad9fbe3 100644
> --- a/src/gallium/state_trackers/xvmc/tests/test_subpicture.c
> +++ b/src/gallium/state_trackers/xvmc/tests/test_subpicture.c
> @@ -26,7 +26,6 @@
>   **************************************************************************/
>
>  #include <assert.h>
> -#include <error.h>
>  #include <stdio.h>
>  #include <stdlib.h>
>  #include "testlib.h"
> @@ -87,7 +86,8 @@ int main(int argc, char **argv)
>         ))
>         {
>                 XCloseDisplay(display);
> -               error(1, 0, "Error, unable to find a good port.\n");
> +               fprintf(stderr, "Error, unable to find a good port.\n");
> +               exit(1);
>         }
>
>         if (is_overlay)
> diff --git a/src/gallium/state_trackers/xvmc/tests/test_surface.c b/src/gallium/state_trackers/xvmc/tests/test_surface.c
> index 8145686..964ca82 100644
> --- a/src/gallium/state_trackers/xvmc/tests/test_surface.c
> +++ b/src/gallium/state_trackers/xvmc/tests/test_surface.c
> @@ -26,7 +26,8 @@
>   **************************************************************************/
>
>  #include <assert.h>
> -#include <error.h>
> +#include <stdio.h>
> +#include <stdlib.h>
>  #include "testlib.h"
>
>  int main(int argc, char **argv)
> @@ -59,7 +60,8 @@ int main(int argc, char **argv)
>         ))
>         {
>                 XCloseDisplay(display);
> -               error(1, 0, "Error, unable to find a good port.\n");
> +               fprintf(stderr, "Error, unable to find a good port.\n");
> +               exit(1);
>         }
>
>         if (is_overlay)
> --
> 1.9.3
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list