[libvirt] [PATCH libvirt-glib 3/3] gvir_stream_send: make it obvious that we send bytes

Guido Günther agx at sigxcpu.org
Thu Sep 14 11:29:34 UTC 2017


Fix doc and use a proper variable name
---
 libvirt-gobject/libvirt-gobject-stream.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/libvirt-gobject/libvirt-gobject-stream.c b/libvirt-gobject/libvirt-gobject-stream.c
index 296c00e..93788b5 100644
--- a/libvirt-gobject/libvirt-gobject-stream.c
+++ b/libvirt-gobject/libvirt-gobject-stream.c
@@ -440,15 +440,15 @@ gvir_stream_receive_all(GVirStream *self,
  * @cancellable: (allow-none): a %GCancellable or %NULL
  * @error: #GError for error reporting, or %NULL to ignore.
  *
- * Send data (up to @size bytes) from a stream.
+ * Send data (up to @size bytes) to a stream.
  * On error -1 is returned and @error is set accordingly.
  *
- * gvir_stream_send() can return any number of bytes, up to
- * @size. If more than @size bytes have been sendd, the additional
- * data will be returned in future calls to gvir_stream_send().
+ * gvir_stream_send() can send any number of bytes, up to
+ * @size. If less than @size bytes have been send, the additional
+ * data can be sent in future calls to gvir_stream_send().
  *
- * If there is no data available, a %G_IO_ERROR_WOULD_BLOCK error will be
- * returned.
+ * If the receiving end would block, a %G_IO_ERROR_WOULD_BLOCK error
+ * will be returned.
  *
  * Returns: Number of bytes written.
  */
@@ -458,7 +458,7 @@ gssize gvir_stream_send(GVirStream *self,
                         GCancellable *cancellable,
                         GError **error)
 {
-    int got;
+    int sent;
 
     g_return_val_if_fail(GVIR_IS_STREAM(self), -1);
     g_return_val_if_fail(buffer != NULL, -1);
@@ -468,17 +468,17 @@ gssize gvir_stream_send(GVirStream *self,
     if (g_cancellable_set_error_if_cancelled (cancellable, error))
         return -1;
 
-    got = virStreamSend(self->priv->handle, buffer, size);
+    sent = virStreamSend(self->priv->handle, buffer, size);
 
-    if (got == -2) {  /* blocking */
+    if (sent == -2) {  /* blocking */
         g_set_error_literal(error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK,
                             _("virStreamSend call would block"));
-    } else if (got < 0) {
+    } else if (sent < 0) {
         g_set_error(error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT,
-                    _("Got virStreamRecv error in %s"), G_STRFUNC);
+                    _("Sent virStreamRecv error in %s"), G_STRFUNC);
     }
 
-    return got;
+    return sent;
 }
 
 struct stream_source_helper {
-- 
2.14.1




More information about the libvir-list mailing list