[Spice-devel] [PATCH spice-common 1/2] log: remove deprecated SPICE_ABORT_LEVEL support

Christophe Fergeau cfergeau at redhat.com
Wed Feb 6 12:07:06 UTC 2019


On Tue, Jan 29, 2019 at 10:49:23AM +0000, Frediano Ziglio wrote:
> This feature was marked obsolete by efd1d3cb4d8eee more than
> three years ago.
> 
> Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> ---
>  common/log.c         | 30 +-----------------------------
>  tests/test-logging.c | 39 +--------------------------------------
>  2 files changed, 2 insertions(+), 67 deletions(-)
> 
> diff --git a/common/log.c b/common/log.c
> index a7806c5..5819974 100644
> --- a/common/log.c
> +++ b/common/log.c
> @@ -33,11 +33,7 @@
>  #include "backtrace.h"
>  
>  static int glib_debug_level = INT_MAX;
> -static int abort_mask = 0;
> -
> -#ifndef SPICE_ABORT_MASK_DEFAULT
> -#define SPICE_ABORT_MASK_DEFAULT (G_LOG_LEVEL_CRITICAL|G_LOG_LEVEL_ERROR)
> -#endif
> +static const int abort_mask = G_LOG_LEVEL_CRITICAL|G_LOG_LEVEL_ERROR;

after this commit, abort_mask is used in spice_logv:

      g_log(log_domain, log_level, "%s", log_msg->str);

      if ((abort_mask & log_level) != 0) {
          spice_backtrace();
          abort();
      }

This allows to keep spice_critical() behaviour which aborts contrary to
g_critical() which does not abort by default. I'm quite sure that
G_LOG_LEVEL_ERROR will cause g_log() to abort.
In other words, I think you could get rid of abort_mask and just use:
      if ((log_level & G_LOG_LEVEL_CRITICAL) != 0) {
          spice_backtrace();
          abort();
      }

Looks good even without this change,

Acked-by: Christophe Fergeau <cfergeau at redhat.com>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20190206/0cdf4cfd/attachment.sig>


More information about the Spice-devel mailing list