[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 8/8] vl: Use size_t for sizes in get_boot_devices_li
From: |
Markus Armbruster |
Subject: |
[Qemu-devel] [PATCH 8/8] vl: Use size_t for sizes in get_boot_devices_list() |
Date: |
Wed, 16 Jan 2013 14:50:29 +0100 |
Code mixes uint32_t, int and size_t. Very unlikely to go wrong in
practice, but clean it up anyway.
Signed-off-by: Markus Armbruster <address@hidden>
---
hw/fw_cfg.c | 2 +-
include/sysemu/sysemu.h | 2 +-
vl.c | 6 +++---
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/hw/fw_cfg.c b/hw/fw_cfg.c
index 699383c..3b31d77 100644
--- a/hw/fw_cfg.c
+++ b/hw/fw_cfg.c
@@ -471,7 +471,7 @@ void fw_cfg_add_file(FWCfgState *s, const char *filename,
static void fw_cfg_machine_ready(struct Notifier *n, void *data)
{
- uint32_t len;
+ size_t len;
FWCfgState *s = container_of(n, FWCfgState, machine_ready);
char *bootindex = get_boot_devices_list(&len);
diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
index c07d4ee..6047ef3 100644
--- a/include/sysemu/sysemu.h
+++ b/include/sysemu/sysemu.h
@@ -179,7 +179,7 @@ void register_devices(void);
void add_boot_device_path(int32_t bootindex, DeviceState *dev,
const char *suffix);
-char *get_boot_devices_list(uint32_t *size);
+char *get_boot_devices_list(size_t *size);
bool usb_enabled(bool default_usb);
diff --git a/vl.c b/vl.c
index 15e0280..395c85b 100644
--- a/vl.c
+++ b/vl.c
@@ -1198,15 +1198,15 @@ void add_boot_device_path(int32_t bootindex,
DeviceState *dev,
* memory pointed by "size" is assigned total length of the array in bytes
*
*/
-char *get_boot_devices_list(uint32_t *size)
+char *get_boot_devices_list(size_t *size)
{
FWBootEntry *i;
- uint32_t total = 0;
+ size_t total = 0;
char *list = NULL;
QTAILQ_FOREACH(i, &fw_boot_order, link) {
char *devpath = NULL, *bootpath;
- int len;
+ size_t len;
if (i->dev) {
devpath = qdev_get_fw_dev_path(i->dev);
--
1.7.11.7
- [Qemu-devel] [PATCH 3/8] fw_cfg: New fw_cfg_add_string(), (continued)
- [Qemu-devel] [PATCH 3/8] fw_cfg: New fw_cfg_add_string(), Markus Armbruster, 2013/01/16
- [Qemu-devel] [PATCH 4/8] pc: Fix unchecked strdup() by switching to fw_cfg_add_string(), Markus Armbruster, 2013/01/16
- [Qemu-devel] [PATCH 7/8] fw_cfg: Use void *, size_t instead of uint8_t *, uint32_t for blobs, Markus Armbruster, 2013/01/16
- [Qemu-devel] [PATCH 1/8] fw_cfg: Replace debug prints by tracepoints, Markus Armbruster, 2013/01/16
[Qemu-devel] [PATCH 8/8] vl: Use size_t for sizes in get_boot_devices_list(),
Markus Armbruster <=
[Qemu-devel] [PATCH 2/8] fw_cfg: Dumb down fw_cfg_add_*() not to return success / failure, Markus Armbruster, 2013/01/16
[Qemu-devel] [PATCH 5/8] sun4: Fix unchecked strdup() by switching to fw_cfg_add_string(), Markus Armbruster, 2013/01/16
[Qemu-devel] [PATCH 6/8] pc: Clean up bochs_bios_init()'s (non-)use of sizeof, Markus Armbruster, 2013/01/16
Re: [Qemu-devel] [PATCH 0/8] Fixes and cleanups around fw_cfg, Gleb Natapov, 2013/01/17