mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-11 15:06:14 +01:00
eliminate memset() call, since string.h has not neccessarily been included
Sun Aug 15 02:47:14 1999 Tim Janik <timj@gtk.org> * glib.h (g_trash_stack_pop): eliminate memset() call, since string.h has not neccessarily been included prior to glib.h. Mon Aug 2 21:03:10 1999 Tim Janik <timj@gtk.org> * configure.in: added --enable-msg-prefix option. * gmessages.c (g_log_default_handler): feature "prg_name (pid:%u): " if --enable-msg-prefix was selected (use "(process:%u): " if g_get_prgname () returns NULL, along the lines of g_on_error_query).
This commit is contained in:
parent
1c6c7f7489
commit
9c53053abe
13
ChangeLog
13
ChangeLog
@ -1,3 +1,16 @@
|
|||||||
|
Sun Aug 15 02:47:14 1999 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
* glib.h (g_trash_stack_pop): eliminate memset() call, since string.h
|
||||||
|
has not neccessarily been included prior to glib.h.
|
||||||
|
|
||||||
|
Mon Aug 2 21:03:10 1999 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
* configure.in: added --enable-msg-prefix option.
|
||||||
|
|
||||||
|
* gmessages.c (g_log_default_handler): feature "prg_name (pid:%u): "
|
||||||
|
if --enable-msg-prefix was selected (use "(process:%u): " if
|
||||||
|
g_get_prgname () returns NULL, along the lines of g_on_error_query).
|
||||||
|
|
||||||
1999-08-03 Tor Lillqvist <tml@iki.fi>
|
1999-08-03 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
* glib.h
|
* glib.h
|
||||||
|
@ -1,3 +1,16 @@
|
|||||||
|
Sun Aug 15 02:47:14 1999 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
* glib.h (g_trash_stack_pop): eliminate memset() call, since string.h
|
||||||
|
has not neccessarily been included prior to glib.h.
|
||||||
|
|
||||||
|
Mon Aug 2 21:03:10 1999 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
* configure.in: added --enable-msg-prefix option.
|
||||||
|
|
||||||
|
* gmessages.c (g_log_default_handler): feature "prg_name (pid:%u): "
|
||||||
|
if --enable-msg-prefix was selected (use "(process:%u): " if
|
||||||
|
g_get_prgname () returns NULL, along the lines of g_on_error_query).
|
||||||
|
|
||||||
1999-08-03 Tor Lillqvist <tml@iki.fi>
|
1999-08-03 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
* glib.h
|
* glib.h
|
||||||
|
@ -1,3 +1,16 @@
|
|||||||
|
Sun Aug 15 02:47:14 1999 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
* glib.h (g_trash_stack_pop): eliminate memset() call, since string.h
|
||||||
|
has not neccessarily been included prior to glib.h.
|
||||||
|
|
||||||
|
Mon Aug 2 21:03:10 1999 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
* configure.in: added --enable-msg-prefix option.
|
||||||
|
|
||||||
|
* gmessages.c (g_log_default_handler): feature "prg_name (pid:%u): "
|
||||||
|
if --enable-msg-prefix was selected (use "(process:%u): " if
|
||||||
|
g_get_prgname () returns NULL, along the lines of g_on_error_query).
|
||||||
|
|
||||||
1999-08-03 Tor Lillqvist <tml@iki.fi>
|
1999-08-03 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
* glib.h
|
* glib.h
|
||||||
|
@ -1,3 +1,16 @@
|
|||||||
|
Sun Aug 15 02:47:14 1999 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
* glib.h (g_trash_stack_pop): eliminate memset() call, since string.h
|
||||||
|
has not neccessarily been included prior to glib.h.
|
||||||
|
|
||||||
|
Mon Aug 2 21:03:10 1999 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
* configure.in: added --enable-msg-prefix option.
|
||||||
|
|
||||||
|
* gmessages.c (g_log_default_handler): feature "prg_name (pid:%u): "
|
||||||
|
if --enable-msg-prefix was selected (use "(process:%u): " if
|
||||||
|
g_get_prgname () returns NULL, along the lines of g_on_error_query).
|
||||||
|
|
||||||
1999-08-03 Tor Lillqvist <tml@iki.fi>
|
1999-08-03 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
* glib.h
|
* glib.h
|
||||||
|
@ -1,3 +1,16 @@
|
|||||||
|
Sun Aug 15 02:47:14 1999 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
* glib.h (g_trash_stack_pop): eliminate memset() call, since string.h
|
||||||
|
has not neccessarily been included prior to glib.h.
|
||||||
|
|
||||||
|
Mon Aug 2 21:03:10 1999 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
* configure.in: added --enable-msg-prefix option.
|
||||||
|
|
||||||
|
* gmessages.c (g_log_default_handler): feature "prg_name (pid:%u): "
|
||||||
|
if --enable-msg-prefix was selected (use "(process:%u): " if
|
||||||
|
g_get_prgname () returns NULL, along the lines of g_on_error_query).
|
||||||
|
|
||||||
1999-08-03 Tor Lillqvist <tml@iki.fi>
|
1999-08-03 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
* glib.h
|
* glib.h
|
||||||
|
@ -1,3 +1,16 @@
|
|||||||
|
Sun Aug 15 02:47:14 1999 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
* glib.h (g_trash_stack_pop): eliminate memset() call, since string.h
|
||||||
|
has not neccessarily been included prior to glib.h.
|
||||||
|
|
||||||
|
Mon Aug 2 21:03:10 1999 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
* configure.in: added --enable-msg-prefix option.
|
||||||
|
|
||||||
|
* gmessages.c (g_log_default_handler): feature "prg_name (pid:%u): "
|
||||||
|
if --enable-msg-prefix was selected (use "(process:%u): " if
|
||||||
|
g_get_prgname () returns NULL, along the lines of g_on_error_query).
|
||||||
|
|
||||||
1999-08-03 Tor Lillqvist <tml@iki.fi>
|
1999-08-03 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
* glib.h
|
* glib.h
|
||||||
|
@ -1,3 +1,16 @@
|
|||||||
|
Sun Aug 15 02:47:14 1999 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
* glib.h (g_trash_stack_pop): eliminate memset() call, since string.h
|
||||||
|
has not neccessarily been included prior to glib.h.
|
||||||
|
|
||||||
|
Mon Aug 2 21:03:10 1999 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
* configure.in: added --enable-msg-prefix option.
|
||||||
|
|
||||||
|
* gmessages.c (g_log_default_handler): feature "prg_name (pid:%u): "
|
||||||
|
if --enable-msg-prefix was selected (use "(process:%u): " if
|
||||||
|
g_get_prgname () returns NULL, along the lines of g_on_error_query).
|
||||||
|
|
||||||
1999-08-03 Tor Lillqvist <tml@iki.fi>
|
1999-08-03 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
* glib.h
|
* glib.h
|
||||||
|
@ -1,3 +1,16 @@
|
|||||||
|
Sun Aug 15 02:47:14 1999 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
* glib.h (g_trash_stack_pop): eliminate memset() call, since string.h
|
||||||
|
has not neccessarily been included prior to glib.h.
|
||||||
|
|
||||||
|
Mon Aug 2 21:03:10 1999 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
* configure.in: added --enable-msg-prefix option.
|
||||||
|
|
||||||
|
* gmessages.c (g_log_default_handler): feature "prg_name (pid:%u): "
|
||||||
|
if --enable-msg-prefix was selected (use "(process:%u): " if
|
||||||
|
g_get_prgname () returns NULL, along the lines of g_on_error_query).
|
||||||
|
|
||||||
1999-08-03 Tor Lillqvist <tml@iki.fi>
|
1999-08-03 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
* glib.h
|
* glib.h
|
||||||
|
2
NEWS
2
NEWS
@ -8,6 +8,8 @@ What's new in GLib 1.3.1:
|
|||||||
* Improvements to the OS/2 port, OS/2 module support.
|
* Improvements to the OS/2 port, OS/2 module support.
|
||||||
* Double ended queue implementation.
|
* Double ended queue implementation.
|
||||||
* GLib macros for printf() formatting, e.g. G_GULONG_FORMAT = "lu"
|
* GLib macros for printf() formatting, e.g. G_GULONG_FORMAT = "lu"
|
||||||
|
* New configure option --enable-msg-prefix to prefix messages, warnings
|
||||||
|
et ceteri with the program name and the process id.
|
||||||
* New thread-safe random number generator Mersenne Twister.
|
* New thread-safe random number generator Mersenne Twister.
|
||||||
* g_strcompress() added, g_strescape() had a slight API change, and
|
* g_strcompress() added, g_strescape() had a slight API change, and
|
||||||
more tightly defined semantics.
|
more tightly defined semantics.
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
#undef REALLOC_0_WORKS
|
#undef REALLOC_0_WORKS
|
||||||
|
|
||||||
#undef G_COMPILED_WITH_DEBUGGING
|
#undef G_COMPILED_WITH_DEBUGGING
|
||||||
|
#undef G_ENABLE_MSG_PREFIX
|
||||||
#undef G_THREADS_ENABLED
|
#undef G_THREADS_ENABLED
|
||||||
|
|
||||||
#undef GLIB_SIZEOF_GMUTEX
|
#undef GLIB_SIZEOF_GMUTEX
|
||||||
|
@ -104,6 +104,7 @@ AC_DIVERT_POP()dnl
|
|||||||
|
|
||||||
dnl declare --enable-* args and collect ac_help strings
|
dnl declare --enable-* args and collect ac_help strings
|
||||||
AC_ARG_ENABLE(debug, [ --enable-debug=[no/minimum/yes] turn on debugging [default=$debug_default]],,enable_debug=$debug_default)
|
AC_ARG_ENABLE(debug, [ --enable-debug=[no/minimum/yes] turn on debugging [default=$debug_default]],,enable_debug=$debug_default)
|
||||||
|
AC_ARG_ENABLE(msg-prefix, [ --enable-msg-prefix turn on program name and PID prefixing of messages and warnings],,enable_msg_prefix=no)
|
||||||
AC_ARG_ENABLE(mem_check, [ --enable-mem-check turn on malloc/free sanity checking [default=no]],,enable_mem_check=no)
|
AC_ARG_ENABLE(mem_check, [ --enable-mem-check turn on malloc/free sanity checking [default=no]],,enable_mem_check=no)
|
||||||
AC_ARG_ENABLE(mem_profile, [ --enable-mem-profile turn on malloc profiling atexit [default=no]],,enable_mem_profile=no)
|
AC_ARG_ENABLE(mem_profile, [ --enable-mem-profile turn on malloc profiling atexit [default=no]],,enable_mem_profile=no)
|
||||||
AC_ARG_ENABLE(ansi, [ --enable-ansi turn on strict ansi [default=no]],
|
AC_ARG_ENABLE(ansi, [ --enable-ansi turn on strict ansi [default=no]],
|
||||||
@ -144,6 +145,10 @@ fi
|
|||||||
|
|
||||||
AC_DEFINE_UNQUOTED(G_COMPILED_WITH_DEBUGGING, "${enable_debug}")
|
AC_DEFINE_UNQUOTED(G_COMPILED_WITH_DEBUGGING, "${enable_debug}")
|
||||||
|
|
||||||
|
if test "x$enable_msg_prefix" = "xyes"; then
|
||||||
|
AC_DEFINE_UNQUOTED(G_ENABLE_MSG_PREFIX, 1)
|
||||||
|
fi
|
||||||
|
|
||||||
# Checks for programs.
|
# Checks for programs.
|
||||||
AC_PROG_CC
|
AC_PROG_CC
|
||||||
AM_PROG_CC_STDC
|
AM_PROG_CC_STDC
|
||||||
|
5
glib.h
5
glib.h
@ -1687,7 +1687,10 @@ g_trash_stack_pop (GTrashStack **stack_p)
|
|||||||
if (data)
|
if (data)
|
||||||
{
|
{
|
||||||
*stack_p = data->next;
|
*stack_p = data->next;
|
||||||
memset (data, 0, sizeof (GTrashStack));
|
/* NULLify private pointer here, most platforms store NULL as
|
||||||
|
* subsequent 0 bytes
|
||||||
|
*/
|
||||||
|
data->next = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
|
@ -1687,7 +1687,10 @@ g_trash_stack_pop (GTrashStack **stack_p)
|
|||||||
if (data)
|
if (data)
|
||||||
{
|
{
|
||||||
*stack_p = data->next;
|
*stack_p = data->next;
|
||||||
memset (data, 0, sizeof (GTrashStack));
|
/* NULLify private pointer here, most platforms store NULL as
|
||||||
|
* subsequent 0 bytes
|
||||||
|
*/
|
||||||
|
data->next = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
|
@ -42,8 +42,9 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef NATIVE_WIN32
|
#ifdef NATIVE_WIN32
|
||||||
#define STRICT
|
# define STRICT
|
||||||
#include <windows.h>
|
# include <windows.h>
|
||||||
|
# include <process.h> /* For _getpid() */
|
||||||
|
|
||||||
/* Just use stdio. If we're out of memory, we're hosed anyway. */
|
/* Just use stdio. If we're out of memory, we're hosed anyway. */
|
||||||
#undef write
|
#undef write
|
||||||
@ -420,9 +421,10 @@ g_log_default_handler (const gchar *log_domain,
|
|||||||
#endif
|
#endif
|
||||||
gboolean in_recursion;
|
gboolean in_recursion;
|
||||||
gboolean is_fatal;
|
gboolean is_fatal;
|
||||||
GErrorFunc local_glib_error_func;
|
GErrorFunc local_glib_error_func;
|
||||||
GWarningFunc local_glib_warning_func;
|
GWarningFunc local_glib_warning_func;
|
||||||
GPrintFunc local_glib_message_func;
|
GPrintFunc local_glib_message_func;
|
||||||
|
gchar prg_pid[64], *prg_name = g_get_prgname ();
|
||||||
|
|
||||||
in_recursion = (log_level & G_LOG_FLAG_RECURSION) != 0;
|
in_recursion = (log_level & G_LOG_FLAG_RECURSION) != 0;
|
||||||
is_fatal = (log_level & G_LOG_FLAG_FATAL) != 0;
|
is_fatal = (log_level & G_LOG_FLAG_FATAL) != 0;
|
||||||
@ -430,6 +432,13 @@ g_log_default_handler (const gchar *log_domain,
|
|||||||
|
|
||||||
if (!message)
|
if (!message)
|
||||||
message = "g_log_default_handler(): (NULL) message";
|
message = "g_log_default_handler(): (NULL) message";
|
||||||
|
if (!prg_name)
|
||||||
|
{
|
||||||
|
prg_name = "(process";
|
||||||
|
sprintf (prg_pid, ":%u): ", getpid ());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
sprintf (prg_pid, " (pid:%u): ", getpid ());
|
||||||
|
|
||||||
#ifdef NATIVE_WIN32
|
#ifdef NATIVE_WIN32
|
||||||
/* Use just stdout as stderr is hard to get redirected from the
|
/* Use just stdout as stderr is hard to get redirected from the
|
||||||
@ -457,19 +466,23 @@ g_log_default_handler (const gchar *log_domain,
|
|||||||
}
|
}
|
||||||
/* use write(2) for output, in case we are out of memeory */
|
/* use write(2) for output, in case we are out of memeory */
|
||||||
ensure_stdout_valid ();
|
ensure_stdout_valid ();
|
||||||
|
write (fd, "\n", 1);
|
||||||
|
#ifdef G_ENABLE_MSG_PREFIX
|
||||||
|
write (fd, prg_name, strlen (prg_name));
|
||||||
|
write (fd, prg_pid, strlen (prg_pid));
|
||||||
|
#endif /* G_ENABLE_MSG_PREFIX */
|
||||||
if (log_domain)
|
if (log_domain)
|
||||||
{
|
{
|
||||||
write (fd, "\n", 1);
|
|
||||||
write (fd, log_domain, strlen (log_domain));
|
write (fd, log_domain, strlen (log_domain));
|
||||||
write (fd, "-", 1);
|
write (fd, "-", 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
write (fd, "\n** ", 4);
|
write (fd, "** ", 3);
|
||||||
if (in_recursion)
|
if (in_recursion)
|
||||||
write (fd, "ERROR (recursed) **: ", 21);
|
write (fd, "ERROR (recursed) **: ", 21);
|
||||||
else
|
else
|
||||||
write (fd, "ERROR **: ", 10);
|
write (fd, "ERROR **: ", 10);
|
||||||
write (fd, message, strlen(message));
|
write (fd, message, strlen (message));
|
||||||
if (is_fatal)
|
if (is_fatal)
|
||||||
write (fd, "\naborting...\n", 13);
|
write (fd, "\naborting...\n", 13);
|
||||||
else
|
else
|
||||||
@ -477,19 +490,23 @@ g_log_default_handler (const gchar *log_domain,
|
|||||||
break;
|
break;
|
||||||
case G_LOG_LEVEL_CRITICAL:
|
case G_LOG_LEVEL_CRITICAL:
|
||||||
ensure_stdout_valid ();
|
ensure_stdout_valid ();
|
||||||
|
write (fd, "\n", 1);
|
||||||
|
#ifdef G_ENABLE_MSG_PREFIX
|
||||||
|
write (fd, prg_name, strlen (prg_name));
|
||||||
|
write (fd, prg_pid, strlen (prg_pid));
|
||||||
|
#endif /* G_ENABLE_MSG_PREFIX */
|
||||||
if (log_domain)
|
if (log_domain)
|
||||||
{
|
{
|
||||||
write (fd, "\n", 1);
|
|
||||||
write (fd, log_domain, strlen (log_domain));
|
write (fd, log_domain, strlen (log_domain));
|
||||||
write (fd, "-", 1);
|
write (fd, "-", 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
write (fd, "\n** ", 4);
|
write (fd, "** ", 3);
|
||||||
if (in_recursion)
|
if (in_recursion)
|
||||||
write (fd, "CRITICAL (recursed) **: ", 24);
|
write (fd, "CRITICAL (recursed) **: ", 24);
|
||||||
else
|
else
|
||||||
write (fd, "CRITICAL **: ", 13);
|
write (fd, "CRITICAL **: ", 13);
|
||||||
write (fd, message, strlen(message));
|
write (fd, message, strlen (message));
|
||||||
if (is_fatal)
|
if (is_fatal)
|
||||||
write (fd, "\naborting...\n", 13);
|
write (fd, "\naborting...\n", 13);
|
||||||
else
|
else
|
||||||
@ -503,19 +520,23 @@ g_log_default_handler (const gchar *log_domain,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ensure_stdout_valid ();
|
ensure_stdout_valid ();
|
||||||
|
write (fd, "\n", 1);
|
||||||
|
#ifdef G_ENABLE_MSG_PREFIX
|
||||||
|
write (fd, prg_name, strlen (prg_name));
|
||||||
|
write (fd, prg_pid, strlen (prg_pid));
|
||||||
|
#endif /* G_ENABLE_MSG_PREFIX */
|
||||||
if (log_domain)
|
if (log_domain)
|
||||||
{
|
{
|
||||||
write (fd, "\n", 1);
|
|
||||||
write (fd, log_domain, strlen (log_domain));
|
write (fd, log_domain, strlen (log_domain));
|
||||||
write (fd, "-", 1);
|
write (fd, "-", 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
write (fd, "\n** ", 4);
|
write (fd, "** ", 3);
|
||||||
if (in_recursion)
|
if (in_recursion)
|
||||||
write (fd, "WARNING (recursed) **: ", 23);
|
write (fd, "WARNING (recursed) **: ", 23);
|
||||||
else
|
else
|
||||||
write (fd, "WARNING **: ", 12);
|
write (fd, "WARNING **: ", 12);
|
||||||
write (fd, message, strlen(message));
|
write (fd, message, strlen (message));
|
||||||
if (is_fatal)
|
if (is_fatal)
|
||||||
write (fd, "\naborting...\n", 13);
|
write (fd, "\naborting...\n", 13);
|
||||||
else
|
else
|
||||||
@ -529,6 +550,10 @@ g_log_default_handler (const gchar *log_domain,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ensure_stdout_valid ();
|
ensure_stdout_valid ();
|
||||||
|
#ifdef G_ENABLE_MSG_PREFIX
|
||||||
|
write (fd, prg_name, strlen (prg_name));
|
||||||
|
write (fd, prg_pid, strlen (prg_pid));
|
||||||
|
#endif /* G_ENABLE_MSG_PREFIX */
|
||||||
if (log_domain)
|
if (log_domain)
|
||||||
{
|
{
|
||||||
write (fd, log_domain, strlen (log_domain));
|
write (fd, log_domain, strlen (log_domain));
|
||||||
@ -538,7 +563,7 @@ g_log_default_handler (const gchar *log_domain,
|
|||||||
write (fd, "Message (recursed): ", 20);
|
write (fd, "Message (recursed): ", 20);
|
||||||
else
|
else
|
||||||
write (fd, "Message: ", 9);
|
write (fd, "Message: ", 9);
|
||||||
write (fd, message, strlen(message));
|
write (fd, message, strlen (message));
|
||||||
if (is_fatal)
|
if (is_fatal)
|
||||||
write (fd, "\naborting...\n", 13);
|
write (fd, "\naborting...\n", 13);
|
||||||
else
|
else
|
||||||
@ -546,6 +571,10 @@ g_log_default_handler (const gchar *log_domain,
|
|||||||
break;
|
break;
|
||||||
case G_LOG_LEVEL_INFO:
|
case G_LOG_LEVEL_INFO:
|
||||||
ensure_stdout_valid ();
|
ensure_stdout_valid ();
|
||||||
|
#ifdef G_ENABLE_MSG_PREFIX
|
||||||
|
write (fd, prg_name, strlen (prg_name));
|
||||||
|
write (fd, prg_pid, strlen (prg_pid));
|
||||||
|
#endif /* G_ENABLE_MSG_PREFIX */
|
||||||
if (log_domain)
|
if (log_domain)
|
||||||
{
|
{
|
||||||
write (fd, log_domain, strlen (log_domain));
|
write (fd, log_domain, strlen (log_domain));
|
||||||
@ -555,7 +584,7 @@ g_log_default_handler (const gchar *log_domain,
|
|||||||
write (fd, "INFO (recursed): ", 17);
|
write (fd, "INFO (recursed): ", 17);
|
||||||
else
|
else
|
||||||
write (fd, "INFO: ", 6);
|
write (fd, "INFO: ", 6);
|
||||||
write (fd, message, strlen(message));
|
write (fd, message, strlen (message));
|
||||||
if (is_fatal)
|
if (is_fatal)
|
||||||
write (fd, "\naborting...\n", 13);
|
write (fd, "\naborting...\n", 13);
|
||||||
else
|
else
|
||||||
@ -563,6 +592,10 @@ g_log_default_handler (const gchar *log_domain,
|
|||||||
break;
|
break;
|
||||||
case G_LOG_LEVEL_DEBUG:
|
case G_LOG_LEVEL_DEBUG:
|
||||||
ensure_stdout_valid ();
|
ensure_stdout_valid ();
|
||||||
|
#ifdef G_ENABLE_MSG_PREFIX
|
||||||
|
write (fd, prg_name, strlen (prg_name));
|
||||||
|
write (fd, prg_pid, strlen (prg_pid));
|
||||||
|
#endif /* G_ENABLE_MSG_PREFIX */
|
||||||
if (log_domain)
|
if (log_domain)
|
||||||
{
|
{
|
||||||
write (fd, log_domain, strlen (log_domain));
|
write (fd, log_domain, strlen (log_domain));
|
||||||
@ -572,7 +605,7 @@ g_log_default_handler (const gchar *log_domain,
|
|||||||
write (fd, "DEBUG (recursed): ", 18);
|
write (fd, "DEBUG (recursed): ", 18);
|
||||||
else
|
else
|
||||||
write (fd, "DEBUG: ", 7);
|
write (fd, "DEBUG: ", 7);
|
||||||
write (fd, message, strlen(message));
|
write (fd, message, strlen (message));
|
||||||
if (is_fatal)
|
if (is_fatal)
|
||||||
write (fd, "\naborting...\n", 13);
|
write (fd, "\naborting...\n", 13);
|
||||||
else
|
else
|
||||||
@ -583,6 +616,10 @@ g_log_default_handler (const gchar *log_domain,
|
|||||||
* try to make the best out of it.
|
* try to make the best out of it.
|
||||||
*/
|
*/
|
||||||
ensure_stdout_valid ();
|
ensure_stdout_valid ();
|
||||||
|
#ifdef G_ENABLE_MSG_PREFIX
|
||||||
|
write (fd, prg_name, strlen (prg_name));
|
||||||
|
write (fd, prg_pid, strlen (prg_pid));
|
||||||
|
#endif /* G_ENABLE_MSG_PREFIX */
|
||||||
if (log_domain)
|
if (log_domain)
|
||||||
{
|
{
|
||||||
write (fd, log_domain, strlen (log_domain));
|
write (fd, log_domain, strlen (log_domain));
|
||||||
@ -612,7 +649,7 @@ g_log_default_handler (const gchar *log_domain,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
write (fd, "): ", 3);
|
write (fd, "): ", 3);
|
||||||
write (fd, message, strlen(message));
|
write (fd, message, strlen (message));
|
||||||
if (is_fatal)
|
if (is_fatal)
|
||||||
write (fd, "\naborting...\n", 13);
|
write (fd, "\naborting...\n", 13);
|
||||||
else
|
else
|
||||||
|
73
gmessages.c
73
gmessages.c
@ -42,8 +42,9 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef NATIVE_WIN32
|
#ifdef NATIVE_WIN32
|
||||||
#define STRICT
|
# define STRICT
|
||||||
#include <windows.h>
|
# include <windows.h>
|
||||||
|
# include <process.h> /* For _getpid() */
|
||||||
|
|
||||||
/* Just use stdio. If we're out of memory, we're hosed anyway. */
|
/* Just use stdio. If we're out of memory, we're hosed anyway. */
|
||||||
#undef write
|
#undef write
|
||||||
@ -420,9 +421,10 @@ g_log_default_handler (const gchar *log_domain,
|
|||||||
#endif
|
#endif
|
||||||
gboolean in_recursion;
|
gboolean in_recursion;
|
||||||
gboolean is_fatal;
|
gboolean is_fatal;
|
||||||
GErrorFunc local_glib_error_func;
|
GErrorFunc local_glib_error_func;
|
||||||
GWarningFunc local_glib_warning_func;
|
GWarningFunc local_glib_warning_func;
|
||||||
GPrintFunc local_glib_message_func;
|
GPrintFunc local_glib_message_func;
|
||||||
|
gchar prg_pid[64], *prg_name = g_get_prgname ();
|
||||||
|
|
||||||
in_recursion = (log_level & G_LOG_FLAG_RECURSION) != 0;
|
in_recursion = (log_level & G_LOG_FLAG_RECURSION) != 0;
|
||||||
is_fatal = (log_level & G_LOG_FLAG_FATAL) != 0;
|
is_fatal = (log_level & G_LOG_FLAG_FATAL) != 0;
|
||||||
@ -430,6 +432,13 @@ g_log_default_handler (const gchar *log_domain,
|
|||||||
|
|
||||||
if (!message)
|
if (!message)
|
||||||
message = "g_log_default_handler(): (NULL) message";
|
message = "g_log_default_handler(): (NULL) message";
|
||||||
|
if (!prg_name)
|
||||||
|
{
|
||||||
|
prg_name = "(process";
|
||||||
|
sprintf (prg_pid, ":%u): ", getpid ());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
sprintf (prg_pid, " (pid:%u): ", getpid ());
|
||||||
|
|
||||||
#ifdef NATIVE_WIN32
|
#ifdef NATIVE_WIN32
|
||||||
/* Use just stdout as stderr is hard to get redirected from the
|
/* Use just stdout as stderr is hard to get redirected from the
|
||||||
@ -457,19 +466,23 @@ g_log_default_handler (const gchar *log_domain,
|
|||||||
}
|
}
|
||||||
/* use write(2) for output, in case we are out of memeory */
|
/* use write(2) for output, in case we are out of memeory */
|
||||||
ensure_stdout_valid ();
|
ensure_stdout_valid ();
|
||||||
|
write (fd, "\n", 1);
|
||||||
|
#ifdef G_ENABLE_MSG_PREFIX
|
||||||
|
write (fd, prg_name, strlen (prg_name));
|
||||||
|
write (fd, prg_pid, strlen (prg_pid));
|
||||||
|
#endif /* G_ENABLE_MSG_PREFIX */
|
||||||
if (log_domain)
|
if (log_domain)
|
||||||
{
|
{
|
||||||
write (fd, "\n", 1);
|
|
||||||
write (fd, log_domain, strlen (log_domain));
|
write (fd, log_domain, strlen (log_domain));
|
||||||
write (fd, "-", 1);
|
write (fd, "-", 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
write (fd, "\n** ", 4);
|
write (fd, "** ", 3);
|
||||||
if (in_recursion)
|
if (in_recursion)
|
||||||
write (fd, "ERROR (recursed) **: ", 21);
|
write (fd, "ERROR (recursed) **: ", 21);
|
||||||
else
|
else
|
||||||
write (fd, "ERROR **: ", 10);
|
write (fd, "ERROR **: ", 10);
|
||||||
write (fd, message, strlen(message));
|
write (fd, message, strlen (message));
|
||||||
if (is_fatal)
|
if (is_fatal)
|
||||||
write (fd, "\naborting...\n", 13);
|
write (fd, "\naborting...\n", 13);
|
||||||
else
|
else
|
||||||
@ -477,19 +490,23 @@ g_log_default_handler (const gchar *log_domain,
|
|||||||
break;
|
break;
|
||||||
case G_LOG_LEVEL_CRITICAL:
|
case G_LOG_LEVEL_CRITICAL:
|
||||||
ensure_stdout_valid ();
|
ensure_stdout_valid ();
|
||||||
|
write (fd, "\n", 1);
|
||||||
|
#ifdef G_ENABLE_MSG_PREFIX
|
||||||
|
write (fd, prg_name, strlen (prg_name));
|
||||||
|
write (fd, prg_pid, strlen (prg_pid));
|
||||||
|
#endif /* G_ENABLE_MSG_PREFIX */
|
||||||
if (log_domain)
|
if (log_domain)
|
||||||
{
|
{
|
||||||
write (fd, "\n", 1);
|
|
||||||
write (fd, log_domain, strlen (log_domain));
|
write (fd, log_domain, strlen (log_domain));
|
||||||
write (fd, "-", 1);
|
write (fd, "-", 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
write (fd, "\n** ", 4);
|
write (fd, "** ", 3);
|
||||||
if (in_recursion)
|
if (in_recursion)
|
||||||
write (fd, "CRITICAL (recursed) **: ", 24);
|
write (fd, "CRITICAL (recursed) **: ", 24);
|
||||||
else
|
else
|
||||||
write (fd, "CRITICAL **: ", 13);
|
write (fd, "CRITICAL **: ", 13);
|
||||||
write (fd, message, strlen(message));
|
write (fd, message, strlen (message));
|
||||||
if (is_fatal)
|
if (is_fatal)
|
||||||
write (fd, "\naborting...\n", 13);
|
write (fd, "\naborting...\n", 13);
|
||||||
else
|
else
|
||||||
@ -503,19 +520,23 @@ g_log_default_handler (const gchar *log_domain,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ensure_stdout_valid ();
|
ensure_stdout_valid ();
|
||||||
|
write (fd, "\n", 1);
|
||||||
|
#ifdef G_ENABLE_MSG_PREFIX
|
||||||
|
write (fd, prg_name, strlen (prg_name));
|
||||||
|
write (fd, prg_pid, strlen (prg_pid));
|
||||||
|
#endif /* G_ENABLE_MSG_PREFIX */
|
||||||
if (log_domain)
|
if (log_domain)
|
||||||
{
|
{
|
||||||
write (fd, "\n", 1);
|
|
||||||
write (fd, log_domain, strlen (log_domain));
|
write (fd, log_domain, strlen (log_domain));
|
||||||
write (fd, "-", 1);
|
write (fd, "-", 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
write (fd, "\n** ", 4);
|
write (fd, "** ", 3);
|
||||||
if (in_recursion)
|
if (in_recursion)
|
||||||
write (fd, "WARNING (recursed) **: ", 23);
|
write (fd, "WARNING (recursed) **: ", 23);
|
||||||
else
|
else
|
||||||
write (fd, "WARNING **: ", 12);
|
write (fd, "WARNING **: ", 12);
|
||||||
write (fd, message, strlen(message));
|
write (fd, message, strlen (message));
|
||||||
if (is_fatal)
|
if (is_fatal)
|
||||||
write (fd, "\naborting...\n", 13);
|
write (fd, "\naborting...\n", 13);
|
||||||
else
|
else
|
||||||
@ -529,6 +550,10 @@ g_log_default_handler (const gchar *log_domain,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ensure_stdout_valid ();
|
ensure_stdout_valid ();
|
||||||
|
#ifdef G_ENABLE_MSG_PREFIX
|
||||||
|
write (fd, prg_name, strlen (prg_name));
|
||||||
|
write (fd, prg_pid, strlen (prg_pid));
|
||||||
|
#endif /* G_ENABLE_MSG_PREFIX */
|
||||||
if (log_domain)
|
if (log_domain)
|
||||||
{
|
{
|
||||||
write (fd, log_domain, strlen (log_domain));
|
write (fd, log_domain, strlen (log_domain));
|
||||||
@ -538,7 +563,7 @@ g_log_default_handler (const gchar *log_domain,
|
|||||||
write (fd, "Message (recursed): ", 20);
|
write (fd, "Message (recursed): ", 20);
|
||||||
else
|
else
|
||||||
write (fd, "Message: ", 9);
|
write (fd, "Message: ", 9);
|
||||||
write (fd, message, strlen(message));
|
write (fd, message, strlen (message));
|
||||||
if (is_fatal)
|
if (is_fatal)
|
||||||
write (fd, "\naborting...\n", 13);
|
write (fd, "\naborting...\n", 13);
|
||||||
else
|
else
|
||||||
@ -546,6 +571,10 @@ g_log_default_handler (const gchar *log_domain,
|
|||||||
break;
|
break;
|
||||||
case G_LOG_LEVEL_INFO:
|
case G_LOG_LEVEL_INFO:
|
||||||
ensure_stdout_valid ();
|
ensure_stdout_valid ();
|
||||||
|
#ifdef G_ENABLE_MSG_PREFIX
|
||||||
|
write (fd, prg_name, strlen (prg_name));
|
||||||
|
write (fd, prg_pid, strlen (prg_pid));
|
||||||
|
#endif /* G_ENABLE_MSG_PREFIX */
|
||||||
if (log_domain)
|
if (log_domain)
|
||||||
{
|
{
|
||||||
write (fd, log_domain, strlen (log_domain));
|
write (fd, log_domain, strlen (log_domain));
|
||||||
@ -555,7 +584,7 @@ g_log_default_handler (const gchar *log_domain,
|
|||||||
write (fd, "INFO (recursed): ", 17);
|
write (fd, "INFO (recursed): ", 17);
|
||||||
else
|
else
|
||||||
write (fd, "INFO: ", 6);
|
write (fd, "INFO: ", 6);
|
||||||
write (fd, message, strlen(message));
|
write (fd, message, strlen (message));
|
||||||
if (is_fatal)
|
if (is_fatal)
|
||||||
write (fd, "\naborting...\n", 13);
|
write (fd, "\naborting...\n", 13);
|
||||||
else
|
else
|
||||||
@ -563,6 +592,10 @@ g_log_default_handler (const gchar *log_domain,
|
|||||||
break;
|
break;
|
||||||
case G_LOG_LEVEL_DEBUG:
|
case G_LOG_LEVEL_DEBUG:
|
||||||
ensure_stdout_valid ();
|
ensure_stdout_valid ();
|
||||||
|
#ifdef G_ENABLE_MSG_PREFIX
|
||||||
|
write (fd, prg_name, strlen (prg_name));
|
||||||
|
write (fd, prg_pid, strlen (prg_pid));
|
||||||
|
#endif /* G_ENABLE_MSG_PREFIX */
|
||||||
if (log_domain)
|
if (log_domain)
|
||||||
{
|
{
|
||||||
write (fd, log_domain, strlen (log_domain));
|
write (fd, log_domain, strlen (log_domain));
|
||||||
@ -572,7 +605,7 @@ g_log_default_handler (const gchar *log_domain,
|
|||||||
write (fd, "DEBUG (recursed): ", 18);
|
write (fd, "DEBUG (recursed): ", 18);
|
||||||
else
|
else
|
||||||
write (fd, "DEBUG: ", 7);
|
write (fd, "DEBUG: ", 7);
|
||||||
write (fd, message, strlen(message));
|
write (fd, message, strlen (message));
|
||||||
if (is_fatal)
|
if (is_fatal)
|
||||||
write (fd, "\naborting...\n", 13);
|
write (fd, "\naborting...\n", 13);
|
||||||
else
|
else
|
||||||
@ -583,6 +616,10 @@ g_log_default_handler (const gchar *log_domain,
|
|||||||
* try to make the best out of it.
|
* try to make the best out of it.
|
||||||
*/
|
*/
|
||||||
ensure_stdout_valid ();
|
ensure_stdout_valid ();
|
||||||
|
#ifdef G_ENABLE_MSG_PREFIX
|
||||||
|
write (fd, prg_name, strlen (prg_name));
|
||||||
|
write (fd, prg_pid, strlen (prg_pid));
|
||||||
|
#endif /* G_ENABLE_MSG_PREFIX */
|
||||||
if (log_domain)
|
if (log_domain)
|
||||||
{
|
{
|
||||||
write (fd, log_domain, strlen (log_domain));
|
write (fd, log_domain, strlen (log_domain));
|
||||||
@ -612,7 +649,7 @@ g_log_default_handler (const gchar *log_domain,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
write (fd, "): ", 3);
|
write (fd, "): ", 3);
|
||||||
write (fd, message, strlen(message));
|
write (fd, message, strlen (message));
|
||||||
if (is_fatal)
|
if (is_fatal)
|
||||||
write (fd, "\naborting...\n", 13);
|
write (fd, "\naborting...\n", 13);
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user