[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 006/113] qom: eliminate identical functions
From: |
Paolo Bonzini |
Subject: |
[PULL 006/113] qom: eliminate identical functions |
Date: |
Wed, 2 Dec 2020 03:07:02 -0500 |
Most property release functions in qom/object.c only free the opaque
value. Combine all of them into a single function.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
qom/object.c | 36 +++++++-----------------------------
1 file changed, 7 insertions(+), 29 deletions(-)
diff --git a/qom/object.c b/qom/object.c
index 1065355233..75a78c9343 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -2174,11 +2174,10 @@ static void property_set_str(Object *obj, Visitor *v,
const char *name,
g_free(value);
}
-static void property_release_str(Object *obj, const char *name,
- void *opaque)
+static void property_release_data(Object *obj, const char *name,
+ void *opaque)
{
- StringProperty *prop = opaque;
- g_free(prop);
+ g_free(opaque);
}
ObjectProperty *
@@ -2194,7 +2193,7 @@ object_property_add_str(Object *obj, const char *name,
return object_property_add(obj, name, "string",
get ? property_get_str : NULL,
set ? property_set_str : NULL,
- property_release_str,
+ property_release_data,
prop);
}
@@ -2251,13 +2250,6 @@ static void property_set_bool(Object *obj, Visitor *v,
const char *name,
prop->set(obj, value, errp);
}
-static void property_release_bool(Object *obj, const char *name,
- void *opaque)
-{
- BoolProperty *prop = opaque;
- g_free(prop);
-}
-
ObjectProperty *
object_property_add_bool(Object *obj, const char *name,
bool (*get)(Object *, Error **),
@@ -2271,7 +2263,7 @@ object_property_add_bool(Object *obj, const char *name,
return object_property_add(obj, name, "bool",
get ? property_get_bool : NULL,
set ? property_set_bool : NULL,
- property_release_bool,
+ property_release_data,
prop);
}
@@ -2320,13 +2312,6 @@ static void property_set_enum(Object *obj, Visitor *v,
const char *name,
prop->set(obj, value, errp);
}
-static void property_release_enum(Object *obj, const char *name,
- void *opaque)
-{
- EnumProperty *prop = opaque;
- g_free(prop);
-}
-
ObjectProperty *
object_property_add_enum(Object *obj, const char *name,
const char *typename,
@@ -2343,7 +2328,7 @@ object_property_add_enum(Object *obj, const char *name,
return object_property_add(obj, name, typename,
get ? property_get_enum : NULL,
set ? property_set_enum : NULL,
- property_release_enum,
+ property_release_data,
prop);
}
@@ -2410,13 +2395,6 @@ out_end:
visit_end_struct(v, NULL);
}
-static void property_release_tm(Object *obj, const char *name,
- void *opaque)
-{
- TMProperty *prop = opaque;
- g_free(prop);
-}
-
ObjectProperty *
object_property_add_tm(Object *obj, const char *name,
void (*get)(Object *, struct tm *, Error **))
@@ -2427,7 +2405,7 @@ object_property_add_tm(Object *obj, const char *name,
return object_property_add(obj, name, "struct tm",
get ? property_get_tm : NULL, NULL,
- property_release_tm,
+ property_release_data,
prop);
}
--
2.26.2
- [PULL 003/113] target/i386: seg_helper: Correct segement selector nullification in the RET/IRET helper, (continued)
- [PULL 003/113] target/i386: seg_helper: Correct segement selector nullification in the RET/IRET helper, Paolo Bonzini, 2020/12/02
- [PULL 002/113] target/i386: Support up to 32768 CPUs without IRQ remapping, Paolo Bonzini, 2020/12/02
- [PULL 005/113] docs/devel/loads-stores: Add regexp for DMA functions, Paolo Bonzini, 2020/12/02
- [PULL 008/113] dma: Let dma_memory_set() propagate MemTxResult, Paolo Bonzini, 2020/12/02
- [PULL 001/113] target/i386: fix operand order for PDEP and PEXT, Paolo Bonzini, 2020/12/02
- [PULL 009/113] dma: Let dma_memory_rw() propagate MemTxResult, Paolo Bonzini, 2020/12/02
- [PULL 004/113] WHPX: support for the kernel-irqchip on/off, Paolo Bonzini, 2020/12/02
- [PULL 007/113] dma: Document address_space_map/address_space_unmap() prototypes, Paolo Bonzini, 2020/12/02
- [PULL 013/113] pci: Let pci_dma_read() propagate MemTxResult, Paolo Bonzini, 2020/12/02
- [PULL 014/113] pci: Let pci_dma_write() propagate MemTxResult, Paolo Bonzini, 2020/12/02
- [PULL 006/113] qom: eliminate identical functions,
Paolo Bonzini <=
- [PULL 012/113] pci: Let pci_dma_rw() propagate MemTxResult, Paolo Bonzini, 2020/12/02
- [PULL 010/113] dma: Let dma_memory_read() propagate MemTxResult, Paolo Bonzini, 2020/12/02
- [PULL 011/113] dma: Let dma_memory_write() propagate MemTxResult, Paolo Bonzini, 2020/12/02
- [PULL 015/113] hw/ssi/aspeed_smc: Rename 'max_slaves' variable as 'max_peripherals', Paolo Bonzini, 2020/12/02
- [PULL 019/113] hw/dma/xilinx_axidma: Rename StreamSlave as StreamSink, Paolo Bonzini, 2020/12/02
- [PULL 022/113] arm: remove bios_name, Paolo Bonzini, 2020/12/02
- [PULL 021/113] alpha: remove bios_name, Paolo Bonzini, 2020/12/02
- [PULL 024/113] i386: remove bios_name, Paolo Bonzini, 2020/12/02
- [PULL 025/113] lm32: remove bios_name, Paolo Bonzini, 2020/12/02
- [PULL 020/113] hw/net/xilinx_axienet: Rename StreamSlave as StreamSink, Paolo Bonzini, 2020/12/02