miniobject: fix debug
[platform/upstream/gstreamer.git] / gst / gsttrace.c
index 9a03f62..498e4c2 100644 (file)
@@ -86,7 +86,7 @@ read_tsc (gint64 * dst)
 
 /**
  * gst_trace_read_tsc:
- * @dst: pointer to hold the result.
+ * @dst: (out) pointer to hold the result.
  *
  * Read a platform independent timer value that can be used in
  * benchmarks.
@@ -105,15 +105,17 @@ gint _gst_trace_on = 1;
  * @filename: a filename
  * @size: the max size of the file
  *
- * Create a ringbuffer of @size in the file with @filename to 
+ * Create a ringbuffer of @size in the file with @filename to
  * store trace results in.
  *
- * Returns: a new #GstTrace.
+ * Free-function: gst_trace_destroy
+ *
+ * Returns: (transfer full): a new #GstTrace.
  */
 GstTrace *
 gst_trace_new (const gchar * filename, gint size)
 {
-  GstTrace *trace = g_malloc (sizeof (GstTrace));
+  GstTrace *trace = g_slice_new (GstTrace);
 
   g_return_val_if_fail (trace != NULL, NULL);
   trace->filename = g_strdup (filename);
@@ -138,7 +140,7 @@ gst_trace_new (const gchar * filename, gint size)
 
 /**
  * gst_trace_destroy:
- * @trace: the #GstTrace to destroy
+ * @trace: (in) (transfer full): the #GstTrace to destroy
  *
  * Flush an close the previously allocated @trace.
  */
@@ -152,7 +154,7 @@ gst_trace_destroy (GstTrace * trace)
     gst_trace_flush (trace);
   close (trace->fd);
   g_free (trace->buf);
-  g_free (trace);
+  g_slice_free (GstTrace, trace);
 }
 
 /**
@@ -181,7 +183,7 @@ gst_trace_flush (GstTrace * trace)
  * gst_trace_text_flush:
  * @trace: the #GstTrace to flush.
  *
- * Flush any pending trace entries in @trace to the trace file, 
+ * Flush any pending trace entries in @trace to the trace file,
  * formatted as a text line with timestamp and sequence numbers.
  * @trace can be NULL in which case the default #GstTrace will be
  * flushed.
@@ -239,6 +241,7 @@ _gst_trace_add_entry (GstTrace * trace, guint32 seq, guint32 data, gchar * msg)
   entry->sequence = seq;
   entry->data = data;
   strncpy (entry->message, msg, 112);
+  entry->message[111] = '\0';
   trace->bufoffset++;
 
   gst_trace_flush (trace);
@@ -285,7 +288,7 @@ _gst_alloc_trace_register (const gchar * name)
 
   g_return_val_if_fail (name, NULL);
 
-  trace = g_new0 (GstAllocTrace, 1);
+  trace = g_slice_new (GstAllocTrace);
   trace->name = g_strdup (name);
   trace->live = 0;
   trace->mem_live = NULL;