mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-01-08 22:15:28 +00:00
qmp-output-visitor: Favor new visit_free() function
Now that we have a polymorphic visit_free(), we no longer need qmp_output_visitor_cleanup(); however, we still need to expose the subtype for qmp_output_get_qobject(). Backports commit 1830f22a6777cedaccd67a08f675d30f7a85ebfd from qemu
This commit is contained in:
parent
f008d93ac0
commit
ec53301cda
|
@ -20,7 +20,6 @@
|
|||
typedef struct QmpOutputVisitor QmpOutputVisitor;
|
||||
|
||||
QmpOutputVisitor *qmp_output_visitor_new(void);
|
||||
void qmp_output_visitor_cleanup(QmpOutputVisitor *v);
|
||||
|
||||
QObject *qmp_output_get_qobject(QmpOutputVisitor *v);
|
||||
Visitor *qmp_output_get_visitor(QmpOutputVisitor *v);
|
||||
|
|
|
@ -218,21 +218,15 @@ Visitor *qmp_output_get_visitor(QmpOutputVisitor *v)
|
|||
static void qmp_output_free(Visitor *v)
|
||||
{
|
||||
QmpOutputVisitor *qov = to_qov(v);
|
||||
|
||||
qmp_output_visitor_cleanup(qov);
|
||||
}
|
||||
|
||||
void qmp_output_visitor_cleanup(QmpOutputVisitor *v)
|
||||
{
|
||||
QStackEntry *e, *tmp;
|
||||
|
||||
QTAILQ_FOREACH_SAFE(e, &v->stack, node, tmp) {
|
||||
QTAILQ_REMOVE(&v->stack, e, node);
|
||||
QTAILQ_FOREACH_SAFE(e, &qov->stack, node, tmp) {
|
||||
QTAILQ_REMOVE(&qov->stack, e, node);
|
||||
g_free(e);
|
||||
}
|
||||
|
||||
qobject_decref(v->root);
|
||||
g_free(v);
|
||||
qobject_decref(qov->root);
|
||||
g_free(qov);
|
||||
}
|
||||
|
||||
QmpOutputVisitor *qmp_output_visitor_new(void)
|
||||
|
|
|
@ -41,6 +41,6 @@ QObject *object_property_get_qobject(struct uc_struct *uc, Object *obj, const ch
|
|||
ret = qmp_output_get_qobject(qov);
|
||||
}
|
||||
error_propagate(errp, local_err);
|
||||
qmp_output_visitor_cleanup(qov);
|
||||
visit_free(qmp_output_get_visitor(qov));
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue