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

Daniel P. Berrange berrange at redhat.com
Mon Dec 12 08:52:28 PST 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 acd8495..10ebf19 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -2736,22 +2736,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)
 {
@@ -2814,12 +2798,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.7.3



More information about the Spice-devel mailing list