[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 3/5] virtio-serial: Simplify condition for a while l
From: |
Amit Shah |
Subject: |
[Qemu-devel] [PATCH 3/5] virtio-serial: Simplify condition for a while loop |
Date: |
Fri, 10 Dec 2010 18:55:16 +0530 |
Separate out a non-changing condition over the period of a loop into an
if statement before the loop. This will be used later to re-work the
loop.
Signed-off-by: Amit Shah <address@hidden>
---
hw/virtio-serial-bus.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c
index 74ba5ec..ecf0056 100644
--- a/hw/virtio-serial-bus.c
+++ b/hw/virtio-serial-bus.c
@@ -121,7 +121,10 @@ static void do_flush_queued_data(VirtIOSerialPort *port,
VirtQueue *vq,
assert(port || discard);
assert(virtio_queue_ready(vq));
- while ((discard || !port->throttled) && virtqueue_pop(vq, &elem)) {
+ if (!discard && port->throttled) {
+ return;
+ }
+ while (virtqueue_pop(vq, &elem)) {
uint8_t *buf;
size_t ret, buf_size;
--
1.7.3.2
[Qemu-devel] [PATCH 5/5] virtio-serial: Error out if guest sends unexpected vq elements, Amit Shah, 2010/12/10