summaryrefslogtreecommitdiff
path: root/qemu-char.c
diff options
context:
space:
mode:
authorliguang <lig.fnst@cn.fujitsu.com>2013-06-18 11:45:35 +0800
committerMichael Tokarev <mjt@tls.msk.ru>2013-06-21 22:52:50 +0400
commite990a3932847c45839355de72e73182a53fc75ac (patch)
treee8f00071b8b32880f91e549c3c36f28dca026eb7 /qemu-char.c
parent2c8cf549571bbe0b245fc4f9680e1dbde39a015c (diff)
qemu-char: use bool in qemu_chr_open_socket and simplify code a bit
Local variables is_* should be bool by usage. While at it, simplify the logic/code a bit. Signed-off-by: liguang <lig.fnst@cn.fujitsu.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Diffstat (limited to 'qemu-char.c')
-rw-r--r--qemu-char.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/qemu-char.c b/qemu-char.c
index 2c3cfe6b69..a030e6b01e 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -2679,19 +2679,12 @@ static CharDriverState *qemu_chr_open_socket(QemuOpts *opts)
CharDriverState *chr = NULL;
Error *local_err = NULL;
int fd = -1;
- int is_listen;
- int is_waitconnect;
- int do_nodelay;
- int is_unix;
- int is_telnet;
-
- is_listen = qemu_opt_get_bool(opts, "server", 0);
- is_waitconnect = qemu_opt_get_bool(opts, "wait", 1);
- is_telnet = qemu_opt_get_bool(opts, "telnet", 0);
- do_nodelay = !qemu_opt_get_bool(opts, "delay", 1);
- is_unix = qemu_opt_get(opts, "path") != NULL;
- if (!is_listen)
- is_waitconnect = 0;
+
+ bool is_listen = qemu_opt_get_bool(opts, "server", false);
+ bool is_waitconnect = is_listen && qemu_opt_get_bool(opts, "wait", true);
+ bool is_telnet = qemu_opt_get_bool(opts, "telnet", false);
+ bool do_nodelay = !qemu_opt_get_bool(opts, "delay", true);
+ bool is_unix = qemu_opt_get(opts, "path") != NULL;
if (is_unix) {
if (is_listen) {