summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 67062b7)
raw | patch | inline | side by side (parent: 67062b7)
author | Benjamin Otte <otte@gnome.org> | |
Sat, 10 Jan 2004 01:49:00 +0000 (01:49 +0000) | ||
committer | Benjamin Otte <otte@gnome.org> | |
Sat, 10 Jan 2004 01:49:00 +0000 (01:49 +0000) |
Original commit message from CVS:
2004-01-10 Benjamin Otte <in7y118@public.uni-hamburg.de>
* gst/gstinfo.c: (gst_debug_log), (gst_debug_log_valist),
(gst_debug_message_get), (gst_debug_log_default):
* gst/gstinfo.h:
Change gst_debug_log(_valist) to take a const format string.
Change prototype of log function and functions using those to
take a GstDebugMessage instead of a string that requires using
gst_debug_message_get.
2004-01-10 Benjamin Otte <in7y118@public.uni-hamburg.de>
* gst/gstinfo.c: (gst_debug_log), (gst_debug_log_valist),
(gst_debug_message_get), (gst_debug_log_default):
* gst/gstinfo.h:
Change gst_debug_log(_valist) to take a const format string.
Change prototype of log function and functions using those to
take a GstDebugMessage instead of a string that requires using
gst_debug_message_get.
ChangeLog | patch | blob | history | |
gst/gstinfo.c | patch | blob | history | |
gst/gstinfo.h | patch | blob | history |
diff --git a/ChangeLog b/ChangeLog
index add1b8f2c38be409c572e37a45a42f7ed53ecd66..e4b73d426c5bd4278ee77e5267e54330edff01dd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
+2004-01-10 Benjamin Otte <in7y118@public.uni-hamburg.de>
+
+ * gst/gstinfo.c: (gst_debug_log), (gst_debug_log_valist),
+ (gst_debug_message_get), (gst_debug_log_default):
+ * gst/gstinfo.h:
+ Change gst_debug_log(_valist) to take a const format string.
+ Change prototype of log function and functions using those to
+ take a GstDebugMessage instead of a string that requires using
+ gst_debug_message_get.
+
2004-01-08 David Schleef <ds@schleef.org>
* Makefile.am:
diff --git a/gst/gstinfo.c b/gst/gstinfo.c
index f5effd1e108da4ad270e7fd35bb6206960c19b63..dd2d29187ce30841d7c7c3917c26b66e3f6951b8 100644 (file)
--- a/gst/gstinfo.c
+++ b/gst/gstinfo.c
gpointer unused);
static void gst_debug_reset_all_thresholds (void);
+struct _GstDebugMessage {
+ gchar * message;
+ const gchar * format;
+ va_list arguments;
+};
+
/* list of all name/level pairs from --gst-debug and GST_DEBUG */
static GStaticMutex __level_name_mutex = G_STATIC_MUTEX_INIT;
static GSList *__level_name = NULL;
*/
void gst_debug_log (GstDebugCategory *category, GstDebugLevel level,
const gchar *file, const gchar *function, gint line,
- GObject *object, gchar *format, ...)
+ GObject *object, const gchar *format, ...)
{
va_list var_args;
*/
void gst_debug_log_valist (GstDebugCategory *category, GstDebugLevel level,
const gchar *file, const gchar *function, gint line,
- GObject *object, gchar *format, va_list args)
+ GObject *object, const gchar *format, va_list args)
{
- gchar *message;
+ GstDebugMessage message;
LogFuncEntry *entry;
GSList *handler;
g_return_if_fail (function != NULL);
g_return_if_fail (format != NULL);
- message = g_strdup_vprintf (format, args);
+ message.message = NULL;
+ message.format = format;
+ message.arguments = args;
+
handler = __log_functions;
while (handler) {
entry = handler->data;
handler = g_slist_next (handler);
- entry->func (category, level, file, function, line, object, message, entry->user_data);
+ entry->func (category, level, file, function, line, object, &message, entry->user_data);
+ }
+ g_free (message.message);
+}
+/**
+ * gst_debug_message_get:
+ * @message: a debug message
+ *
+ * Gets the string representation of a GstDebugMessage. This function is used
+ * in debug handlers to extract the message.
+ */
+const gchar *
+gst_debug_message_get (GstDebugMessage *message)
+{
+ if (message->message == NULL) {
+ message->message = g_strdup_vprintf (message->format, message->arguments);
}
- g_free (message);
+ return message->message;
}
+
/**
* gst_debug_construct_term_color:
* @colorinfo: the color info
void
gst_debug_log_default (GstDebugCategory *category, GstDebugLevel level,
const gchar *file, const gchar *function, gint line,
- GObject *object, gchar *message, gpointer unused)
+ GObject *object, GstDebugMessage *message, gpointer unused)
{
gchar *color;
gchar *clear;
color, gst_debug_category_get_name (category), clear,
pidcolor, pid, clear,
color, file, line, function, obj, clear,
- message);
+ gst_debug_message_get (message));
g_free (color);
g_free (pidcolor);
diff --git a/gst/gstinfo.h b/gst/gstinfo.h
index 7d7e6922cd5bd8ed0cc3f5f7029ca16c84bb4c15..cbe5c82640e835ed689952790494a1c7f63ed03f 100644 (file)
--- a/gst/gstinfo.h
+++ b/gst/gstinfo.h
#endif
#endif /* ifndef GST_FUNCTION */
+typedef struct _GstDebugMessage GstDebugMessage;
typedef void (*GstLogFunction) (GstDebugCategory * category,
GstDebugLevel level,
const gchar * file,
const gchar * function,
gint line,
GObject * object,
- gchar * message,
+ GstDebugMessage * message,
gpointer data);
/* Disable this subsystem if no varargs macro can be found.
const gchar * function,
gint line,
GObject * object,
- gchar * format,
+ const gchar * format,
...) G_GNUC_PRINTF (7, 8) G_GNUC_NO_INSTRUMENT;
void gst_debug_log_valist (GstDebugCategory * category,
GstDebugLevel level,
const gchar * function,
gint line,
GObject * object,
- gchar * format,
+ const gchar * format,
va_list args) G_GNUC_NO_INSTRUMENT;
+const gchar * gst_debug_message_get (GstDebugMessage * message);
+
void gst_debug_log_default (GstDebugCategory * category,
GstDebugLevel level,
const gchar * file,
const gchar * function,
gint line,
GObject * object,
- gchar * message,
+ GstDebugMessage * message,
gpointer unused) G_GNUC_NO_INSTRUMENT;
G_CONST_RETURN gchar *