[glib] Use g_memory_output_stream_steal_data here



commit 7191fc3f17d39a3fa27e990a3723403066d34826
Author: Christian Persch <chpe gnome org>
Date:   Sun Jun 20 14:33:27 2010 +0200

    Use g_memory_output_stream_steal_data here
    
    ... instead of one extra g_memdup().
    
    Bug #627181.

 gio/gdbusmessage.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/gio/gdbusmessage.c b/gio/gdbusmessage.c
index 0d2e15e..51e36ca 100644
--- a/gio/gdbusmessage.c
+++ b/gio/gdbusmessage.c
@@ -2268,8 +2268,11 @@ g_dbus_message_to_blob (GDBusMessage          *message,
 
   g_data_output_stream_put_uint32 (dos, body_size, NULL, NULL);
 
+  if (!g_output_stream_close (G_OUTPUT_STREAM (dos), NULL, error))
+    goto out;
+
   *out_size = size;
-  ret = g_memdup (g_memory_output_stream_get_data (mos), size);
+  ret = g_memory_output_stream_steal_data (mos);
 
  out:
   g_object_unref (dos);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]