[gvfs/nfs] Remove unnecessary conversion of GIOCondition



commit 5b0826095fd190a27dc9a4baf79ca295b8ea96f6
Author: Ross Lagerwall <rosslagerwall gmail com>
Date:   Tue Jan 20 20:41:11 2015 +0000

    Remove unnecessary conversion of GIOCondition

 daemon/gvfsbackendnfs.c |   49 +++-------------------------------------------
 1 files changed, 4 insertions(+), 45 deletions(-)
---
diff --git a/daemon/gvfsbackendnfs.c b/daemon/gvfsbackendnfs.c
index a823191..66d6a24 100644
--- a/daemon/gvfsbackendnfs.c
+++ b/daemon/gvfsbackendnfs.c
@@ -104,42 +104,6 @@ g_vfs_backend_nfs_finalize (GObject *object)
     (*G_OBJECT_CLASS (g_vfs_backend_nfs_parent_class)->finalize) (object);
 }
 
-static GIOCondition
-event_to_condition (int events)
-{
-  GIOCondition condition = 0;
-
-  if (events & POLLIN)
-    condition |= G_IO_IN;
-  if (events & POLLOUT)
-    condition |= G_IO_OUT;
-  if (events & POLLPRI)
-    condition |= G_IO_PRI;
-
-  return condition;
-}
-
-static int
-condition_to_event (GIOCondition condition)
-{
-  int events = 0;
-
-  if (condition & G_IO_IN)
-    events |= POLLIN;
-  if (condition & G_IO_OUT)
-    events |= POLLOUT;
-  if (condition & G_IO_PRI)
-    events |= POLLPRI;
-  if (condition & G_IO_ERR)
-    events |= POLLERR;
-  if (condition & G_IO_HUP)
-    events |= POLLHUP;
-  if (condition & G_IO_NVAL)
-    events |= POLLNVAL;
-
-  return events;
-}
-
 static gboolean
 nfs_source_prepare (GSource *source, gint *timeout)
 {
@@ -164,16 +128,12 @@ nfs_source_prepare (GSource *source, gint *timeout)
       g_source_remove_unix_fd (source, nfs_source->tag);
       nfs_source->fd = fd;
       nfs_source->events = events;
-      nfs_source->tag = g_source_add_unix_fd (source,
-                                              nfs_source->fd,
-                                              event_to_condition (events));
+      nfs_source->tag = g_source_add_unix_fd (source, nfs_source->fd, events);
     }
   else if (events != nfs_source->events)
     {
       nfs_source->events = events;
-      g_source_modify_unix_fd (source,
-                               nfs_source->tag,
-                               event_to_condition (events));
+      g_source_modify_unix_fd (source, nfs_source->tag, events);
     }
 
   return FALSE;
@@ -186,8 +146,7 @@ nfs_source_dispatch (GSource *source, GSourceFunc callback, gpointer user_data)
   int err;
 
   err = nfs_service (nfs_source->ctx,
-                     condition_to_event (g_source_query_unix_fd (source,
-                                                                 nfs_source->tag)));
+                     g_source_query_unix_fd (source, nfs_source->tag));
   if (err)
     {
       g_warning ("nfs_service error: %d, %s\n",
@@ -292,7 +251,7 @@ do_mount (GVfsBackend *backend,
   nfs_source->fd = nfs_get_fd (op_backend->ctx);
   nfs_source->tag = g_source_add_unix_fd (source,
                                           nfs_source->fd,
-                                          event_to_condition (nfs_source->events));
+                                          nfs_source->events);
   g_source_attach (source, NULL);
   op_backend->source = source;
 


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