Patchwork [1.3,5/5] qom: make object_finalize static

login
register
mail settings
Submitter Paolo Bonzini
Date Nov. 23, 2012, 8:47 a.m.
Message ID <1353660436-8897-6-git-send-email-pbonzini@redhat.com>
Download mbox | patch
Permalink /patch/201265/
State New
Headers show

Comments

Paolo Bonzini - Nov. 23, 2012, 8:47 a.m.
It is not used anymore, and there is no need to make it public.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 include/qemu/object.h | 9 ---------
 qom/object.c          | 2 +-
 2 files changed, 1 insertion(+), 10 deletions(-)
Andreas Färber - Nov. 23, 2012, 5:12 p.m.
Am 23.11.2012 09:47, schrieb Paolo Bonzini:
> It is not used anymore, and there is no need to make it public.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

We have not yet started using the in-place mechanism much (i440fx and
prep_pci patches, not in master; also my tegra branch), so I would like
to keep this for symmetry with "initialize" vs. "new" and their
distinguished semantics. It is not a bugfix anyway, so not needed for 1.3.

Andreas
Paolo Bonzini - Nov. 23, 2012, 5:32 p.m.
Il 23/11/2012 18:12, Andreas Färber ha scritto:
> We have not yet started using the in-place mechanism much (i440fx and
> prep_pci patches, not in master; also my tegra branch), so I would like
> to keep this for symmetry with "initialize" vs. "new" and their
> distinguished semantics.

But you do not need it anymore.  When the last reference disappears,
everything is finalized.  So you just use ref/unref.  Delete is simply
unparent+unref, and applies just as well to objects that were
initialized in place.

The point of patch 3 is to get rid of the distinction between initialize
and new.  That distinction just shouldn't be there if you have reference
counting.

> It is not a bugfix anyway, so not needed for 1.3.

Fair enough.

Paolo

Patch

diff --git a/include/qemu/object.h b/include/qemu/object.h
index 5ddcb4a..ed1f47f 100644
--- a/include/qemu/object.h
+++ b/include/qemu/object.h
@@ -505,15 +505,6 @@  void object_initialize_with_type(void *data, Type type);
 void object_initialize(void *obj, const char *typename);
 
 /**
- * object_finalize:
- * @obj: The object to finalize.
- *
- * This function destroys and object without freeing the memory associated with
- * it.
- */
-void object_finalize(void *obj);
-
-/**
  * object_dynamic_cast:
  * @obj: The object to cast.
  * @typename: The @typename to cast to.
diff --git a/qom/object.c b/qom/object.c
index f3e9517..70354fc 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -379,7 +379,7 @@  static void object_deinit(Object *obj, TypeImpl *type)
     }
 }
 
-void object_finalize(void *data)
+static void object_finalize(void *data)
 {
     Object *obj = data;
     TypeImpl *ti = obj->class->type;