[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 040/115] qom: remove index from object_resolve_abs_path()
From: |
Paolo Bonzini |
Subject: |
[PULL 040/115] qom: remove index from object_resolve_abs_path() |
Date: |
Thu, 11 Jun 2020 15:43:34 -0400 |
From: Masahiro Yamada <masahiroy@kernel.org>
You can advance 'parts' to track the current path fragment.
The 'index' parameter is unneeded.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Message-Id: <20200510013235.954906-1-masahiroy@kernel.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
qom/object.c | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/qom/object.c b/qom/object.c
index 484465f1c8..ea16680051 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -1956,26 +1956,25 @@ Object *object_resolve_path_component(Object *parent,
const char *part)
}
static Object *object_resolve_abs_path(Object *parent,
- char **parts,
- const char *typename,
- int index)
+ char **parts,
+ const char *typename)
{
Object *child;
- if (parts[index] == NULL) {
+ if (*parts == NULL) {
return object_dynamic_cast(parent, typename);
}
- if (strcmp(parts[index], "") == 0) {
- return object_resolve_abs_path(parent, parts, typename, index + 1);
+ if (strcmp(*parts, "") == 0) {
+ return object_resolve_abs_path(parent, parts + 1, typename);
}
- child = object_resolve_path_component(parent, parts[index]);
+ child = object_resolve_path_component(parent, *parts);
if (!child) {
return NULL;
}
- return object_resolve_abs_path(child, parts, typename, index + 1);
+ return object_resolve_abs_path(child, parts + 1, typename);
}
static Object *object_resolve_partial_path(Object *parent,
@@ -1987,7 +1986,7 @@ static Object *object_resolve_partial_path(Object *parent,
GHashTableIter iter;
ObjectProperty *prop;
- obj = object_resolve_abs_path(parent, parts, typename, 0);
+ obj = object_resolve_abs_path(parent, parts, typename);
g_hash_table_iter_init(&iter, parent->properties);
while (g_hash_table_iter_next(&iter, NULL, (gpointer *)&prop)) {
@@ -2032,7 +2031,7 @@ Object *object_resolve_path_type(const char *path, const
char *typename,
*ambiguousp = ambiguous;
}
} else {
- obj = object_resolve_abs_path(object_get_root(), parts, typename, 1);
+ obj = object_resolve_abs_path(object_get_root(), parts + 1, typename);
}
g_strfreev(parts);
--
2.26.2
- [PULL 030/115] hw/i386/vmport: Report vmware-vmx-type in CMD_GETVERSION, (continued)
- [PULL 030/115] hw/i386/vmport: Report vmware-vmx-type in CMD_GETVERSION, Paolo Bonzini, 2020/06/11
- [PULL 064/115] target/i386: fix fisttpl, fisttpll handling of out-of-range values, Paolo Bonzini, 2020/06/11
- [PULL 024/115] target/i386: fix phadd* with identical destination and source register, Paolo Bonzini, 2020/06/11
- [PULL 048/115] megasas: use unsigned type for reply_queue_head and check index, Paolo Bonzini, 2020/06/11
- [PULL 060/115] target/i386: fix floating-point load-constant rounding, Paolo Bonzini, 2020/06/11
- [PULL 019/115] vmbus: vmbus implementation, Paolo Bonzini, 2020/06/11
- [PULL 022/115] vmbus: add infrastructure to save/load vmbus requests, Paolo Bonzini, 2020/06/11
- [PULL 057/115] exec: Propagate cpu_memory_rw_debug() error, Paolo Bonzini, 2020/06/11
- [PULL 031/115] hw/i386/vmport: Introduce vmport.h, Paolo Bonzini, 2020/06/11
- [PULL 047/115] i386/kvm: fix a use-after-free when vcpu plug/unplug, Paolo Bonzini, 2020/06/11
- [PULL 040/115] qom: remove index from object_resolve_abs_path(),
Paolo Bonzini <=
- [PULL 070/115] chardev/char-socket: Properly make qio connections non blocking, Paolo Bonzini, 2020/06/11
- [PULL 072/115] hw/i386/amd_iommu: Fix the reserved bits definition of IOMMU commands, Paolo Bonzini, 2020/06/11
- [PULL 068/115] KVM: Pass EventNotifier into kvm_irqchip_assign_irqfd, Paolo Bonzini, 2020/06/11
- [PULL 076/115] util/oslib: Returns the real thread identifier on FreeBSD and NetBSD, Paolo Bonzini, 2020/06/11
- [PULL 079/115] configure: Do not ignore malloc value, Paolo Bonzini, 2020/06/11
- [PULL 075/115] target/i386: define a new MSR based feature word - FEAT_PERF_CAPABILITIES, Paolo Bonzini, 2020/06/11
- [PULL 074/115] i386: Remove unused define's from hax and hvf, Paolo Bonzini, 2020/06/11
- [PULL 077/115] memory: Make 'info mtree' not display disabled regions by default, Paolo Bonzini, 2020/06/11
- [PULL 078/115] qemu/thread: Mark qemu_thread_exit() with 'noreturn' attribute, Paolo Bonzini, 2020/06/11
- [PULL 071/115] tests: machine-none-test: Enable MicroBlaze testing, Paolo Bonzini, 2020/06/11