The functions would return -1 only if malloc() failed, otherwise 0. Since malloc() was replaced by g_malloc(), which terminates the program if the allocation fails, return void instead. Signed-off-by: Jakub Janků <jjanku@xxxxxxxxxx> --- src/udscs.c | 13 ++++--------- src/udscs.h | 5 ++--- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/src/udscs.c b/src/udscs.c index 31643e9..59e24d8 100644 --- a/src/udscs.c +++ b/src/udscs.c @@ -183,7 +183,7 @@ void *udscs_get_user_data(struct udscs_connection *conn) return conn->user_data; } -int udscs_write(struct udscs_connection *conn, uint32_t type, uint32_t arg1, +void udscs_write(struct udscs_connection *conn, uint32_t type, uint32_t arg1, uint32_t arg2, const uint8_t *data, uint32_t size) { struct udscs_buf *wbuf, *new_wbuf; @@ -222,7 +222,7 @@ int udscs_write(struct udscs_connection *conn, uint32_t type, uint32_t arg1, if (!conn->write_buf) { conn->write_buf = new_wbuf; - return 0; + return; } /* maybe we should limit the write_buf stack depth ? */ @@ -231,8 +231,6 @@ int udscs_write(struct udscs_connection *conn, uint32_t type, uint32_t arg1, wbuf = wbuf->next; wbuf->next = new_wbuf; - - return 0; } /* A helper for udscs_do_read() */ @@ -574,7 +572,7 @@ void udscs_server_handle_fds(struct udscs_server *server, fd_set *readfds, } } -int udscs_server_write_all(struct udscs_server *server, +void udscs_server_write_all(struct udscs_server *server, uint32_t type, uint32_t arg1, uint32_t arg2, const uint8_t *data, uint32_t size) { @@ -582,12 +580,9 @@ int udscs_server_write_all(struct udscs_server *server, conn = server->connections_head.next; while (conn) { - if (udscs_write(conn, type, arg1, arg2, data, size)) - return -1; + udscs_write(conn, type, arg1, arg2, data, size); conn = conn->next; } - - return 0; } int udscs_server_for_all_clients(struct udscs_server *server, diff --git a/src/udscs.h b/src/udscs.h index 4f47b7f..a863e16 100644 --- a/src/udscs.h +++ b/src/udscs.h @@ -79,9 +79,8 @@ struct udscs_connection *udscs_connect(const char *socketname, void udscs_destroy_connection(struct udscs_connection **connp); /* Queue a message for delivery to the client connected through conn. - * Return value: 0 on success -1 on error (only happens when malloc fails). */ -int udscs_write(struct udscs_connection *conn, uint32_t type, uint32_t arg1, +void udscs_write(struct udscs_connection *conn, uint32_t type, uint32_t arg1, uint32_t arg2, const uint8_t *data, uint32_t size); /* Associates the specified user data with the connection. */ @@ -141,7 +140,7 @@ void udscs_destroy_server(struct udscs_server *server); /* Like udscs_write, but then send the message to all clients connected to * the server. */ -int udscs_server_write_all(struct udscs_server *server, +void udscs_server_write_all(struct udscs_server *server, uint32_t type, uint32_t arg1, uint32_t arg2, const uint8_t *data, uint32_t size); -- 2.17.1 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel