Re: [PATCH 1/2] qom: Clean up object_property_get_enum()'s error value

2020-09-17 Thread Greg Kurz
On Thu, 17 Sep 2020 14:55:39 +0200 Markus Armbruster wrote: > object_property_get_enum() is the only object_property_FOO() that is > documented to return an undefined value on error. It does no such > thing, actually: it returns 0 on some errors, and -1 on others. > > Needlessly complicated. A

Re: [PATCH 1/2] qom: Clean up object_property_get_enum()'s error value

2020-09-17 Thread Daniel P . Berrangé
On Thu, Sep 17, 2020 at 02:55:39PM +0200, Markus Armbruster wrote: > object_property_get_enum() is the only object_property_FOO() that is > documented to return an undefined value on error. It does no such > thing, actually: it returns 0 on some errors, and -1 on others. > > Needlessly complicate

[PATCH 1/2] qom: Clean up object_property_get_enum()'s error value

2020-09-17 Thread Markus Armbruster
object_property_get_enum() is the only object_property_FOO() that is documented to return an undefined value on error. It does no such thing, actually: it returns 0 on some errors, and -1 on others. Needlessly complicated. Always return -1 on error, and adjust the contract. Signed-off-by: Marku