[Spice-devel] [PATCH 1/6] Merge reds_accept_connection into reds_accept

Daniel P. Berrange berrange at redhat.com
Fri Oct 28 05:09:45 PDT 2011


From: "Daniel P. Berrange" <berrange at redhat.com>

Neither reds_accept_connection or reds_accept are very long,
so the split is pointless & increases code size for no gain.
Merge them together to reduce code size

* server/reds.c: Merge reds_accept_connection into reds_accept

Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
---
 server/reds.c |   26 ++++++++------------------
 1 files changed, 8 insertions(+), 18 deletions(-)

diff --git a/server/reds.c b/server/reds.c
index 90779ff..e3dd7bf 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -2631,22 +2631,6 @@ error:
     return NULL;
 }
 
-static RedLinkInfo *reds_accept_connection(int listen_socket)
-{
-    RedLinkInfo *link;
-    RedsStream *stream;
-
-    if (!(link = __reds_accept_connection(listen_socket))) {
-        return NULL;
-    }
-
-    stream = link->stream;
-    stream->read = stream_read_cb;
-    stream->write = stream_write_cb;
-    stream->writev = stream_writev_cb;
-
-    return link;
-}
 
 static void reds_accept_ssl_connection(int fd, int event, void *data)
 {
@@ -2709,12 +2693,18 @@ error:
 static void reds_accept(int fd, int event, void *data)
 {
     RedLinkInfo *link;
+    RedsStream *stream;
 
-    link = reds_accept_connection(reds->listen_socket);
-    if (link == NULL) {
+    if (!(link = __reds_accept_connection(reds->listen_socket))) {
         red_printf("accept failed");
         return;
     }
+
+    stream = link->stream;
+    stream->read = stream_read_cb;
+    stream->write = stream_write_cb;
+    stream->writev = stream_writev_cb;
+
     reds_handle_new_link(link);
 }
 
-- 
1.7.6.4



More information about the Spice-devel mailing list