void object_add(const char *type, const char *id, const QDict *qdict,

                Visitor *v, Error **errp)

{

    Object *obj;

    const QDictEntry *e;

    Error *local_err = NULL;



    if (!object_class_by_name(type)) {

        error_setg(errp, "invalid class name");

        return;

    }



    obj = object_new(type);

    if (qdict) {

        for (e = qdict_first(qdict); e; e = qdict_next(qdict, e)) {

            object_property_set(obj, v, e->key, &local_err);

            if (local_err) {

                goto out;

            }

        }

    }



    if (!object_dynamic_cast(obj, TYPE_USER_CREATABLE)) {

        error_setg(&local_err, "object type '%s' isn't supported by object-add",

                   type);

        goto out;

    }



    user_creatable_complete(obj, &local_err);

    if (local_err) {

        goto out;

    }



    object_property_add_child(container_get(object_get_root(), "/objects"),

                              id, obj, &local_err);

out:

    if (local_err) {

        error_propagate(errp, local_err);

    }

    object_unref(obj);

}

void object_add(const char *type, const char *id, const QDict *qdict,

                Visitor *v, Error **errp)

{

    Object *obj;

    const QDictEntry *e;

    Error *local_err = NULL;



    if (!object_class_by_name(type)) {

        error_setg(errp, "invalid class name");

        return;

    }



    obj = object_new(type);

    if (qdict) {

        for (e = qdict_first(qdict); e; e = qdict_next(qdict, e)) {

            object_property_set(obj, v, e->key, &local_err);

            if (local_err) {

                goto out;

            }

        }

    }



    if (!object_dynamic_cast(obj, TYPE_USER_CREATABLE)) {

        error_setg(&local_err, "object type '%s' isn't supported by object-add",

                   type);

        goto out;

    }



    user_creatable_complete(obj, &local_err);

    if (local_err) {

        goto out;

    }



    object_property_add_child(container_get(object_get_root(), "/objects"),

                              id, obj, &local_err);

out:

    if (local_err) {

        error_propagate(errp, local_err);

    }

    object_unref(obj);

}

    if (!object_class_by_name(type)) {     if (!object_dynamic_cast(obj, TYPE_USER_CREATABLE)) {         error_setg(&local_err, "object type '%s' isn't supported by object-add",                    type);         goto out;
void FUNC_0(const char *VAR_0, const char *VAR_1, const QDict *VAR_2,

                Visitor *VAR_3, Error **VAR_4)

{

    Object *obj;

    const QDictEntry *VAR_5;

    Error *local_err = NULL;



    if (!object_class_by_name(VAR_0)) {

        error_setg(VAR_4, "invalid class name");

        return;

    }



    obj = object_new(VAR_0);

    if (VAR_2) {

        for (VAR_5 = qdict_first(VAR_2); VAR_5; VAR_5 = qdict_next(VAR_2, VAR_5)) {

            object_property_set(obj, VAR_3, VAR_5->key, &local_err);

            if (local_err) {

                goto out;

            }

        }

    }



    if (!object_dynamic_cast(obj, TYPE_USER_CREATABLE)) {

        error_setg(&local_err, "object VAR_0 '%s' isn't supported by object-add",

                   VAR_0);

        goto out;

    }



    user_creatable_complete(obj, &local_err);

    if (local_err) {

        goto out;

    }



    object_property_add_child(container_get(object_get_root(), "/objects"),

                              VAR_1, obj, &local_err);

out:

    if (local_err) {

        error_propagate(VAR_4, local_err);

    }

    object_unref(obj);

}

void FUNC_0(const char *VAR_0, const char *VAR_1, const QDict *VAR_2,
Visitor *VAR_3, Error **VAR_4)
{ Object *obj; const QDictEntry *VAR_5; Error *local_err = NULL; if (!object_class_by_name(VAR_0)) { error_setg(VAR_4, "invalid class name"); return; } obj = object_new(VAR_0); if (VAR_2) { for (VAR_5 = qdict_first(VAR_2); VAR_5; VAR_5 = qdict_next(VAR_2, VAR_5)) { object_property_set(obj, VAR_3, VAR_5->key, &local_err); if (local_err) { goto out; } } } if (!object_dynamic_cast(obj, TYPE_USER_CREATABLE)) { error_setg(&local_err, "object VAR_0 '%s' isn't supported by object-add",
VAR_0); goto out; } user_creatable_complete(obj, &local_err); if (local_err) { goto out; } object_property_add_child(container_get(object_get_root(), "/objects"),
VAR_1, obj, &local_err); out:
if (local_err) { error_propagate(VAR_4, local_err); } object_unref(obj); }