diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2024-05-20 15:15:25 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2024-05-20 15:15:25 (GMT) |
commit | 6decc8c40dfaf7cb04156f1ab233cd856ed06b37 (patch) | |
tree | 7a326fc66d2465bdedc978146faef55e53531652 /src/glibext | |
parent | 79662ede83b35ad9d91b942218cf09e856e48b4c (diff) |
Improve the DECLARE_GTYPE() macro and use it everywhere.
Diffstat (limited to 'src/glibext')
-rw-r--r-- | src/glibext/helpers.h | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/src/glibext/helpers.h b/src/glibext/helpers.h index 752eb07..71a7269 100644 --- a/src/glibext/helpers.h +++ b/src/glibext/helpers.h @@ -56,36 +56,36 @@ * préalable de manière globale et cohérente dans l'ensemble du code d'emploi. */ -#define DECLARE_GTYPE(TN, t_n, MOD, NAME) \ - \ - GType t_n##_get_type(void); \ - \ - typedef struct _##TN TN; \ - typedef struct _##TN##Class TN##Class; \ - \ - G_GNUC_UNUSED static inline TN *MOD##_##NAME(gpointer obj) \ - { \ - return G_TYPE_CHECK_INSTANCE_CAST(obj, MOD##_TYPE_##NAME, TN); \ - } \ - \ - G_GNUC_UNUSED static inline TN##Class *MOD##_##NAME##_CLASS(gpointer klass) \ - { \ - return G_TYPE_CHECK_CLASS_CAST(klass, MOD##_TYPE_##NAME, TN##Class); \ - } \ - \ - G_GNUC_UNUSED static inline gboolean MOD##_IS_##NAME(gpointer obj) \ - { \ - return G_TYPE_CHECK_INSTANCE_TYPE(obj, MOD##_TYPE_##NAME); \ - } \ - \ - G_GNUC_UNUSED static inline gboolean MOD##_IS_##NAME##_CLASS(gpointer klass) \ - { \ - return G_TYPE_CHECK_CLASS_TYPE(klass, MOD##_TYPE_##NAME); \ - } \ - \ - G_GNUC_UNUSED static inline TN##Class *MOD##_##NAME##_GET_CLASS(gpointer obj) \ - { \ - return G_TYPE_INSTANCE_GET_CLASS(obj, MOD##_TYPE_##NAME, TN##Class); \ +#define DECLARE_GTYPE(TN, t_n, MOD, NAME) \ + \ + GType t_n##_get_type(void) G_GNUC_CONST; \ + \ + typedef struct _##TN TN; \ + typedef struct _##TN##Class TN##Class; \ + \ + G_GNUC_UNUSED static inline TN *MOD##_##NAME(gconstpointer obj) \ + { \ + return G_TYPE_CHECK_INSTANCE_CAST(obj, MOD##_TYPE_##NAME, TN); \ + } \ + \ + G_GNUC_UNUSED static inline TN##Class *MOD##_##NAME##_CLASS(gconstpointer klass) \ + { \ + return G_TYPE_CHECK_CLASS_CAST(klass, MOD##_TYPE_##NAME, TN##Class); \ + } \ + \ + G_GNUC_UNUSED static inline gboolean MOD##_IS_##NAME(gconstpointer obj) \ + { \ + return G_TYPE_CHECK_INSTANCE_TYPE(obj, MOD##_TYPE_##NAME); \ + } \ + \ + G_GNUC_UNUSED static inline gboolean MOD##_IS_##NAME##_CLASS(gconstpointer klass) \ + { \ + return G_TYPE_CHECK_CLASS_TYPE(klass, MOD##_TYPE_##NAME); \ + } \ + \ + G_GNUC_UNUSED static inline TN##Class *MOD##_##NAME##_GET_CLASS(gconstpointer obj) \ + { \ + return G_TYPE_INSTANCE_GET_CLASS(obj, MOD##_TYPE_##NAME, TN##Class); \ } |