@samitouri / QOSamiQemu / commits / 23f3d3d3bb

qom: make errp last param in methods taking va_list

object_new_with_props can't put 'errp' last due to the use of variadic arguments. That constraint does not apply to the use of va_list with object_new_with_propv, so follow normal practice with 'errp' placement. The same rationale applies to object_set_propv. Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>

Daniel P. Berrangé committed Apr 17, 2026 at 15:41 UTC 23f3d3d3bbda19a44cdc4506963d02179a411a49
3 files changed +17 -17
include/qom/object.h
+5 -5
@@ -689,16 +689,16 @@ Object *object_new_with_props(const char *typename,
689 * @typename: The name of the type of the object to instantiate.
690 * @parent: the parent object
691 * @id: The unique ID of the object
692 - * @errp: pointer to error object
692 * @vargs: list of property names and values
693 + * @errp: pointer to error object
694 *
695 * See object_new_with_props() for documentation.
696 */
697 Object *object_new_with_propv(const char *typename,
698 Object *parent,
699 const char *id,
700 - Error **errp,
701 - va_list vargs);
700 + va_list vargs,
701 + Error **errp);
702
703 /**
704 * object_set_props:
@@ -739,14 +739,14 @@ bool object_set_props(Object *obj, Error **errp, ...) G_GNUC_NULL_TERMINATED;
739 /**
740 * object_set_propv:
741 * @obj: the object instance to set properties on
742 - * @errp: pointer to error object
742 * @vargs: list of property names and values
743 + * @errp: pointer to error object
744 *
745 * See object_set_props() for documentation.
746 *
747 * Returns: %true on success, %false on error.
748 */
749 -bool object_set_propv(Object *obj, Error **errp, va_list vargs);
749 +bool object_set_propv(Object *obj, va_list vargs, Error **errp);
750
751 /**
752 * object_initialize:
qom/object.c
+10 -10
@@ -541,7 +541,7 @@ bool object_initialize_child_with_propsv(Object *parentobj,
541 object_initialize(childobj, size, type);
542 obj = OBJECT(childobj);
543
544 - if (!object_set_propv(obj, errp, vargs)) {
544 + if (!object_set_propv(obj, vargs, errp)) {
545 goto out;
546 }
547
@@ -740,7 +740,7 @@ Object *object_new_with_props(const char *typename,
740 Object *obj;
741
742 va_start(vargs, errp);
743 - obj = object_new_with_propv(typename, parent, id, errp, vargs);
743 + obj = object_new_with_propv(typename, parent, id, vargs, errp);
744 va_end(vargs);
745
746 return obj;
@@ -750,8 +750,8 @@ Object *object_new_with_props(const char *typename,
750 Object *object_new_with_propv(const char *typename,
751 Object *parent,
752 const char *id,
753 - Error **errp,
754 - va_list vargs)
753 + va_list vargs,
754 + Error **errp)
755 {
756 Object *obj;
757 ObjectClass *klass;
@@ -776,7 +776,7 @@ Object *object_new_with_propv(const char *typename,
776 }
777 obj = object_new_with_type(klass->type);
778
779 - if (!object_set_propv(obj, errp, vargs)) {
779 + if (!object_set_propv(obj, vargs, errp)) {
780 goto error;
781 }
782
@@ -804,14 +804,14 @@ Object *object_new_with_propv(const char *typename,
804
805
806 bool object_set_props(Object *obj,
807 - Error **errp,
808 - ...)
807 + Error **errp,
808 + ...)
809 {
810 va_list vargs;
811 bool ret;
812
813 va_start(vargs, errp);
814 - ret = object_set_propv(obj, errp, vargs);
814 + ret = object_set_propv(obj, vargs, errp);
815 va_end(vargs);
816
817 return ret;
@@ -819,8 +819,8 @@ bool object_set_props(Object *obj,
819
820
821 bool object_set_propv(Object *obj,
822 - Error **errp,
823 - va_list vargs)
822 + va_list vargs,
823 + Error **errp)
824 {
825 const char *propname;
826
tests/unit/check-qom-proplist.c
+2 -2
@@ -373,8 +373,8 @@ static Object *new_helper(Error **errp,
373 obj = object_new_with_propv(TYPE_DUMMY,
374 parent,
375 "dummy0",
376 - errp,
377 - vargs);
376 + vargs,
377 + errp);
378 va_end(vargs);
379 return obj;
380 }