[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-stable] [PATCH 29/67] qht: simplify qht_reset_size
From: |
Michael Roth |
Subject: |
[Qemu-stable] [PATCH 29/67] qht: simplify qht_reset_size |
Date: |
Wed, 14 Dec 2016 18:44:23 -0600 |
From: "Emilio G. Cota" <address@hidden>
Sometimes gcc doesn't pick up the fact that 'new' is properly
set if 'resize == true', which may generate an unnecessary
build warning.
Fix it by removing 'resize' and directly checking that 'new'
is non-NULL.
Signed-off-by: Emilio G. Cota <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
(cherry picked from commit f555a9d0b3c785b698f32e6879e97d0a4b387314)
Signed-off-by: Michael Roth <address@hidden>
---
util/qht.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/util/qht.c b/util/qht.c
index 16a8d79..af8da3c 100644
--- a/util/qht.c
+++ b/util/qht.c
@@ -410,10 +410,9 @@ void qht_reset(struct qht *ht)
bool qht_reset_size(struct qht *ht, size_t n_elems)
{
- struct qht_map *new;
+ struct qht_map *new = NULL;
struct qht_map *map;
size_t n_buckets;
- bool resize = false;
n_buckets = qht_elems_to_buckets(n_elems);
@@ -421,18 +420,17 @@ bool qht_reset_size(struct qht *ht, size_t n_elems)
map = ht->map;
if (n_buckets != map->n_buckets) {
new = qht_map_create(n_buckets);
- resize = true;
}
qht_map_lock_buckets(map);
qht_map_reset__all_locked(map);
- if (resize) {
+ if (new) {
qht_do_resize(ht, new);
}
qht_map_unlock_buckets(map);
qemu_mutex_unlock(&ht->lock);
- return resize;
+ return !!new;
}
static inline
--
1.9.1
- [Qemu-stable] [PATCH 01/67] linux-headers: update, (continued)
- [Qemu-stable] [PATCH 01/67] linux-headers: update, Michael Roth, 2016/12/14
- [Qemu-stable] [PATCH 21/67] s390x/css: handle cssid 255 correctly, Michael Roth, 2016/12/14
- [Qemu-stable] [PATCH 23/67] qcow2: fix encryption during cow of sectors, Michael Roth, 2016/12/14
- [Qemu-stable] [PATCH 22/67] vfio/pci: Fix regression in MSI routing configuration, Michael Roth, 2016/12/14
- [Qemu-stable] [PATCH 25/67] block: reintroduce bdrv_flush_all, Michael Roth, 2016/12/14
- [Qemu-stable] [PATCH 24/67] iscsi: Fix divide-by-zero regression on raw SG devices, Michael Roth, 2016/12/14
- [Qemu-stable] [PATCH 26/67] qemu: use bdrv_flush_all for vm_stop et al, Michael Roth, 2016/12/14
- [Qemu-stable] [PATCH 27/67] block-backend: remove blk_flush_all, Michael Roth, 2016/12/14
- [Qemu-stable] [PATCH 02/67] hw/ppc/spapr: Move code related to "ibm, pa-features" to a separate function, Michael Roth, 2016/12/14
- [Qemu-stable] [PATCH 30/67] qht: fix unlock-after-free segfault upon resizing, Michael Roth, 2016/12/14
- [Qemu-stable] [PATCH 29/67] qht: simplify qht_reset_size,
Michael Roth <=
- [Qemu-stable] [PATCH 33/67] qapi: Fix crash when 'any' or 'null' parameter is missing, Michael Roth, 2016/12/14
- [Qemu-stable] [PATCH 31/67] char: fix missing return in error path for chardev TLS init, Michael Roth, 2016/12/14
- [Qemu-stable] [PATCH 35/67] rbd: shift byte count as a 64-bit value, Michael Roth, 2016/12/14
- [Qemu-stable] [PATCH 34/67] tests/test-qmp-input-strict: Cover missing struct members, Michael Roth, 2016/12/14
- [Qemu-stable] [PATCH 37/67] throttle: Correct access to wrong BlockBackendPublic structures, Michael Roth, 2016/12/14
- [Qemu-stable] [PATCH 28/67] migrate: Fix cpu-throttle-increment regression in HMP, Michael Roth, 2016/12/14
- [Qemu-stable] [PATCH 32/67] qmp: fix object-add assert() without props, Michael Roth, 2016/12/14
- [Qemu-stable] [PATCH 36/67] ppc/kvm: Mark 64kB page size support as disabled if not available, Michael Roth, 2016/12/14
- [Qemu-stable] [PATCH 39/67] net: rtl8139: limit processing of ring descriptors, Michael Roth, 2016/12/14
- [Qemu-stable] [PATCH 41/67] memory: Don't use memcpy for ram_device regions, Michael Roth, 2016/12/14