[MPlayer-dev-eng] [PATCH] Abort on Fatal Messages

Alexander Strasser eclipse7 at gmx.net
Sun Mar 13 12:03:13 CET 2011


Hi,

Tobias Diedrich wrote:
> Abort on fatal messages.
> 
> mp_msg.h says we abort on fatal messages, but we currently don't.
> 
> Index: mplayer-patchset1/mp_msg.c
> ===================================================================
> --- mplayer-patchset1.orig/mp_msg.c	2011-02-18 20:01:54.436871000 +0100
> +++ mplayer-patchset1/mp_msg.c	2011-02-18 20:02:26.823321000 +0100
> @@ -242,4 +242,7 @@
>      if (mp_msg_color)
>          fprintf(stream, "\033[0m");
>      fflush(stream);
> +
> +    if (lev == MSGL_FATAL)
> +        abort();
>  }

  I like the idea, but I very much dislike quitting inside a function
named mp_msg.

  IMHO the approach of having a new function, e.g. mp_msg_and_die
or mp_die(msg...), would be better. This function would call mp_msg
with level MSGL_FATAL and then terminate the process.

  I guess you had already places in mind where an exit would have
been better than only printing the fatal error message. My proposal
would need those places to be changed to use the new function. So
a review of all mp_msg invocations with MSGL_FATAL would be in order
to use the new function in all appropriate places.

  Reimar, what is your opinion on this approach?

  Alexander


More information about the MPlayer-dev-eng mailing list