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/vdagentd/virtio-port.c | 15 +++++---------- src/vdagentd/virtio-port.h | 8 +++----- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/src/vdagentd/virtio-port.c b/src/vdagentd/virtio-port.c index 1fac1db..e48d107 100644 --- a/src/vdagentd/virtio-port.c +++ b/src/vdagentd/virtio-port.c @@ -189,7 +189,7 @@ static struct vdagent_virtio_port_buf* vdagent_virtio_port_get_last_wbuf( return wbuf; } -int vdagent_virtio_port_write_start( +void vdagent_virtio_port_write_start( struct vdagent_virtio_port *vport, uint32_t port_nr, uint32_t message_type, @@ -223,13 +223,11 @@ int vdagent_virtio_port_write_start( if (!vport->write_buf) { vport->write_buf = new_wbuf; - return 0; + return; } wbuf = vdagent_virtio_port_get_last_wbuf(vport); wbuf->next = new_wbuf; - - return 0; } int vdagent_virtio_port_write_append(struct vdagent_virtio_port *vport, @@ -253,7 +251,7 @@ int vdagent_virtio_port_write_append(struct vdagent_virtio_port *vport, return 0; } -int vdagent_virtio_port_write( +void vdagent_virtio_port_write( struct vdagent_virtio_port *vport, uint32_t port_nr, uint32_t message_type, @@ -261,12 +259,9 @@ int vdagent_virtio_port_write( const uint8_t *data, uint32_t data_size) { - if (vdagent_virtio_port_write_start(vport, port_nr, message_type, - message_opaque, data_size)) { - return -1; - } + vdagent_virtio_port_write_start(vport, port_nr, message_type, + message_opaque, data_size); vdagent_virtio_port_write_append(vport, data, data_size); - return 0; } void vdagent_virtio_port_flush(struct vdagent_virtio_port **vportp) diff --git a/src/vdagentd/virtio-port.h b/src/vdagentd/virtio-port.h index f899e30..dffb410 100644 --- a/src/vdagentd/virtio-port.h +++ b/src/vdagentd/virtio-port.h @@ -75,10 +75,8 @@ void vdagent_virtio_port_handle_fds(struct vdagent_virtio_port **vportp, fd_set *readfds, fd_set *writefds); -/* Queue a message for delivery, either bit by bit, or all at once - - Returns 0 on success -1 on error (only happens when malloc fails) */ -int vdagent_virtio_port_write_start( +/* Queue a message for delivery, either bit by bit, or all at once */ +void vdagent_virtio_port_write_start( struct vdagent_virtio_port *vport, uint32_t port_nr, uint32_t message_type, @@ -90,7 +88,7 @@ int vdagent_virtio_port_write_append( const uint8_t *data, uint32_t size); -int vdagent_virtio_port_write( +void vdagent_virtio_port_write( struct vdagent_virtio_port *vport, uint32_t port_nr, uint32_t message_type, -- 2.17.1 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel