From 98e95f84c45a956def773dfabbed69e8f4fa2a77 Mon Sep 17 00:00:00 2001 From: miko Date: Wed, 31 Oct 2018 10:06:55 +0000 Subject: remove a guard in mio_read(), mio_write, sio_read() & sio_write() for a zero length request. return value of zero is preserved in this case. OK ratchov@ --- lib/libsndio/mio.c | 14 +------------- lib/libsndio/sio.c | 10 +--------- 2 files changed, 2 insertions(+), 22 deletions(-) (limited to 'lib') diff --git a/lib/libsndio/mio.c b/lib/libsndio/mio.c index 879ff656061..ddab5a4e0c8 100644 --- a/lib/libsndio/mio.c +++ b/lib/libsndio/mio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mio.c,v 1.21 2018/09/19 14:01:52 miko Exp $ */ +/* $OpenBSD: mio.c,v 1.22 2018/10/31 10:06:54 miko Exp $ */ /* * Copyright (c) 2008 Alexandre Ratchov * @@ -128,10 +128,6 @@ mio_read(struct mio_hdl *hdl, void *buf, size_t len) hdl->eof = 1; return 0; } - if (len == 0) { - DPRINTF("mio_read: zero length read ignored\n"); - return 0; - } while (todo > 0) { n = hdl->ops->read(hdl, data, todo); if (n == 0 && hdl->eof) @@ -162,14 +158,6 @@ mio_write(struct mio_hdl *hdl, const void *buf, size_t len) hdl->eof = 1; return 0; } - if (len == 0) { - DPRINTF("mio_write: zero length write ignored\n"); - return 0; - } - if (todo == 0) { - DPRINTF("mio_write: zero length write ignored\n"); - return 0; - } while (todo > 0) { n = hdl->ops->write(hdl, data, todo); if (n == 0) { diff --git a/lib/libsndio/sio.c b/lib/libsndio/sio.c index 611acc8df9b..edc1fda711d 100644 --- a/lib/libsndio/sio.c +++ b/lib/libsndio/sio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sio.c,v 1.22 2018/09/19 14:01:52 miko Exp $ */ +/* $OpenBSD: sio.c,v 1.23 2018/10/31 10:06:54 miko Exp $ */ /* * Copyright (c) 2008 Alexandre Ratchov * @@ -294,10 +294,6 @@ sio_read(struct sio_hdl *hdl, void *buf, size_t len) hdl->eof = 1; return 0; } - if (todo == 0) { - DPRINTF("sio_read: zero length read ignored\n"); - return 0; - } while (todo > 0) { if (!sio_rdrop(hdl)) return 0; @@ -335,10 +331,6 @@ sio_write(struct sio_hdl *hdl, const void *buf, size_t len) hdl->eof = 1; return 0; } - if (todo == 0) { - DPRINTF("sio_write: zero length write ignored\n"); - return 0; - } while (todo > 0) { if (!sio_wsil(hdl)) return 0; -- cgit v1.2.3