monitor: reuse user_creatable_add_opts() instead of user_creatable_add()

Simplify code by dropping ~57LOC by merging user_creatable_add()
into user_creatable_add_opts() and using the later from monitor.
Along with it allocate opts_visitor_new() once in user_creatable_add_opts().

As result we have one less API func and a more readable/simple
user_creatable_add_opts() vs user_creatable_add().

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <1484052795-158195-3-git-send-email-imammedo@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
This commit is contained in:
Igor Mammedov 2017-01-10 13:53:14 +01:00 committed by Eduardo Habkost
parent 8a000250f1
commit 3a4641054e
3 changed files with 19 additions and 76 deletions

View file

@ -75,23 +75,6 @@ void user_creatable_complete(Object *obj, Error **errp);
*/
bool user_creatable_can_be_deleted(UserCreatable *uc, Error **errp);
/**
* user_creatable_add:
* @qdict: the object definition
* @v: the visitor
* @errp: if an error occurs, a pointer to an area to store the error
*
* Create an instance of the user creatable object whose type
* is defined in @qdict by the 'qom-type' field, placing it
* in the object composition tree with name provided by the
* 'id' field. The remaining fields in @qdict are used to
* initialize the object properties.
*
* Returns: the newly created object or NULL on error
*/
Object *user_creatable_add(const QDict *qdict,
Visitor *v, Error **errp);
/**
* user_creatable_add_type:
* @type: the object type name