[hotssh] gssh: We don't need to copy outgoing bytes



commit c8886a05ca52c0fe01afbbe95a975a2ae2c24ba1
Author: Colin Walters <walters verbum org>
Date:   Sun Dec 22 11:30:56 2013 -0500

    gssh: We don't need to copy outgoing bytes

 libgssh/gssh-channel-output-stream.c |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/libgssh/gssh-channel-output-stream.c b/libgssh/gssh-channel-output-stream.c
index 31fe71e..35f31c4 100644
--- a/libgssh/gssh-channel-output-stream.c
+++ b/libgssh/gssh-channel-output-stream.c
@@ -143,12 +143,12 @@ gssh_channel_output_stream_close (GOutputStream  *stream,
 
 static void
 gssh_channel_output_stream_write_async (GOutputStream       *stream,
-                                               const void          *buffer,
-                                               gsize                count,
-                                               int                  io_priority,
-                                               GCancellable        *cancellable,
-                                               GAsyncReadyCallback  callback,
-                                               gpointer             user_data)
+                                        const void          *buffer,
+                                        gsize                count,
+                                        int                  io_priority,
+                                        GCancellable        *cancellable,
+                                        GAsyncReadyCallback  callback,
+                                        gpointer             user_data)
 {
   GSshChannelOutputStream *self = GSSH_CHANNEL_OUTPUT_STREAM (stream);
 
@@ -158,7 +158,8 @@ gssh_channel_output_stream_write_async (GOutputStream       *stream,
   self->write_task = g_task_new (self, cancellable, callback, user_data);
   g_task_set_priority (self->write_task, io_priority);
 
-  self->buf = g_bytes_new (buffer, count);
+  /* Not really static, but the caller has to keep buffer alive. */
+  self->buf = g_bytes_new_static (buffer, count);
 
   _gssh_channel_output_stream_iteration (self);
 }


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