diff options
author | Eduardo Habkost <ehabkost@redhat.com> | 2020-09-16 14:25:16 -0400 |
---|---|---|
committer | Eduardo Habkost <ehabkost@redhat.com> | 2020-09-18 14:12:32 -0400 |
commit | c734cd40a10943753a4d015c9d0a6c08c8f0159e (patch) | |
tree | f3a0e5e0152e85da0f0d0bc4bb48eef2198867c4 /include | |
parent | 4a15e5bef8ec4322d4192dc4ab0b6149d415b990 (diff) | |
download | qemu-c734cd40a10943753a4d015c9d0a6c08c8f0159e.zip qemu-c734cd40a10943753a4d015c9d0a6c08c8f0159e.tar.gz qemu-c734cd40a10943753a4d015c9d0a6c08c8f0159e.tar.bz2 |
qom: Remove ParentClassType argument from OBJECT_DECLARE_SIMPLE_TYPE
The requirement to specify the parent class type makes the macro
harder to use and easy to misuse (silent bugs can be introduced
if the wrong struct type is specified).
Simplify the macro by just not declaring any class struct,
allowing us to remove the class_size field from the TypeInfo
variables for those types.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200916182519.415636-3-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/authz/list.h | 2 | ||||
-rw-r--r-- | include/authz/listfile.h | 2 | ||||
-rw-r--r-- | include/authz/pamacct.h | 2 | ||||
-rw-r--r-- | include/authz/simple.h | 2 | ||||
-rw-r--r-- | include/crypto/secret_keyring.h | 2 | ||||
-rw-r--r-- | include/io/dns-resolver.h | 2 | ||||
-rw-r--r-- | include/io/net-listener.h | 2 | ||||
-rw-r--r-- | include/qom/object.h | 16 | ||||
-rw-r--r-- | include/sysemu/vhost-user-backend.h | 2 |
9 files changed, 16 insertions, 16 deletions
diff --git a/include/authz/list.h b/include/authz/list.h index 5676bb3..c5eda0f 100644 --- a/include/authz/list.h +++ b/include/authz/list.h @@ -28,7 +28,7 @@ #define TYPE_QAUTHZ_LIST "authz-list" OBJECT_DECLARE_SIMPLE_TYPE(QAuthZList, qauthz_list, - QAUTHZ_LIST, QAuthZClass) + QAUTHZ_LIST) diff --git a/include/authz/listfile.h b/include/authz/listfile.h index b491227..83d78cf 100644 --- a/include/authz/listfile.h +++ b/include/authz/listfile.h @@ -28,7 +28,7 @@ #define TYPE_QAUTHZ_LIST_FILE "authz-list-file" OBJECT_DECLARE_SIMPLE_TYPE(QAuthZListFile, qauthz_list_file, - QAUTHZ_LIST_FILE, QAuthZClass) + QAUTHZ_LIST_FILE) diff --git a/include/authz/pamacct.h b/include/authz/pamacct.h index 7804853..18087ce 100644 --- a/include/authz/pamacct.h +++ b/include/authz/pamacct.h @@ -28,7 +28,7 @@ #define TYPE_QAUTHZ_PAM "authz-pam" OBJECT_DECLARE_SIMPLE_TYPE(QAuthZPAM, qauthz_pam, - QAUTHZ_PAM, QAuthZClass) + QAUTHZ_PAM) diff --git a/include/authz/simple.h b/include/authz/simple.h index 346fcb0..d3ed05b 100644 --- a/include/authz/simple.h +++ b/include/authz/simple.h @@ -27,7 +27,7 @@ #define TYPE_QAUTHZ_SIMPLE "authz-simple" OBJECT_DECLARE_SIMPLE_TYPE(QAuthZSimple, qauthz_simple, - QAUTHZ_SIMPLE, QAuthZClass) + QAUTHZ_SIMPLE) diff --git a/include/crypto/secret_keyring.h b/include/crypto/secret_keyring.h index 73d2a8f..803f3fc 100644 --- a/include/crypto/secret_keyring.h +++ b/include/crypto/secret_keyring.h @@ -27,7 +27,7 @@ #define TYPE_QCRYPTO_SECRET_KEYRING "secret_keyring" OBJECT_DECLARE_SIMPLE_TYPE(QCryptoSecretKeyring, qcrypto_secret_keyring, - QCRYPTO_SECRET_KEYRING, QCryptoSecretCommonClass) + QCRYPTO_SECRET_KEYRING) struct QCryptoSecretKeyring { diff --git a/include/io/dns-resolver.h b/include/io/dns-resolver.h index e248fba..9d14a8d 100644 --- a/include/io/dns-resolver.h +++ b/include/io/dns-resolver.h @@ -27,7 +27,7 @@ #define TYPE_QIO_DNS_RESOLVER "qio-dns-resolver" OBJECT_DECLARE_SIMPLE_TYPE(QIODNSResolver, qio_dns_resolver, - QIO_DNS_RESOLVER, ObjectClass) + QIO_DNS_RESOLVER) /** diff --git a/include/io/net-listener.h b/include/io/net-listener.h index 60fad29..8145962 100644 --- a/include/io/net-listener.h +++ b/include/io/net-listener.h @@ -26,7 +26,7 @@ #define TYPE_QIO_NET_LISTENER "qio-net-listener" OBJECT_DECLARE_SIMPLE_TYPE(QIONetListener, qio_net_listener, - QIO_NET_LISTENER, ObjectClass) + QIO_NET_LISTENER) typedef void (*QIONetListenerClientFunc)(QIONetListener *listener, diff --git a/include/qom/object.h b/include/qom/object.h index 405a2c6..d5814bd 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -639,19 +639,19 @@ struct Object * @InstanceType: instance struct name * @module_obj_name: the object name in lowercase with underscore separators * @MODULE_OBJ_NAME: the object name in uppercase with underscore separators - * @ParentClassType: class struct name of parent type * - * This does the same as OBJECT_DECLARE_TYPE(), but also declares - * the class struct, thus only the object struct needs to be declare - * manually. + * This does the same as OBJECT_DECLARE_TYPE(), but with no class struct + * declared. * * This macro should be used unless the class struct needs to have * virtual methods declared. */ -#define OBJECT_DECLARE_SIMPLE_TYPE(InstanceType, module_obj_name, \ - MODULE_OBJ_NAME, ParentClassType) \ - OBJECT_DECLARE_TYPE(InstanceType, InstanceType##Class, module_obj_name, MODULE_OBJ_NAME) \ - struct InstanceType##Class { ParentClassType parent_class; }; +#define OBJECT_DECLARE_SIMPLE_TYPE(InstanceType, module_obj_name, MODULE_OBJ_NAME) \ + typedef struct InstanceType InstanceType; \ + \ + G_DEFINE_AUTOPTR_CLEANUP_FUNC(InstanceType, object_unref) \ + \ + DECLARE_INSTANCE_CHECKER(InstanceType, MODULE_OBJ_NAME, TYPE_##MODULE_OBJ_NAME) /** diff --git a/include/sysemu/vhost-user-backend.h b/include/sysemu/vhost-user-backend.h index 23205ed..41d5ff4 100644 --- a/include/sysemu/vhost-user-backend.h +++ b/include/sysemu/vhost-user-backend.h @@ -23,7 +23,7 @@ #define TYPE_VHOST_USER_BACKEND "vhost-user-backend" OBJECT_DECLARE_SIMPLE_TYPE(VhostUserBackend, vhost_user_backend, - VHOST_USER_BACKEND, ObjectClass) + VHOST_USER_BACKEND) |