Alexandre Julliard : server: Remove the return value of the flush() method, it's not used.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Mar 28 06:41:42 CDT 2007


Module: wine
Branch: master
Commit: df651875ad176f5d53374a52bde15709d6e2b3dd
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=df651875ad176f5d53374a52bde15709d6e2b3dd

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Mar 27 16:51:44 2007 +0200

server: Remove the return value of the flush() method, it's not used.

---

 server/fd.c         |    3 +--
 server/file.c       |   14 ++++----------
 server/file.h       |    4 ++--
 server/named_pipe.c |   23 +++++++----------------
 server/serial.c     |    8 +++-----
 5 files changed, 17 insertions(+), 35 deletions(-)

diff --git a/server/fd.c b/server/fd.c
index bf5f2e0..6fe4ace 100644
--- a/server/fd.c
+++ b/server/fd.c
@@ -1763,10 +1763,9 @@ void default_fd_cancel_async( struct fd *fd )
 }
 
 /* default flush() routine */
-int no_flush( struct fd *fd, struct event **event )
+void no_flush( struct fd *fd, struct event **event )
 {
     set_error( STATUS_OBJECT_TYPE_MISMATCH );
-    return 0;
 }
 
 /* default get_file_info() routine */
diff --git a/server/file.c b/server/file.c
index 193f5d3..5f5349d 100644
--- a/server/file.c
+++ b/server/file.c
@@ -69,7 +69,7 @@ static unsigned int file_map_access( struct object *obj, unsigned int access );
 static void file_destroy( struct object *obj );
 
 static int file_get_poll_events( struct fd *fd );
-static int file_flush( struct fd *fd, struct event **event );
+static void file_flush( struct fd *fd, struct event **event );
 static enum server_fd_type file_get_info( struct fd *fd, int *flags );
 
 static const struct object_ops file_ops =
@@ -227,16 +227,10 @@ static int file_get_poll_events( struct fd *fd )
     return events;
 }
 
-static int file_flush( struct fd *fd, struct event **event )
+static void file_flush( struct fd *fd, struct event **event )
 {
-    int ret = 0, unix_fd = get_unix_fd( fd );
-
-    if (unix_fd != -1)
-    {
-        ret = (fsync( unix_fd ) != -1);
-        if (!ret) file_set_error();
-    }
-    return ret;
+    int unix_fd = get_unix_fd( fd );
+    if (unix_fd != -1 && fsync( unix_fd ) == -1) file_set_error();
 }
 
 static enum server_fd_type file_get_info( struct fd *fd, int *flags )
diff --git a/server/file.h b/server/file.h
index de5bf3a..c43352a 100644
--- a/server/file.h
+++ b/server/file.h
@@ -35,7 +35,7 @@ struct fd_ops
     /* a poll() event occurred */
     void (*poll_event)(struct fd *,int event);
     /* flush the object buffers */
-    int  (*flush)(struct fd *, struct event **);
+    void (*flush)(struct fd *, struct event **);
     /* get file information */
     enum server_fd_type (*get_file_info)(struct fd *fd, int *flags);
     /* queue an async operation */
@@ -72,7 +72,7 @@ extern void fd_queue_async_timeout( struct fd *fd, const async_data_t *data, int
                                     int count, const struct timeval *timeout );
 extern void default_fd_queue_async( struct fd *fd, const async_data_t *data, int type, int count );
 extern void default_fd_cancel_async( struct fd *fd );
-extern int no_flush( struct fd *fd, struct event **event );
+extern void no_flush( struct fd *fd, struct event **event );
 extern enum server_fd_type no_get_file_info( struct fd *fd, int *flags );
 extern void no_queue_async( struct fd *fd, const async_data_t *data, int type, int count);
 extern void no_cancel_async( struct fd *fd );
diff --git a/server/named_pipe.c b/server/named_pipe.c
index 49d319a..a763982 100644
--- a/server/named_pipe.c
+++ b/server/named_pipe.c
@@ -136,7 +136,7 @@ static unsigned int pipe_map_access( struct object *obj, unsigned int access );
 static void pipe_server_dump( struct object *obj, int verbose );
 static struct fd *pipe_server_get_fd( struct object *obj );
 static void pipe_server_destroy( struct object *obj);
-static int pipe_server_flush( struct fd *fd, struct event **event );
+static void pipe_server_flush( struct fd *fd, struct event **event );
 static enum server_fd_type pipe_server_get_info( struct fd *fd, int *flags );
 
 static const struct object_ops pipe_server_ops =
@@ -170,7 +170,7 @@ static const struct fd_ops pipe_server_fd_ops =
 static void pipe_client_dump( struct object *obj, int verbose );
 static struct fd *pipe_client_get_fd( struct object *obj );
 static void pipe_client_destroy( struct object *obj );
-static int pipe_client_flush( struct fd *fd, struct event **event );
+static void pipe_client_flush( struct fd *fd, struct event **event );
 static enum server_fd_type pipe_client_get_info( struct fd *fd, int *flags );
 
 static const struct object_ops pipe_client_ops =
@@ -517,20 +517,15 @@ static void check_flushed( void *arg )
     }
 }
 
-static int pipe_server_flush( struct fd *fd, struct event **event )
+static void pipe_server_flush( struct fd *fd, struct event **event )
 {
     struct pipe_server *server = get_fd_user( fd );
 
-    if (!server)
-        return 0;
-
-    if (server->state != ps_connected_server)
-        return 0;
+    if (!server || server->state != ps_connected_server) return;
 
     /* FIXME: if multiple threads flush the same pipe,
               maybe should create a list of processes to notify */
-    if (server->flush_poll)
-        return 0;
+    if (server->flush_poll) return;
 
     if (pipe_data_remaining( server ))
     {
@@ -539,20 +534,16 @@ static int pipe_server_flush( struct fd *fd, struct event **event )
         /* this kind of sux - 
            there's no unix way to be alerted when a pipe becomes empty */
         server->event = create_event( NULL, NULL, 0, 0, 0 );
-        if (!server->event)
-            return 0;
+        if (!server->event) return;
         add_timeout( &tv, 100 );
         server->flush_poll = add_timeout_user( &tv, check_flushed, server );
         *event = server->event;
     }
-
-    return 0; 
 }
 
-static int pipe_client_flush( struct fd *fd, struct event **event )
+static void pipe_client_flush( struct fd *fd, struct event **event )
 {
     /* FIXME: what do we have to do for this? */
-    return 0;
 }
 
 static inline int is_overlapped( unsigned int options )
diff --git a/server/serial.c b/server/serial.c
index 7b92fac..bcb7945 100644
--- a/server/serial.c
+++ b/server/serial.c
@@ -64,7 +64,7 @@ static void serial_destroy(struct object *obj);
 static int serial_get_poll_events( struct fd *fd );
 static void serial_poll_event( struct fd *fd, int event );
 static enum server_fd_type serial_get_info( struct fd *fd, int *flags );
-static int serial_flush( struct fd *fd, struct event **event );
+static void serial_flush( struct fd *fd, struct event **event );
 static void serial_queue_async( struct fd *fd, const async_data_t *data, int type, int count );
 static void serial_cancel_async( struct fd *fd );
 
@@ -297,14 +297,12 @@ static void serial_cancel_async( struct fd *fd )
     async_terminate_queue( &serial->wait_q, STATUS_CANCELLED );
 }
 
-static int serial_flush( struct fd *fd, struct event **event )
+static void serial_flush( struct fd *fd, struct event **event )
 {
     /* MSDN says: If hFile is a handle to a communications device,
      * the function only flushes the transmit buffer.
      */
-    int ret = (tcflush( get_unix_fd(fd), TCOFLUSH ) != -1);
-    if (!ret) file_set_error();
-    return ret;
+    if (tcflush( get_unix_fd(fd), TCOFLUSH ) == -1) file_set_error();
 }
 
 DECL_HANDLER(get_serial_info)




More information about the wine-cvs mailing list