Commit f98e9de7 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

changed to work with different compiler-specific ways of doing macro

2007-11-18  Michael Natterer  <mitch@gimp.org>

	* app/gimp-log.[ch]: changed to work with different
	compiler-specific ways of doing macro varargs also cope with no
	macro vararg support at all. Pointed out by Hans Breuer.


svn path=/trunk/; revision=24184
parent bcb2a4e9
2007-11-18 Michael Natterer <mitch@gimp.org>
* app/gimp-log.[ch]: changed to work with different
compiler-specific ways of doing macro varargs also cope with no
macro vararg support at all. Pointed out by Hans Breuer.
2007-11-18 Michael Natterer <mitch@gimp.org>
* app/display/gimpdisplayshell-callbacks.c
......
......@@ -52,21 +52,27 @@ gimp_log (const gchar *function,
const gchar *domain,
const gchar *format,
...)
{
va_list args;
va_start (args, format);
gimp_logv (function, line, domain, format, args);
va_end (args);
}
void
gimp_logv (const gchar *function,
gint line,
const gchar *domain,
const gchar *format,
va_list args)
{
gchar *message;
if (format)
{
va_list args;
va_start (args, format);
message = g_strdup_vprintf (format, args);
va_end (args);
}
message = g_strdup_vprintf (format, args);
else
{
message = g_strdup ("called");
}
message = g_strdup ("called");
g_log (domain, G_LOG_LEVEL_DEBUG,
"%s(%d): %s", function, line, message);
......
......@@ -28,12 +28,39 @@ typedef enum
} GimpLogFlags;
#ifdef G_HAVE_ISO_VARARGS
#define GIMP_LOG(type, ...) \
G_STMT_START { \
if (gimp_log_flags & GIMP_LOG_##type) \
gimp_log (G_STRFUNC, __LINE__, #type, __VA_ARGS__); \
} G_STMT_END
#elif defined(G_HAVE_GNUC_VARARGS)
#define GIMP_LOG(type, format...) \
G_STMT_START { \
if (gimp_log_flags & GIMP_LOG_##type) \
gimp_log (G_STRFUNC, __LINE__, #type, format); \
} G_STMT_END
#else /* no varargs macros */
static void
GIMP_LOG (const gchar *function,
gint line,
const gchar *domain,
const gchar *format,
...)
{
va_list args;
va_start (args, format);
gimp_logv (function, line, domain, format, args);
va_end (args);
}
#endif /* !__GNUC__ */
extern GimpLogFlags gimp_log_flags;
......@@ -44,6 +71,11 @@ void gimp_log (const gchar *function,
const gchar *domain,
const gchar *format,
...) G_GNUC_PRINTF (4, 5);
void gimp_logv (const gchar *function,
gint line,
const gchar *domain,
const gchar *format,
va_list args);
#endif /* __GIMP_LOG_H__ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment