speechd-discuss
[Top][All Lists]
Advanced

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

[PATCH 1/1] remove dead code after server_data_on call


From: Andrei Kholodnyi
Subject: [PATCH 1/1] remove dead code after server_data_on call
Date: Thu, 28 Jan 2016 23:42:55 +0100

server_data_on function always returns 0, no need to analyze return value
make function return void instead and remove dead code
---
 src/server/parse.c  | 8 +-------
 src/server/server.c | 5 +++--
 src/server/server.h | 2 +-
 3 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/src/server/parse.c b/src/server/parse.c
index 95ce6c7..78bc0ab 100644
--- a/src/server/parse.c
+++ b/src/server/parse.c
@@ -65,7 +65,6 @@ char *parse(const char *buf, const int bytes, const int fd)
 {
        TSpeechDMessage *new;
        char *command;
-       int r;
        int end_data;
        char *pos;
        int reparted;
@@ -133,12 +132,7 @@ char *parse(const char *buf, const int bytes, const int fd)
                        /* Ckeck if we have enough space in awaiting_data table 
for
                         * this client, that can have higher file descriptor 
that
                         * everything we got before */
-                       r = server_data_on(fd);
-                       if (r != 0) {
-                               if (SPEECHD_DEBUG)
-                                       FATAL("Can't switch to data on mode\n");
-                               return g_strdup(ERR_INTERNAL);
-                       }
+                       server_data_on(fd);
                        return g_strdup(OK_RECEIVE_DATA);
                }
                g_free(command);
diff --git a/src/server/server.c b/src/server/server.c
index 6bdc78e..3191457 100644
--- a/src/server/server.c
+++ b/src/server/server.c
@@ -200,7 +200,7 @@ queue_message(TSpeechDMessage * new, int fd, int 
history_flag,
 #undef COPY_SET_STR
 
 /* Switch data mode on for the particular client. */
-int server_data_on(int fd)
+void server_data_on(int fd)
 {
        TSpeechDSock *speechd_socket = speechd_socket_get_by_fd(fd);
        assert(speechd_socket);
@@ -209,7 +209,7 @@ int server_data_on(int fd)
        /* Create new output buffer */
        speechd_socket->o_buf = g_string_new("");
        MSG(4, "Switching to data mode...");
-       return 0;
+       return;
 }
 
 /* Switch data mode off for the particular client. */
@@ -221,6 +221,7 @@ void server_data_off(int fd)
        speechd_socket->o_bytes = 0;
        g_string_free(speechd_socket->o_buf, 1);
        speechd_socket->o_buf = NULL;
+       return;
 }
 
 /* Serve the client on _fd_ if we got some activity. */
diff --git a/src/server/server.h b/src/server/server.h
index f1dab20..39b895b 100644
--- a/src/server/server.h
+++ b/src/server/server.h
@@ -29,7 +29,7 @@
 int serve(int fd);
 
 /* Switches `receiving data' mode on and off for specified client */
-int server_data_on(int fd);
+void server_data_on(int fd);
 void server_data_off(int fd);
 
 /* Put a message into Dispatcher's queue */
-- 
2.5.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]