All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-trivial] [PATCH v2 1/5] vnc: pass bool parameter for some functions
@ 2013-06-18  3:45 ` liguang
  0 siblings, 0 replies; 20+ messages in thread
From: liguang @ 2013-06-18  3:45 UTC (permalink / raw)
  To: qemu-devel, qemu-trivial; +Cc: liguang

last parameters of vnc_listen_read,vnc_connect are bool,
so pass 'false/true' instead of '0/1' for them.

Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>
---
 ui/vnc.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/ui/vnc.c b/ui/vnc.c
index dfc7459..1a8b940 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -2889,13 +2889,13 @@ static void vnc_listen_read(void *opaque, bool websocket)
 
 static void vnc_listen_regular_read(void *opaque)
 {
-    vnc_listen_read(opaque, 0);
+    vnc_listen_read(opaque, false);
 }
 
 #ifdef CONFIG_VNC_WS
 static void vnc_listen_websocket_read(void *opaque)
 {
-    vnc_listen_read(opaque, 1);
+    vnc_listen_read(opaque, true);
 }
 #endif /* CONFIG_VNC_WS */
 
@@ -3283,7 +3283,7 @@ void vnc_display_open(DisplayState *ds, const char *display, Error **errp)
         if (csock < 0) {
             goto fail;
         }
-        vnc_connect(vs, csock, 0, 0);
+        vnc_connect(vs, csock, 0, false);
     } else {
         /* listen for connects */
         char *dpy;
@@ -3345,5 +3345,5 @@ void vnc_display_add_client(DisplayState *ds, int csock, int skipauth)
 {
     VncDisplay *vs = vnc_display;
 
-    vnc_connect(vs, csock, skipauth, 0);
+    vnc_connect(vs, csock, skipauth, false);
 }
-- 
1.7.2.5



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [Qemu-devel] [PATCH v2 1/5] vnc: pass bool parameter for some functions
@ 2013-06-18  3:45 ` liguang
  0 siblings, 0 replies; 20+ messages in thread
From: liguang @ 2013-06-18  3:45 UTC (permalink / raw)
  To: qemu-devel, qemu-trivial; +Cc: liguang

last parameters of vnc_listen_read,vnc_connect are bool,
so pass 'false/true' instead of '0/1' for them.

Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>
---
 ui/vnc.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/ui/vnc.c b/ui/vnc.c
index dfc7459..1a8b940 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -2889,13 +2889,13 @@ static void vnc_listen_read(void *opaque, bool websocket)
 
 static void vnc_listen_regular_read(void *opaque)
 {
-    vnc_listen_read(opaque, 0);
+    vnc_listen_read(opaque, false);
 }
 
 #ifdef CONFIG_VNC_WS
 static void vnc_listen_websocket_read(void *opaque)
 {
-    vnc_listen_read(opaque, 1);
+    vnc_listen_read(opaque, true);
 }
 #endif /* CONFIG_VNC_WS */
 
@@ -3283,7 +3283,7 @@ void vnc_display_open(DisplayState *ds, const char *display, Error **errp)
         if (csock < 0) {
             goto fail;
         }
-        vnc_connect(vs, csock, 0, 0);
+        vnc_connect(vs, csock, 0, false);
     } else {
         /* listen for connects */
         char *dpy;
@@ -3345,5 +3345,5 @@ void vnc_display_add_client(DisplayState *ds, int csock, int skipauth)
 {
     VncDisplay *vs = vnc_display;
 
-    vnc_connect(vs, csock, skipauth, 0);
+    vnc_connect(vs, csock, skipauth, false);
 }
-- 
1.7.2.5


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [Qemu-trivial] [PATCH v2 2/5] vnc: boolize 'skipauth'
  2013-06-18  3:45 ` [Qemu-devel] " liguang
@ 2013-06-18  3:45   ` liguang
  -1 siblings, 0 replies; 20+ messages in thread
From: liguang @ 2013-06-18  3:45 UTC (permalink / raw)
  To: qemu-devel, qemu-trivial; +Cc: liguang

suggested by Michael Tokarev <mjt@tls.msk.ru>

Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>
---
 include/ui/console.h |    2 +-
 ui/vnc.c             |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/ui/console.h b/include/ui/console.h
index f1d79f9..98edf41 100644
--- a/include/ui/console.h
+++ b/include/ui/console.h
@@ -314,7 +314,7 @@ void cocoa_display_init(DisplayState *ds, int full_screen);
 /* vnc.c */
 void vnc_display_init(DisplayState *ds);
 void vnc_display_open(DisplayState *ds, const char *display, Error **errp);
-void vnc_display_add_client(DisplayState *ds, int csock, int skipauth);
+void vnc_display_add_client(DisplayState *ds, int csock, bool skipauth);
 char *vnc_display_local_addr(DisplayState *ds);
 #ifdef CONFIG_VNC
 int vnc_display_password(DisplayState *ds, const char *password);
diff --git a/ui/vnc.c b/ui/vnc.c
index 1a8b940..3b43e00 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -2771,7 +2771,7 @@ static void vnc_refresh(DisplayChangeListener *dcl)
     }
 }
 
-static void vnc_connect(VncDisplay *vd, int csock, int skipauth, bool websocket)
+static void vnc_connect(VncDisplay *vd, int csock, bool skipauth, bool websocket)
 {
     VncState *vs = g_malloc0(sizeof(VncState));
     int i;
@@ -3341,7 +3341,7 @@ fail:
 #endif /* CONFIG_VNC_WS */
 }
 
-void vnc_display_add_client(DisplayState *ds, int csock, int skipauth)
+void vnc_display_add_client(DisplayState *ds, int csock, bool skipauth)
 {
     VncDisplay *vs = vnc_display;
 
-- 
1.7.2.5



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [Qemu-devel] [PATCH v2 2/5] vnc: boolize 'skipauth'
@ 2013-06-18  3:45   ` liguang
  0 siblings, 0 replies; 20+ messages in thread
From: liguang @ 2013-06-18  3:45 UTC (permalink / raw)
  To: qemu-devel, qemu-trivial; +Cc: liguang

suggested by Michael Tokarev <mjt@tls.msk.ru>

Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>
---
 include/ui/console.h |    2 +-
 ui/vnc.c             |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/ui/console.h b/include/ui/console.h
index f1d79f9..98edf41 100644
--- a/include/ui/console.h
+++ b/include/ui/console.h
@@ -314,7 +314,7 @@ void cocoa_display_init(DisplayState *ds, int full_screen);
 /* vnc.c */
 void vnc_display_init(DisplayState *ds);
 void vnc_display_open(DisplayState *ds, const char *display, Error **errp);
-void vnc_display_add_client(DisplayState *ds, int csock, int skipauth);
+void vnc_display_add_client(DisplayState *ds, int csock, bool skipauth);
 char *vnc_display_local_addr(DisplayState *ds);
 #ifdef CONFIG_VNC
 int vnc_display_password(DisplayState *ds, const char *password);
diff --git a/ui/vnc.c b/ui/vnc.c
index 1a8b940..3b43e00 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -2771,7 +2771,7 @@ static void vnc_refresh(DisplayChangeListener *dcl)
     }
 }
 
-static void vnc_connect(VncDisplay *vd, int csock, int skipauth, bool websocket)
+static void vnc_connect(VncDisplay *vd, int csock, bool skipauth, bool websocket)
 {
     VncState *vs = g_malloc0(sizeof(VncState));
     int i;
@@ -3341,7 +3341,7 @@ fail:
 #endif /* CONFIG_VNC_WS */
 }
 
-void vnc_display_add_client(DisplayState *ds, int csock, int skipauth)
+void vnc_display_add_client(DisplayState *ds, int csock, bool skipauth)
 {
     VncDisplay *vs = vnc_display;
 
-- 
1.7.2.5

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [Qemu-trivial] [PATCH v2 3/5] qemu-char: use bool in qemu_chr_open_socket
  2013-06-18  3:45 ` [Qemu-devel] " liguang
@ 2013-06-18  3:45   ` liguang
  -1 siblings, 0 replies; 20+ messages in thread
From: liguang @ 2013-06-18  3:45 UTC (permalink / raw)
  To: qemu-devel, qemu-trivial; +Cc: liguang

local variables is_* should be bool by usage,
and last parameter of qemu_opt_get_bool is bool,
so pass true/false for it.

Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>
---
 qemu-char.c |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/qemu-char.c b/qemu-char.c
index 2c3cfe6..0d695e0 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -2679,16 +2679,16 @@ 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);
+    bool is_listen;
+    bool is_waitconnect;
+    bool do_nodelay;
+    bool is_unix;
+    bool is_telnet;
+
+    is_listen      = qemu_opt_get_bool(opts, "server", false);
+    is_waitconnect = qemu_opt_get_bool(opts, "wait", true);
+    is_telnet      = qemu_opt_get_bool(opts, "telnet", false);
+    do_nodelay     = !qemu_opt_get_bool(opts, "delay", true);
     is_unix        = qemu_opt_get(opts, "path") != NULL;
     if (!is_listen)
         is_waitconnect = 0;
-- 
1.7.2.5



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [Qemu-devel] [PATCH v2 3/5] qemu-char: use bool in qemu_chr_open_socket
@ 2013-06-18  3:45   ` liguang
  0 siblings, 0 replies; 20+ messages in thread
From: liguang @ 2013-06-18  3:45 UTC (permalink / raw)
  To: qemu-devel, qemu-trivial; +Cc: liguang

local variables is_* should be bool by usage,
and last parameter of qemu_opt_get_bool is bool,
so pass true/false for it.

Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>
---
 qemu-char.c |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/qemu-char.c b/qemu-char.c
index 2c3cfe6..0d695e0 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -2679,16 +2679,16 @@ 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);
+    bool is_listen;
+    bool is_waitconnect;
+    bool do_nodelay;
+    bool is_unix;
+    bool is_telnet;
+
+    is_listen      = qemu_opt_get_bool(opts, "server", false);
+    is_waitconnect = qemu_opt_get_bool(opts, "wait", true);
+    is_telnet      = qemu_opt_get_bool(opts, "telnet", false);
+    do_nodelay     = !qemu_opt_get_bool(opts, "delay", true);
     is_unix        = qemu_opt_get(opts, "path") != NULL;
     if (!is_listen)
         is_waitconnect = 0;
-- 
1.7.2.5

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [Qemu-trivial] [PATCH v2 4/5] sd: pass bool parameter for sd_init
  2013-06-18  3:45 ` [Qemu-devel] " liguang
@ 2013-06-18  3:45   ` liguang
  -1 siblings, 0 replies; 20+ messages in thread
From: liguang @ 2013-06-18  3:45 UTC (permalink / raw)
  To: qemu-devel, qemu-trivial; +Cc: liguang

Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>
---
 hw/sd/milkymist-memcard.c |    2 +-
 hw/sd/omap_mmc.c          |    4 ++--
 hw/sd/pl181.c             |    2 +-
 hw/sd/pxa2xx_mmci.c       |    2 +-
 hw/sd/sdhci.c             |    2 +-
 hw/sd/ssi-sd.c            |    2 +-
 6 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/hw/sd/milkymist-memcard.c b/hw/sd/milkymist-memcard.c
index d5944bc..61a8aad 100644
--- a/hw/sd/milkymist-memcard.c
+++ b/hw/sd/milkymist-memcard.c
@@ -250,7 +250,7 @@ static int milkymist_memcard_init(SysBusDevice *dev)
     DriveInfo *dinfo;
 
     dinfo = drive_get_next(IF_SD);
-    s->card = sd_init(dinfo ? dinfo->bdrv : NULL, 0);
+    s->card = sd_init(dinfo ? dinfo->bdrv : NULL, false);
     s->enabled = dinfo ? bdrv_is_inserted(dinfo->bdrv) : 0;
 
     memory_region_init_io(&s->regs_region, &memcard_mmio_ops, s,
diff --git a/hw/sd/omap_mmc.c b/hw/sd/omap_mmc.c
index d4079cd..ba9f4b3 100644
--- a/hw/sd/omap_mmc.c
+++ b/hw/sd/omap_mmc.c
@@ -592,7 +592,7 @@ struct omap_mmc_s *omap_mmc_init(hwaddr base,
     memory_region_add_subregion(sysmem, base, &s->iomem);
 
     /* Instantiate the storage */
-    s->card = sd_init(bd, 0);
+    s->card = sd_init(bd, false);
 
     return s;
 }
@@ -617,7 +617,7 @@ struct omap_mmc_s *omap2_mmc_init(struct omap_target_agent_s *ta,
     omap_l4_attach(ta, 0, &s->iomem);
 
     /* Instantiate the storage */
-    s->card = sd_init(bd, 0);
+    s->card = sd_init(bd, false);
 
     s->cdet = qemu_allocate_irqs(omap_mmc_cover_cb, s, 1)[0];
     sd_set_cb(s->card, NULL, s->cdet);
diff --git a/hw/sd/pl181.c b/hw/sd/pl181.c
index 2527296..e08fd04 100644
--- a/hw/sd/pl181.c
+++ b/hw/sd/pl181.c
@@ -485,7 +485,7 @@ static int pl181_init(SysBusDevice *dev)
     sysbus_init_irq(dev, &s->irq[1]);
     qdev_init_gpio_out(&s->busdev.qdev, s->cardstatus, 2);
     dinfo = drive_get_next(IF_SD);
-    s->card = sd_init(dinfo ? dinfo->bdrv : NULL, 0);
+    s->card = sd_init(dinfo ? dinfo->bdrv : NULL, false);
     return 0;
 }
 
diff --git a/hw/sd/pxa2xx_mmci.c b/hw/sd/pxa2xx_mmci.c
index 2db1cab..0574d6b 100644
--- a/hw/sd/pxa2xx_mmci.c
+++ b/hw/sd/pxa2xx_mmci.c
@@ -538,7 +538,7 @@ PXA2xxMMCIState *pxa2xx_mmci_init(MemoryRegion *sysmem,
     memory_region_add_subregion(sysmem, base, &s->iomem);
 
     /* Instantiate the actual storage */
-    s->card = sd_init(bd, 0);
+    s->card = sd_init(bd, false);
 
     register_savevm(NULL, "pxa2xx_mmci", 0, 0,
                     pxa2xx_mmci_save, pxa2xx_mmci_load, s);
diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c
index e64899c..ddc260f 100644
--- a/hw/sd/sdhci.c
+++ b/hw/sd/sdhci.c
@@ -1165,7 +1165,7 @@ static void sdhci_initfn(Object *obj)
     DriveInfo *di;
 
     di = drive_get_next(IF_SD);
-    s->card = sd_init(di ? di->bdrv : NULL, 0);
+    s->card = sd_init(di ? di->bdrv : NULL, false);
     s->eject_cb = qemu_allocate_irqs(sdhci_insert_eject_cb, s, 1)[0];
     s->ro_cb = qemu_allocate_irqs(sdhci_card_readonly_cb, s, 1)[0];
     sd_set_cb(s->card, s->ro_cb, s->eject_cb);
diff --git a/hw/sd/ssi-sd.c b/hw/sd/ssi-sd.c
index 4d3c4f6..d47e237 100644
--- a/hw/sd/ssi-sd.c
+++ b/hw/sd/ssi-sd.c
@@ -245,7 +245,7 @@ static int ssi_sd_init(SSISlave *dev)
 
     s->mode = SSI_SD_CMD;
     dinfo = drive_get_next(IF_SD);
-    s->sd = sd_init(dinfo ? dinfo->bdrv : NULL, 1);
+    s->sd = sd_init(dinfo ? dinfo->bdrv : NULL, true);
     register_savevm(&dev->qdev, "ssi_sd", -1, 1, ssi_sd_save, ssi_sd_load, s);
     return 0;
 }
-- 
1.7.2.5



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [Qemu-devel] [PATCH v2 4/5] sd: pass bool parameter for sd_init
@ 2013-06-18  3:45   ` liguang
  0 siblings, 0 replies; 20+ messages in thread
From: liguang @ 2013-06-18  3:45 UTC (permalink / raw)
  To: qemu-devel, qemu-trivial; +Cc: liguang

Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>
---
 hw/sd/milkymist-memcard.c |    2 +-
 hw/sd/omap_mmc.c          |    4 ++--
 hw/sd/pl181.c             |    2 +-
 hw/sd/pxa2xx_mmci.c       |    2 +-
 hw/sd/sdhci.c             |    2 +-
 hw/sd/ssi-sd.c            |    2 +-
 6 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/hw/sd/milkymist-memcard.c b/hw/sd/milkymist-memcard.c
index d5944bc..61a8aad 100644
--- a/hw/sd/milkymist-memcard.c
+++ b/hw/sd/milkymist-memcard.c
@@ -250,7 +250,7 @@ static int milkymist_memcard_init(SysBusDevice *dev)
     DriveInfo *dinfo;
 
     dinfo = drive_get_next(IF_SD);
-    s->card = sd_init(dinfo ? dinfo->bdrv : NULL, 0);
+    s->card = sd_init(dinfo ? dinfo->bdrv : NULL, false);
     s->enabled = dinfo ? bdrv_is_inserted(dinfo->bdrv) : 0;
 
     memory_region_init_io(&s->regs_region, &memcard_mmio_ops, s,
diff --git a/hw/sd/omap_mmc.c b/hw/sd/omap_mmc.c
index d4079cd..ba9f4b3 100644
--- a/hw/sd/omap_mmc.c
+++ b/hw/sd/omap_mmc.c
@@ -592,7 +592,7 @@ struct omap_mmc_s *omap_mmc_init(hwaddr base,
     memory_region_add_subregion(sysmem, base, &s->iomem);
 
     /* Instantiate the storage */
-    s->card = sd_init(bd, 0);
+    s->card = sd_init(bd, false);
 
     return s;
 }
@@ -617,7 +617,7 @@ struct omap_mmc_s *omap2_mmc_init(struct omap_target_agent_s *ta,
     omap_l4_attach(ta, 0, &s->iomem);
 
     /* Instantiate the storage */
-    s->card = sd_init(bd, 0);
+    s->card = sd_init(bd, false);
 
     s->cdet = qemu_allocate_irqs(omap_mmc_cover_cb, s, 1)[0];
     sd_set_cb(s->card, NULL, s->cdet);
diff --git a/hw/sd/pl181.c b/hw/sd/pl181.c
index 2527296..e08fd04 100644
--- a/hw/sd/pl181.c
+++ b/hw/sd/pl181.c
@@ -485,7 +485,7 @@ static int pl181_init(SysBusDevice *dev)
     sysbus_init_irq(dev, &s->irq[1]);
     qdev_init_gpio_out(&s->busdev.qdev, s->cardstatus, 2);
     dinfo = drive_get_next(IF_SD);
-    s->card = sd_init(dinfo ? dinfo->bdrv : NULL, 0);
+    s->card = sd_init(dinfo ? dinfo->bdrv : NULL, false);
     return 0;
 }
 
diff --git a/hw/sd/pxa2xx_mmci.c b/hw/sd/pxa2xx_mmci.c
index 2db1cab..0574d6b 100644
--- a/hw/sd/pxa2xx_mmci.c
+++ b/hw/sd/pxa2xx_mmci.c
@@ -538,7 +538,7 @@ PXA2xxMMCIState *pxa2xx_mmci_init(MemoryRegion *sysmem,
     memory_region_add_subregion(sysmem, base, &s->iomem);
 
     /* Instantiate the actual storage */
-    s->card = sd_init(bd, 0);
+    s->card = sd_init(bd, false);
 
     register_savevm(NULL, "pxa2xx_mmci", 0, 0,
                     pxa2xx_mmci_save, pxa2xx_mmci_load, s);
diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c
index e64899c..ddc260f 100644
--- a/hw/sd/sdhci.c
+++ b/hw/sd/sdhci.c
@@ -1165,7 +1165,7 @@ static void sdhci_initfn(Object *obj)
     DriveInfo *di;
 
     di = drive_get_next(IF_SD);
-    s->card = sd_init(di ? di->bdrv : NULL, 0);
+    s->card = sd_init(di ? di->bdrv : NULL, false);
     s->eject_cb = qemu_allocate_irqs(sdhci_insert_eject_cb, s, 1)[0];
     s->ro_cb = qemu_allocate_irqs(sdhci_card_readonly_cb, s, 1)[0];
     sd_set_cb(s->card, s->ro_cb, s->eject_cb);
diff --git a/hw/sd/ssi-sd.c b/hw/sd/ssi-sd.c
index 4d3c4f6..d47e237 100644
--- a/hw/sd/ssi-sd.c
+++ b/hw/sd/ssi-sd.c
@@ -245,7 +245,7 @@ static int ssi_sd_init(SSISlave *dev)
 
     s->mode = SSI_SD_CMD;
     dinfo = drive_get_next(IF_SD);
-    s->sd = sd_init(dinfo ? dinfo->bdrv : NULL, 1);
+    s->sd = sd_init(dinfo ? dinfo->bdrv : NULL, true);
     register_savevm(&dev->qdev, "ssi_sd", -1, 1, ssi_sd_save, ssi_sd_load, s);
     return 0;
 }
-- 
1.7.2.5

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [Qemu-trivial] [PATCH v2 5/5] ui: boolize 'full_screen'
  2013-06-18  3:45 ` [Qemu-devel] " liguang
@ 2013-06-18  3:45   ` liguang
  -1 siblings, 0 replies; 20+ messages in thread
From: liguang @ 2013-06-18  3:45 UTC (permalink / raw)
  To: qemu-devel, qemu-trivial; +Cc: liguang

full_screen parameter for functions sdl_display_init,
cocoa_display_init, curses_display_init should be
boolized by actual usage.
also boolize 'full_screen' in vl.c

it may be bold for cocoa, so if it hurts,
these changes can be dropped.

Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>
---
 include/ui/console.h |    6 +++---
 ui/curses.c          |    2 +-
 ui/sdl.c             |    2 +-
 vl.c                 |    4 ++--
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/include/ui/console.h b/include/ui/console.h
index 98edf41..e927229 100644
--- a/include/ui/console.h
+++ b/include/ui/console.h
@@ -306,10 +306,10 @@ CharDriverState *vc_init(ChardevVC *vc);
 void register_vc_handler(VcHandler *handler);
 
 /* sdl.c */
-void sdl_display_init(DisplayState *ds, int full_screen, int no_frame);
+void sdl_display_init(DisplayState *ds, bool full_screen, int no_frame);
 
 /* cocoa.m */
-void cocoa_display_init(DisplayState *ds, int full_screen);
+void cocoa_display_init(DisplayState *ds, bool full_screen);
 
 /* vnc.c */
 void vnc_display_init(DisplayState *ds);
@@ -331,7 +331,7 @@ static inline int vnc_display_pw_expire(DisplayState *ds, time_t expires)
 #endif
 
 /* curses.c */
-void curses_display_init(DisplayState *ds, int full_screen);
+void curses_display_init(DisplayState *ds, bool full_screen);
 
 /* input.c */
 int index_from_key(const char *key);
diff --git a/ui/curses.c b/ui/curses.c
index 289a955..aaee070 100644
--- a/ui/curses.c
+++ b/ui/curses.c
@@ -336,7 +336,7 @@ static const DisplayChangeListenerOps dcl_ops = {
     .dpy_text_cursor = curses_cursor_position,
 };
 
-void curses_display_init(DisplayState *ds, int full_screen)
+void curses_display_init(DisplayState *ds, bool full_screen)
 {
 #ifndef _WIN32
     if (!isatty(1)) {
diff --git a/ui/sdl.c b/ui/sdl.c
index 39a42d6..643e095 100644
--- a/ui/sdl.c
+++ b/ui/sdl.c
@@ -868,7 +868,7 @@ static const DisplayChangeListenerOps dcl_ops = {
     .dpy_cursor_define = sdl_mouse_define,
 };
 
-void sdl_display_init(DisplayState *ds, int full_screen, int no_frame)
+void sdl_display_init(DisplayState *ds, bool full_screen, int no_frame)
 {
     int flags;
     uint8_t data = 0;
diff --git a/vl.c b/vl.c
index f94ec9c..d474f76 100644
--- a/vl.c
+++ b/vl.c
@@ -198,7 +198,7 @@ static int rtc_utc = 1;
 static int rtc_date_offset = -1; /* -1 means no change */
 QEMUClock *rtc_clock;
 int vga_interface_type = VGA_NONE;
-static int full_screen = 0;
+static bool full_screen = false;
 static int no_frame = 0;
 int no_quit = 0;
 CharDriverState *serial_hds[MAX_SERIAL_PORTS];
@@ -3520,7 +3520,7 @@ int main(int argc, char **argv, char **envp)
 		loadvm = optarg;
 		break;
             case QEMU_OPTION_full_screen:
-                full_screen = 1;
+                full_screen = true;
                 break;
             case QEMU_OPTION_no_frame:
                 no_frame = 1;
-- 
1.7.2.5



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [Qemu-devel] [PATCH v2 5/5] ui: boolize 'full_screen'
@ 2013-06-18  3:45   ` liguang
  0 siblings, 0 replies; 20+ messages in thread
From: liguang @ 2013-06-18  3:45 UTC (permalink / raw)
  To: qemu-devel, qemu-trivial; +Cc: liguang

full_screen parameter for functions sdl_display_init,
cocoa_display_init, curses_display_init should be
boolized by actual usage.
also boolize 'full_screen' in vl.c

it may be bold for cocoa, so if it hurts,
these changes can be dropped.

Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>
---
 include/ui/console.h |    6 +++---
 ui/curses.c          |    2 +-
 ui/sdl.c             |    2 +-
 vl.c                 |    4 ++--
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/include/ui/console.h b/include/ui/console.h
index 98edf41..e927229 100644
--- a/include/ui/console.h
+++ b/include/ui/console.h
@@ -306,10 +306,10 @@ CharDriverState *vc_init(ChardevVC *vc);
 void register_vc_handler(VcHandler *handler);
 
 /* sdl.c */
-void sdl_display_init(DisplayState *ds, int full_screen, int no_frame);
+void sdl_display_init(DisplayState *ds, bool full_screen, int no_frame);
 
 /* cocoa.m */
-void cocoa_display_init(DisplayState *ds, int full_screen);
+void cocoa_display_init(DisplayState *ds, bool full_screen);
 
 /* vnc.c */
 void vnc_display_init(DisplayState *ds);
@@ -331,7 +331,7 @@ static inline int vnc_display_pw_expire(DisplayState *ds, time_t expires)
 #endif
 
 /* curses.c */
-void curses_display_init(DisplayState *ds, int full_screen);
+void curses_display_init(DisplayState *ds, bool full_screen);
 
 /* input.c */
 int index_from_key(const char *key);
diff --git a/ui/curses.c b/ui/curses.c
index 289a955..aaee070 100644
--- a/ui/curses.c
+++ b/ui/curses.c
@@ -336,7 +336,7 @@ static const DisplayChangeListenerOps dcl_ops = {
     .dpy_text_cursor = curses_cursor_position,
 };
 
-void curses_display_init(DisplayState *ds, int full_screen)
+void curses_display_init(DisplayState *ds, bool full_screen)
 {
 #ifndef _WIN32
     if (!isatty(1)) {
diff --git a/ui/sdl.c b/ui/sdl.c
index 39a42d6..643e095 100644
--- a/ui/sdl.c
+++ b/ui/sdl.c
@@ -868,7 +868,7 @@ static const DisplayChangeListenerOps dcl_ops = {
     .dpy_cursor_define = sdl_mouse_define,
 };
 
-void sdl_display_init(DisplayState *ds, int full_screen, int no_frame)
+void sdl_display_init(DisplayState *ds, bool full_screen, int no_frame)
 {
     int flags;
     uint8_t data = 0;
diff --git a/vl.c b/vl.c
index f94ec9c..d474f76 100644
--- a/vl.c
+++ b/vl.c
@@ -198,7 +198,7 @@ static int rtc_utc = 1;
 static int rtc_date_offset = -1; /* -1 means no change */
 QEMUClock *rtc_clock;
 int vga_interface_type = VGA_NONE;
-static int full_screen = 0;
+static bool full_screen = false;
 static int no_frame = 0;
 int no_quit = 0;
 CharDriverState *serial_hds[MAX_SERIAL_PORTS];
@@ -3520,7 +3520,7 @@ int main(int argc, char **argv, char **envp)
 		loadvm = optarg;
 		break;
             case QEMU_OPTION_full_screen:
-                full_screen = 1;
+                full_screen = true;
                 break;
             case QEMU_OPTION_no_frame:
                 no_frame = 1;
-- 
1.7.2.5

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [Qemu-trivial] [PATCH v2 1/5] vnc: pass bool parameter for some functions
  2013-06-18  3:45 ` [Qemu-devel] " liguang
@ 2013-06-19  8:17   ` Michael Tokarev
  -1 siblings, 0 replies; 20+ messages in thread
From: Michael Tokarev @ 2013-06-19  8:17 UTC (permalink / raw)
  To: liguang; +Cc: qemu-trivial, qemu-devel

18.06.2013 07:45, liguang wrote:
> last parameters of vnc_listen_read,vnc_connect are bool,
> so pass 'false/true' instead of '0/1' for them.
> 
> Reviewed-by: Andreas Färber <afaerber@suse.de>
> Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>

I think I'll apply my version instead, -- which converts remaining arguments
of functions your patch touches (so that we don't have this:

> -        vnc_connect(vs, csock, 0, 0);
> +        vnc_connect(vs, csock, 0, false);

where 3rd argument is also a bool), and which combines your patches 1/5
and 2/5 into one.

I'll resend it again in a top-level message.

Thanks,

/mjt


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [Qemu-devel] [Qemu-trivial] [PATCH v2 1/5] vnc: pass bool parameter for some functions
@ 2013-06-19  8:17   ` Michael Tokarev
  0 siblings, 0 replies; 20+ messages in thread
From: Michael Tokarev @ 2013-06-19  8:17 UTC (permalink / raw)
  To: liguang; +Cc: qemu-trivial, qemu-devel

18.06.2013 07:45, liguang wrote:
> last parameters of vnc_listen_read,vnc_connect are bool,
> so pass 'false/true' instead of '0/1' for them.
> 
> Reviewed-by: Andreas Färber <afaerber@suse.de>
> Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>

I think I'll apply my version instead, -- which converts remaining arguments
of functions your patch touches (so that we don't have this:

> -        vnc_connect(vs, csock, 0, 0);
> +        vnc_connect(vs, csock, 0, false);

where 3rd argument is also a bool), and which combines your patches 1/5
and 2/5 into one.

I'll resend it again in a top-level message.

Thanks,

/mjt

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [Qemu-trivial] [PATCH v2 3/5] qemu-char: use bool in qemu_chr_open_socket
  2013-06-18  3:45   ` [Qemu-devel] " liguang
@ 2013-06-19  8:28     ` Michael Tokarev
  -1 siblings, 0 replies; 20+ messages in thread
From: Michael Tokarev @ 2013-06-19  8:28 UTC (permalink / raw)
  To: liguang; +Cc: qemu-trivial, qemu-devel

18.06.2013 07:45, liguang wrote:
> local variables is_* should be bool by usage,
> and last parameter of qemu_opt_get_bool is bool,
> so pass true/false for it.
> 
> Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>
> ---
>  qemu-char.c |   20 ++++++++++----------
>  1 files changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/qemu-char.c b/qemu-char.c
> index 2c3cfe6..0d695e0 100644
> --- a/qemu-char.c
> +++ b/qemu-char.c
> @@ -2679,16 +2679,16 @@ 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);
> +    bool is_listen;
> +    bool is_waitconnect;
> +    bool do_nodelay;
> +    bool is_unix;
> +    bool is_telnet;
> +
> +    is_listen      = qemu_opt_get_bool(opts, "server", false);
> +    is_waitconnect = qemu_opt_get_bool(opts, "wait", true);
> +    is_telnet      = qemu_opt_get_bool(opts, "telnet", false);
> +    do_nodelay     = !qemu_opt_get_bool(opts, "delay", true);
>      is_unix        = qemu_opt_get(opts, "path") != NULL;
>      if (!is_listen)
>          is_waitconnect = 0;

So is is_waitconnect a booleand or integer? :)

How about this (I'm unsure about the author anymore ):

commit c5b775f85f5049d7315b8f8643a65ea1cc7107eb
Author: liguang <lig.fnst@cn.fujitsu.com>
Date:   Tue Jun 18 11:45:35 2013 +0800

    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>

diff --git a/qemu-char.c b/qemu-char.c
index 2c3cfe6..a030e6b 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) {



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [Qemu-devel] [Qemu-trivial] [PATCH v2 3/5] qemu-char: use bool in qemu_chr_open_socket
@ 2013-06-19  8:28     ` Michael Tokarev
  0 siblings, 0 replies; 20+ messages in thread
From: Michael Tokarev @ 2013-06-19  8:28 UTC (permalink / raw)
  To: liguang; +Cc: qemu-trivial, qemu-devel

18.06.2013 07:45, liguang wrote:
> local variables is_* should be bool by usage,
> and last parameter of qemu_opt_get_bool is bool,
> so pass true/false for it.
> 
> Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>
> ---
>  qemu-char.c |   20 ++++++++++----------
>  1 files changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/qemu-char.c b/qemu-char.c
> index 2c3cfe6..0d695e0 100644
> --- a/qemu-char.c
> +++ b/qemu-char.c
> @@ -2679,16 +2679,16 @@ 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);
> +    bool is_listen;
> +    bool is_waitconnect;
> +    bool do_nodelay;
> +    bool is_unix;
> +    bool is_telnet;
> +
> +    is_listen      = qemu_opt_get_bool(opts, "server", false);
> +    is_waitconnect = qemu_opt_get_bool(opts, "wait", true);
> +    is_telnet      = qemu_opt_get_bool(opts, "telnet", false);
> +    do_nodelay     = !qemu_opt_get_bool(opts, "delay", true);
>      is_unix        = qemu_opt_get(opts, "path") != NULL;
>      if (!is_listen)
>          is_waitconnect = 0;

So is is_waitconnect a booleand or integer? :)

How about this (I'm unsure about the author anymore ):

commit c5b775f85f5049d7315b8f8643a65ea1cc7107eb
Author: liguang <lig.fnst@cn.fujitsu.com>
Date:   Tue Jun 18 11:45:35 2013 +0800

    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>

diff --git a/qemu-char.c b/qemu-char.c
index 2c3cfe6..a030e6b 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) {

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [Qemu-trivial] [PATCH v2 4/5] sd: pass bool parameter for sd_init
  2013-06-18  3:45   ` [Qemu-devel] " liguang
@ 2013-06-19  8:30     ` Michael Tokarev
  -1 siblings, 0 replies; 20+ messages in thread
From: Michael Tokarev @ 2013-06-19  8:30 UTC (permalink / raw)
  To: liguang; +Cc: qemu-trivial, qemu-devel

Thanks, applied to the trivial patches queue.

/mjt


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [Qemu-devel] [Qemu-trivial] [PATCH v2 4/5] sd: pass bool parameter for sd_init
@ 2013-06-19  8:30     ` Michael Tokarev
  0 siblings, 0 replies; 20+ messages in thread
From: Michael Tokarev @ 2013-06-19  8:30 UTC (permalink / raw)
  To: liguang; +Cc: qemu-trivial, qemu-devel

Thanks, applied to the trivial patches queue.

/mjt

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [Qemu-trivial] [PATCH v2 5/5] ui: boolize 'full_screen'
  2013-06-18  3:45   ` [Qemu-devel] " liguang
@ 2013-06-19  8:37     ` Michael Tokarev
  -1 siblings, 0 replies; 20+ messages in thread
From: Michael Tokarev @ 2013-06-19  8:37 UTC (permalink / raw)
  To: liguang; +Cc: qemu-trivial, qemu-devel

18.06.2013 07:45, liguang wrote:
[]
> -void sdl_display_init(DisplayState *ds, int full_screen, int no_frame);
> +void sdl_display_init(DisplayState *ds, bool full_screen, int no_frame);

The same applies to no_frame, isn't it?

These conversions to bool are like this -- "thankless", because there are
so many of them all around, you touch one place and it becomes obvious
that nearby places should be touched too.  Like this:

> --- a/vl.c
> +++ b/vl.c
> @@ -198,7 +198,7 @@ static int rtc_utc = 1;
>  static int rtc_date_offset = -1; /* -1 means no change */
>  QEMUClock *rtc_clock;
>  int vga_interface_type = VGA_NONE;
> -static int full_screen = 0;
> +static bool full_screen = false;
>  static int no_frame = 0;
>  int no_quit = 0;

This no_quit is bool too... :) But I think _this_ one might be in a
separate patch.  But it is also display-specific.

Besides, I think we should rewamp this display init thing entirely,
making displays to be modules and implementing options parsing
properly.

I think I'll do that today, and will convert these to bools while
at it.

Thanks,

/mjt


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [Qemu-devel] [Qemu-trivial] [PATCH v2 5/5] ui: boolize 'full_screen'
@ 2013-06-19  8:37     ` Michael Tokarev
  0 siblings, 0 replies; 20+ messages in thread
From: Michael Tokarev @ 2013-06-19  8:37 UTC (permalink / raw)
  To: liguang; +Cc: qemu-trivial, qemu-devel

18.06.2013 07:45, liguang wrote:
[]
> -void sdl_display_init(DisplayState *ds, int full_screen, int no_frame);
> +void sdl_display_init(DisplayState *ds, bool full_screen, int no_frame);

The same applies to no_frame, isn't it?

These conversions to bool are like this -- "thankless", because there are
so many of them all around, you touch one place and it becomes obvious
that nearby places should be touched too.  Like this:

> --- a/vl.c
> +++ b/vl.c
> @@ -198,7 +198,7 @@ static int rtc_utc = 1;
>  static int rtc_date_offset = -1; /* -1 means no change */
>  QEMUClock *rtc_clock;
>  int vga_interface_type = VGA_NONE;
> -static int full_screen = 0;
> +static bool full_screen = false;
>  static int no_frame = 0;
>  int no_quit = 0;

This no_quit is bool too... :) But I think _this_ one might be in a
separate patch.  But it is also display-specific.

Besides, I think we should rewamp this display init thing entirely,
making displays to be modules and implementing options parsing
properly.

I think I'll do that today, and will convert these to bools while
at it.

Thanks,

/mjt

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [Qemu-trivial] [PATCH v2 3/5] qemu-char: use bool in qemu_chr_open_socket
  2013-06-19  8:28     ` [Qemu-devel] " Michael Tokarev
@ 2013-06-20  0:21       ` li guang
  -1 siblings, 0 replies; 20+ messages in thread
From: li guang @ 2013-06-20  0:21 UTC (permalink / raw)
  To: Michael Tokarev; +Cc: qemu-trivial, qemu-devel

在 2013-06-19三的 12:28 +0400,Michael Tokarev写道:
> 18.06.2013 07:45, liguang wrote:
> > local variables is_* should be bool by usage,
> > and last parameter of qemu_opt_get_bool is bool,
> > so pass true/false for it.
> > 
> > Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>
> > ---
> >  qemu-char.c |   20 ++++++++++----------
> >  1 files changed, 10 insertions(+), 10 deletions(-)
> > 
> > diff --git a/qemu-char.c b/qemu-char.c
> > index 2c3cfe6..0d695e0 100644
> > --- a/qemu-char.c
> > +++ b/qemu-char.c
> > @@ -2679,16 +2679,16 @@ 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);
> > +    bool is_listen;
> > +    bool is_waitconnect;
> > +    bool do_nodelay;
> > +    bool is_unix;
> > +    bool is_telnet;
> > +
> > +    is_listen      = qemu_opt_get_bool(opts, "server", false);
> > +    is_waitconnect = qemu_opt_get_bool(opts, "wait", true);
> > +    is_telnet      = qemu_opt_get_bool(opts, "telnet", false);
> > +    do_nodelay     = !qemu_opt_get_bool(opts, "delay", true);
> >      is_unix        = qemu_opt_get(opts, "path") != NULL;
> >      if (!is_listen)
> >          is_waitconnect = 0;
> 
> So is is_waitconnect a booleand or integer? :)

Oh, I'm so lazy to find more...
following is fine for me.

Thanks!

> 
> How about this (I'm unsure about the author anymore ):
> 
> commit c5b775f85f5049d7315b8f8643a65ea1cc7107eb
> Author: liguang <lig.fnst@cn.fujitsu.com>
> Date:   Tue Jun 18 11:45:35 2013 +0800
> 
>     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>
> 
> diff --git a/qemu-char.c b/qemu-char.c
> index 2c3cfe6..a030e6b 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) {
> 




^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [Qemu-devel] [Qemu-trivial] [PATCH v2 3/5] qemu-char: use bool in qemu_chr_open_socket
@ 2013-06-20  0:21       ` li guang
  0 siblings, 0 replies; 20+ messages in thread
From: li guang @ 2013-06-20  0:21 UTC (permalink / raw)
  To: Michael Tokarev; +Cc: qemu-trivial, qemu-devel

在 2013-06-19三的 12:28 +0400,Michael Tokarev写道:
> 18.06.2013 07:45, liguang wrote:
> > local variables is_* should be bool by usage,
> > and last parameter of qemu_opt_get_bool is bool,
> > so pass true/false for it.
> > 
> > Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>
> > ---
> >  qemu-char.c |   20 ++++++++++----------
> >  1 files changed, 10 insertions(+), 10 deletions(-)
> > 
> > diff --git a/qemu-char.c b/qemu-char.c
> > index 2c3cfe6..0d695e0 100644
> > --- a/qemu-char.c
> > +++ b/qemu-char.c
> > @@ -2679,16 +2679,16 @@ 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);
> > +    bool is_listen;
> > +    bool is_waitconnect;
> > +    bool do_nodelay;
> > +    bool is_unix;
> > +    bool is_telnet;
> > +
> > +    is_listen      = qemu_opt_get_bool(opts, "server", false);
> > +    is_waitconnect = qemu_opt_get_bool(opts, "wait", true);
> > +    is_telnet      = qemu_opt_get_bool(opts, "telnet", false);
> > +    do_nodelay     = !qemu_opt_get_bool(opts, "delay", true);
> >      is_unix        = qemu_opt_get(opts, "path") != NULL;
> >      if (!is_listen)
> >          is_waitconnect = 0;
> 
> So is is_waitconnect a booleand or integer? :)

Oh, I'm so lazy to find more...
following is fine for me.

Thanks!

> 
> How about this (I'm unsure about the author anymore ):
> 
> commit c5b775f85f5049d7315b8f8643a65ea1cc7107eb
> Author: liguang <lig.fnst@cn.fujitsu.com>
> Date:   Tue Jun 18 11:45:35 2013 +0800
> 
>     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>
> 
> diff --git a/qemu-char.c b/qemu-char.c
> index 2c3cfe6..a030e6b 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) {
> 

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2013-06-20  0:24 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-18  3:45 [Qemu-trivial] [PATCH v2 1/5] vnc: pass bool parameter for some functions liguang
2013-06-18  3:45 ` [Qemu-devel] " liguang
2013-06-18  3:45 ` [Qemu-trivial] [PATCH v2 2/5] vnc: boolize 'skipauth' liguang
2013-06-18  3:45   ` [Qemu-devel] " liguang
2013-06-18  3:45 ` [Qemu-trivial] [PATCH v2 3/5] qemu-char: use bool in qemu_chr_open_socket liguang
2013-06-18  3:45   ` [Qemu-devel] " liguang
2013-06-19  8:28   ` [Qemu-trivial] " Michael Tokarev
2013-06-19  8:28     ` [Qemu-devel] " Michael Tokarev
2013-06-20  0:21     ` li guang
2013-06-20  0:21       ` [Qemu-devel] " li guang
2013-06-18  3:45 ` [Qemu-trivial] [PATCH v2 4/5] sd: pass bool parameter for sd_init liguang
2013-06-18  3:45   ` [Qemu-devel] " liguang
2013-06-19  8:30   ` [Qemu-trivial] " Michael Tokarev
2013-06-19  8:30     ` [Qemu-devel] " Michael Tokarev
2013-06-18  3:45 ` [Qemu-trivial] [PATCH v2 5/5] ui: boolize 'full_screen' liguang
2013-06-18  3:45   ` [Qemu-devel] " liguang
2013-06-19  8:37   ` [Qemu-trivial] " Michael Tokarev
2013-06-19  8:37     ` [Qemu-devel] " Michael Tokarev
2013-06-19  8:17 ` [Qemu-trivial] [PATCH v2 1/5] vnc: pass bool parameter for some functions Michael Tokarev
2013-06-19  8:17   ` [Qemu-devel] " Michael Tokarev

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.