diff mbox series

[v3,43/53] qdev: Move static_prop_release_dynamic_prop() closer to its usage

Message ID 20201112214350.872250-44-ehabkost@redhat.com (mailing list archive)
State New, archived
Headers show
Series Make qdev static property API usable by any QOM type | expand

Commit Message

Eduardo Habkost Nov. 12, 2020, 9:43 p.m. UTC
Move the function closer to where it's used, to make refactor
and review simpler.  While doing it, reformat the comment at the
top to follow coding style.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
This is a new patch added in v3 of the series.
---
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: "Daniel P. Berrangé" <berrange@redhat.com>
Cc: Eduardo Habkost <ehabkost@redhat.com>
Cc: qemu-devel@nongnu.org
---
 hw/core/qdev-properties.c | 29 +++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)
diff mbox series

Patch

diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
index 83fd45add0..7aa5d2ff45 100644
--- a/hw/core/qdev-properties.c
+++ b/hw/core/qdev-properties.c
@@ -521,20 +521,6 @@  const PropertyInfo prop_info_size32 = {
 
 /* --- support for array properties --- */
 
-/* object property release callback for dynamically-created properties:
- * we call the underlying element's property release hook, and
- * then free the memory we allocated when we added the property.
- */
-static void static_prop_release_dynamic_prop(Object *obj, const char *name,
-                                             void *opaque)
-{
-    Property *prop = opaque;
-    if (prop->info->release) {
-        prop->info->release(obj, name, opaque);
-    }
-    g_free(prop);
-}
-
 static void set_prop_arraylen(Object *obj, Visitor *v, const char *name,
                               void *opaque, Error **errp)
 {
@@ -816,6 +802,21 @@  const PropertyInfo prop_info_link = {
     .create = create_link_property,
 };
 
+/*
+ * Property release callback for dynamically-created properties:
+ * We call the underlying element's property release hook, and
+ * then free the memory we allocated when we added the property.
+ */
+static void static_prop_release_dynamic_prop(Object *obj, const char *name,
+                                             void *opaque)
+{
+    Property *prop = opaque;
+    if (prop->info->release) {
+        prop->info->release(obj, name, opaque);
+    }
+    g_free(prop);
+}
+
 ObjectProperty *
 object_property_add_field(Object *obj, const char *name,
                           Property *prop,