[glib: 6/15] Simplify some code in GUnixOutputStream



commit 63ea8d18f39714734c45780c36441fbe572e4c81
Author: Sebastian Dröge <sebastian centricular com>
Date:   Tue Nov 6 15:16:41 2018 +0200

    Simplify some code in GUnixOutputStream

 gio/gunixoutputstream.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
---
diff --git a/gio/gunixoutputstream.c b/gio/gunixoutputstream.c
index 3a2350009..5536e00b4 100644
--- a/gio/gunixoutputstream.c
+++ b/gio/gunixoutputstream.c
@@ -339,19 +339,18 @@ g_unix_output_stream_write (GOutputStream  *stream,
   GUnixOutputStream *unix_stream;
   gssize res = -1;
   GPollFD poll_fds[2];
-  int nfds;
+  int nfds = 0;
   int poll_ret;
 
   unix_stream = G_UNIX_OUTPUT_STREAM (stream);
 
   poll_fds[0].fd = unix_stream->priv->fd;
   poll_fds[0].events = G_IO_OUT;
+  nfds++;
 
   if (unix_stream->priv->is_pipe_or_socket &&
       g_cancellable_make_pollfd (cancellable, &poll_fds[1]))
-    nfds = 2;
-  else
-    nfds = 1;
+    nfds++;
 
   while (1)
     {


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