mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 19:36:18 +01:00
Remove unused header gdebug.h
This was only included from gmessages.c. Nuke the unused parts and merge the rest into gmessages.c.
This commit is contained in:
parent
37c740d509
commit
8b03fed0cf
@ -207,7 +207,6 @@ libglib_2_0_la_SOURCES = \
|
||||
gvarianttype.c \
|
||||
gwakeup.h \
|
||||
gwakeup.c \
|
||||
gdebug.h \
|
||||
gprintf.c \
|
||||
gprintfint.h
|
||||
|
||||
|
@ -1,59 +0,0 @@
|
||||
/* GLIB - Library of useful routines for C programming
|
||||
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Modified by the GLib Team and others 1997-2000. See the AUTHORS
|
||||
* file for a list of people on the GLib Team. See the ChangeLog
|
||||
* files for a list of changes. These files are distributed with
|
||||
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
||||
*/
|
||||
|
||||
#ifndef __G_DEBUG_H__
|
||||
#define __G_DEBUG_H__
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef enum {
|
||||
G_DEBUG_FATAL_WARNINGS = 1 << 0,
|
||||
G_DEBUG_FATAL_CRITICALS = 1 << 1
|
||||
} GDebugFlag;
|
||||
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
|
||||
#define G_NOTE(type, action) G_STMT_START { \
|
||||
if (!_g_debug_initialized) \
|
||||
{ _g_debug_init (); } \
|
||||
if (_g_debug_flags & G_DEBUG_##type) \
|
||||
{ action; }; } G_STMT_END
|
||||
|
||||
#else /* !G_ENABLE_DEBUG */
|
||||
|
||||
#define G_NOTE(type, action)
|
||||
|
||||
#endif /* G_ENABLE_DEBUG */
|
||||
|
||||
GLIB_VAR gboolean _g_debug_initialized;
|
||||
GLIB_VAR guint _g_debug_flags;
|
||||
|
||||
G_GNUC_INTERNAL void _g_debug_init (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __G_DEBUG_H__ */
|
@ -63,7 +63,6 @@
|
||||
|
||||
#include "gbacktrace.h"
|
||||
#include "gconvert.h"
|
||||
#include "gdebug.h"
|
||||
#include "gmem.h"
|
||||
#include "gprintfint.h"
|
||||
#include "gtestutils.h"
|
||||
@ -114,6 +113,8 @@ static GLogFunc default_log_func = g_log_default_handler;
|
||||
static gpointer default_log_data = NULL;
|
||||
static GTestLogFatalFunc fatal_log_func = NULL;
|
||||
static gpointer fatal_log_data;
|
||||
static gboolean g_debug_initialized = FALSE;
|
||||
|
||||
|
||||
/* --- functions --- */
|
||||
#ifdef G_OS_WIN32
|
||||
@ -186,6 +187,48 @@ g_messages_prefixed_init (void)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
g_debug_init (void)
|
||||
{
|
||||
typedef enum {
|
||||
G_DEBUG_FATAL_WARNINGS = 1 << 0,
|
||||
G_DEBUG_FATAL_CRITICALS = 1 << 1
|
||||
} GDebugFlag;
|
||||
const gchar *val;
|
||||
guint flags = 0;
|
||||
|
||||
g_debug_initialized = TRUE;
|
||||
|
||||
val = g_getenv ("G_DEBUG");
|
||||
if (val != NULL)
|
||||
{
|
||||
const GDebugKey keys[] = {
|
||||
{"fatal_warnings", G_DEBUG_FATAL_WARNINGS},
|
||||
{"fatal_criticals", G_DEBUG_FATAL_CRITICALS}
|
||||
};
|
||||
|
||||
flags = g_parse_debug_string (val, keys, G_N_ELEMENTS (keys));
|
||||
}
|
||||
|
||||
if (flags & G_DEBUG_FATAL_WARNINGS)
|
||||
{
|
||||
GLogLevelFlags fatal_mask;
|
||||
|
||||
fatal_mask = g_log_set_always_fatal (G_LOG_FATAL_MASK);
|
||||
fatal_mask |= G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL;
|
||||
g_log_set_always_fatal (fatal_mask);
|
||||
}
|
||||
|
||||
if (flags & G_DEBUG_FATAL_CRITICALS)
|
||||
{
|
||||
GLogLevelFlags fatal_mask;
|
||||
|
||||
fatal_mask = g_log_set_always_fatal (G_LOG_FATAL_MASK);
|
||||
fatal_mask |= G_LOG_LEVEL_CRITICAL;
|
||||
g_log_set_always_fatal (fatal_mask);
|
||||
}
|
||||
}
|
||||
|
||||
static GLogDomain*
|
||||
g_log_find_domain_L (const gchar *log_domain)
|
||||
{
|
||||
@ -500,11 +543,11 @@ g_logv (const gchar *log_domain,
|
||||
g_private_set (g_log_depth, GUINT_TO_POINTER (depth));
|
||||
|
||||
/* had to defer debug initialization until we can keep track of recursion */
|
||||
if (!(test_level & G_LOG_FLAG_RECURSION) && !_g_debug_initialized)
|
||||
if (!(test_level & G_LOG_FLAG_RECURSION) && !g_debug_initialized)
|
||||
{
|
||||
GLogLevelFlags orig_test_level = test_level;
|
||||
|
||||
_g_debug_init ();
|
||||
g_debug_init ();
|
||||
if ((domain_fatal_mask | g_log_always_fatal) & test_level)
|
||||
test_level |= G_LOG_FLAG_FATAL;
|
||||
if (test_level != orig_test_level)
|
||||
@ -1174,45 +1217,7 @@ _g_messages_thread_init_nomessage (void)
|
||||
g_messages_lock = g_mutex_new ();
|
||||
g_log_depth = g_private_new (NULL);
|
||||
g_messages_prefixed_init ();
|
||||
_g_debug_init ();
|
||||
g_debug_init ();
|
||||
}
|
||||
|
||||
gboolean _g_debug_initialized = FALSE;
|
||||
guint _g_debug_flags = 0;
|
||||
|
||||
void
|
||||
_g_debug_init (void)
|
||||
{
|
||||
const gchar *val;
|
||||
|
||||
_g_debug_initialized = TRUE;
|
||||
|
||||
val = g_getenv ("G_DEBUG");
|
||||
if (val != NULL)
|
||||
{
|
||||
const GDebugKey keys[] = {
|
||||
{"fatal_warnings", G_DEBUG_FATAL_WARNINGS},
|
||||
{"fatal_criticals", G_DEBUG_FATAL_CRITICALS}
|
||||
};
|
||||
|
||||
_g_debug_flags = g_parse_debug_string (val, keys, G_N_ELEMENTS (keys));
|
||||
}
|
||||
|
||||
if (_g_debug_flags & G_DEBUG_FATAL_WARNINGS)
|
||||
{
|
||||
GLogLevelFlags fatal_mask;
|
||||
|
||||
fatal_mask = g_log_set_always_fatal (G_LOG_FATAL_MASK);
|
||||
fatal_mask |= G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL;
|
||||
g_log_set_always_fatal (fatal_mask);
|
||||
}
|
||||
|
||||
if (_g_debug_flags & G_DEBUG_FATAL_CRITICALS)
|
||||
{
|
||||
GLogLevelFlags fatal_mask;
|
||||
|
||||
fatal_mask = g_log_set_always_fatal (G_LOG_FATAL_MASK);
|
||||
fatal_mask |= G_LOG_LEVEL_CRITICAL;
|
||||
g_log_set_always_fatal (fatal_mask);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user