Re: [Qemu-devel] [PATCH v3 12/12] qom: remove object_delete
Am 25.01.2013 12:47, schrieb Paolo Bonzini: This is now unused. Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- include/qom/object.h | 17 ++--- qom/object.c | 7 --- 2 files changed, 2 insertions(+), 22 deletions(-) diff --git a/include/qom/object.h b/include/qom/object.h index 5e8e528..2ac35a5 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -553,9 +553,7 @@ struct InterfaceClass * object_new: * @typename: The name of the type of the object to instantiate. * - * This function will initialize a new object using heap allocated memory. This - * function should be paired with object_delete() to free the resources - * associated with the object. + * This function will initialize a new object using heap allocated memory. * * Returns: The newly allocated and instantiated object. */ [snip] Why not just update object_delete() - object_unref() within the documentation comment? At least somewhere we should prominently document how these functions are to be used together. Could be done in a follow-up of course. Andreas -- SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Re: [Qemu-devel] [PATCH v3 12/12] qom: remove object_delete
Il 25/01/2013 12:56, Andreas Färber ha scritto: - * This function will initialize a new object using heap allocated memory. This - * function should be paired with object_delete() to free the resources - * associated with the object. + * This function will initialize a new object using heap allocated memory. * * Returns: The newly allocated and instantiated object. */ [snip] Why not just update object_delete() - object_unref() within the documentation comment? At least somewhere we should prominently document how these functions are to be used together. I can include in the comment that the returned object has 1 reference. Paolo
[Qemu-devel] [PATCH v3 12/12] qom: remove object_delete
This is now unused. Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- include/qom/object.h | 17 ++--- qom/object.c | 7 --- 2 files changed, 2 insertions(+), 22 deletions(-) diff --git a/include/qom/object.h b/include/qom/object.h index 5e8e528..2ac35a5 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -553,9 +553,7 @@ struct InterfaceClass * object_new: * @typename: The name of the type of the object to instantiate. * - * This function will initialize a new object using heap allocated memory. This - * function should be paired with object_delete() to free the resources - * associated with the object. + * This function will initialize a new object using heap allocated memory. * * Returns: The newly allocated and instantiated object. */ @@ -565,24 +563,13 @@ Object *object_new(const char *typename); * object_new_with_type: * @type: The type of the object to instantiate. * - * This function will initialize a new object using heap allocated memory. This - * function should be paired with object_delete() to free the resources - * associated with the object. + * This function will initialize a new object using heap allocated memory. * * Returns: The newly allocated and instantiated object. */ Object *object_new_with_type(Type type); /** - * object_delete: - * @obj: The object to free. - * - * Finalize an object and then free the memory associated with it. This should - * be paired with object_new() to free the resources associated with an object. - */ -void object_delete(Object *obj); - -/** * object_initialize_with_type: * @obj: A pointer to the memory to be used for the object. * @type: The type of the object to instantiate. diff --git a/qom/object.c b/qom/object.c index 1a123da..aa89e21 100644 --- a/qom/object.c +++ b/qom/object.c @@ -417,13 +417,6 @@ Object *object_new(const char *typename) return object_new_with_type(ti); } -void object_delete(Object *obj) -{ -object_unparent(obj); -g_assert(obj-ref == 1); -object_unref(obj); -} - Object *object_dynamic_cast(Object *obj, const char *typename) { if (obj object_class_dynamic_cast(object_get_class(obj), typename)) { -- 1.8.1