Skip to content

Commit 05601ed

Browse files
author
Markus Armbruster
committed
qom: Make object_property_set_qobject()'s input visitor strict
Commit 240f64b made all qobject input visitors created outside tests strict, except for the one in object_property_set_qobject(). That one was left behind only because Eric couldn't spare the time to figure out whether making it strict would break anything, with a TODO comment. Time to resolve it. Strict makes a difference only for otherwise successful visits of QAPI structs or unions. Let's examine what the callers of object_property_set_qobject() visit: * object_property_set_str(), object_property_set_bool(), object_property_set_int() visit a QString, QBool, QInt, respectively. Strictness can't matter. * qmp_qom_set visits its @value argument. Comes straight from QMP and can be anything ('any' in the QAPI schema). Strictness matters when the property's set() method visits a struct or union QAPI type. No such methods exist, thus switching to strict can't break anything. If we acquire such methods in the future, we'll *want* the visitor to be strict, so that unexpected members get rejected as they should be. Switch to strict. Signed-off-by: Markus Armbruster <[email protected]> Reviewed-by: Eric Blake <[email protected]> Message-Id: <[email protected]>
1 parent f332e83 commit 05601ed

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

qom/qom-qobject.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ void object_property_set_qobject(Object *obj, QObject *value,
2222
const char *name, Error **errp)
2323
{
2424
Visitor *v;
25-
/* TODO: Should we reject, rather than ignore, excess input? */
26-
v = qobject_input_visitor_new(value, false);
25+
26+
v = qobject_input_visitor_new(value, true);
2727
object_property_set(obj, v, name, errp);
2828
visit_free(v);
2929
}

0 commit comments

Comments
 (0)