[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 06/33] qom: Make type checker functions accept const pointers
From: |
Eduardo Habkost |
Subject: |
[PULL 06/33] qom: Make type checker functions accept const pointers |
Date: |
Thu, 10 Sep 2020 14:20:45 -0400 |
The existing type check macros all unconditionally drop const
qualifiers from their arguments. Keep this behavior in the
macros generated by DECLARE_*CHECKER* by now.
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20200831210740.126168-6-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
include/qom/object.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/include/qom/object.h b/include/qom/object.h
index 4cd84998c2..3626ae3c65 100644
--- a/include/qom/object.h
+++ b/include/qom/object.h
@@ -567,7 +567,7 @@ struct Object
*/
#define DECLARE_INSTANCE_CHECKER(InstanceType, OBJ_NAME, TYPENAME) \
static inline G_GNUC_UNUSED InstanceType * \
- OBJ_NAME(void *obj) \
+ OBJ_NAME(const void *obj) \
{ return OBJECT_CHECK(InstanceType, obj, TYPENAME); }
/**
@@ -584,11 +584,11 @@ struct Object
*/
#define DECLARE_CLASS_CHECKERS(ClassType, OBJ_NAME, TYPENAME) \
static inline G_GNUC_UNUSED ClassType * \
- OBJ_NAME##_GET_CLASS(void *obj) \
+ OBJ_NAME##_GET_CLASS(const void *obj) \
{ return OBJECT_GET_CLASS(ClassType, obj, TYPENAME); } \
\
static inline G_GNUC_UNUSED ClassType * \
- OBJ_NAME##_CLASS(void *klass) \
+ OBJ_NAME##_CLASS(const void *klass) \
{ return OBJECT_CLASS_CHECK(ClassType, klass, TYPENAME); }
/**
--
2.26.2
- [PULL 00/33] QOM boilerplate cleanup (v4), Eduardo Habkost, 2020/09/10
- [PULL 02/33] qom: make object_ref/unref use a void * instead of Object *., Eduardo Habkost, 2020/09/10
- [PULL 03/33] qom: provide convenient macros for declaring and defining types, Eduardo Habkost, 2020/09/10
- [PULL 05/33] qom: DECLARE_*_CHECKERS macros, Eduardo Habkost, 2020/09/10
- [PULL 06/33] qom: Make type checker functions accept const pointers,
Eduardo Habkost <=
- [PULL 01/33] memory: Remove kernel-doc comment marker, Eduardo Habkost, 2020/09/10
- [PULL 04/33] qom: Allow class type name to be specified in OBJECT_DECLARE*, Eduardo Habkost, 2020/09/10
- [PULL 08/33] Delete duplicate QOM typedefs, Eduardo Habkost, 2020/09/10
- [PULL 12/33] Use OBJECT_DECLARE_TYPE where possible, Eduardo Habkost, 2020/09/10
- [PULL 11/33] Use DECLARE_*CHECKER* when possible (--force mode), Eduardo Habkost, 2020/09/10
- [PULL 14/33] gpex: Fix type checking function name, Eduardo Habkost, 2020/09/10
- [PULL 13/33] Use OBJECT_DECLARE_SIMPLE_TYPE when possible, Eduardo Habkost, 2020/09/10
- [PULL 07/33] codeconverter: script for automating QOM code cleanups, Eduardo Habkost, 2020/09/10
- [PULL 15/33] ap-device: Rename AP_DEVICE_TYPE to TYPE_AP_DEVICE, Eduardo Habkost, 2020/09/10
- [PULL 17/33] vfio: Rename VFIO_AP_DEVICE_TYPE to TYPE_VFIO_AP_DEVICE, Eduardo Habkost, 2020/09/10