diff options
author | Emmanuele Bassi <ebassi@gnome.org> | 2018-05-25 10:06:05 +0100 |
---|---|---|
committer | Emmanuele Bassi <ebassi@gnome.org> | 2018-05-25 10:11:20 +0100 |
commit | 26683ff51dce31180ee82053c33224cfdb5c75c0 (patch) | |
tree | ba97349880e3e469af524d90e06d68e32c826076 | |
parent | 8f2d68da658831a443f08cb8bc181d615a5095fe (diff) | |
download | glib-issue-699.tar.gz |
Deprecate g_type_class_add_private()issue-699
It's been 4 years and 8 development cycles since we introduced
G_ADD_PRIVATE and offset-based private data access. It is now
time to finally deprecate the old mechanism.
Closes: #699
-rw-r--r-- | gobject/gtype.c | 4 | ||||
-rw-r--r-- | gobject/gtype.h | 4 | ||||
-rw-r--r-- | gobject/tests/private.c | 2 |
3 files changed, 8 insertions, 2 deletions
diff --git a/gobject/gtype.c b/gobject/gtype.c index 275a8b60b..da0ab8d4c 100644 --- a/gobject/gtype.c +++ b/gobject/gtype.c @@ -76,7 +76,7 @@ * * Type instance and class structs are limited to a total of 64 KiB, * including all parent types. Similarly, type instances' private data - * (as created by g_type_class_add_private()) are limited to a total of + * (as created by G_ADD_PRIVATE()) are limited to a total of * 64 KiB. If a type instance needs a large static buffer, allocate it * separately (typically by using #GArray or #GPtrArray) and put a pointer * to the buffer in the structure. @@ -4562,6 +4562,8 @@ gobject_init_ctor (void) * ]| * * Since: 2.4 + * Deprecated: 2.58: Use the G_ADD_PRIVATE() macro with the `G_DEFINE_*` + * family of macros to add instance private data to a type */ void g_type_class_add_private (gpointer g_class, diff --git a/gobject/gtype.h b/gobject/gtype.h index cf7770322..77e22a0a9 100644 --- a/gobject/gtype.h +++ b/gobject/gtype.h @@ -634,6 +634,8 @@ struct _GTypeQuery * This macro should only be used in type implementations. * * Since: 2.4 + * Deprecated: 2.58: Use %G_ADD_PRIVATE and the generated + * `your_type_get_instance_private()` function instead * Returns: (not nullable): a pointer to the private data structure */ #define G_TYPE_INSTANCE_GET_PRIVATE(instance, g_type, c_type) ((c_type*) g_type_instance_get_private ((GTypeInstance*) (instance), (g_type))) @@ -1297,7 +1299,7 @@ void g_type_interface_add_prerequisite (GType interface_type, GLIB_AVAILABLE_IN_ALL GType*g_type_interface_prerequisites (GType interface_type, guint *n_prerequisites); -GLIB_AVAILABLE_IN_ALL +GLIB_DEPRECATED_IN_2_58 void g_type_class_add_private (gpointer g_class, gsize private_size); GLIB_AVAILABLE_IN_2_38 diff --git a/gobject/tests/private.c b/gobject/tests/private.c index ecf5e7b71..678222190 100644 --- a/gobject/tests/private.c +++ b/gobject/tests/private.c @@ -128,7 +128,9 @@ G_DEFINE_TYPE (TestMixed, test_mixed, test_object_get_type ()) static void test_mixed_class_init (TestMixedClass *klass) { +G_GNUC_BEGIN_IGNORE_DEPRECATIONS g_type_class_add_private (klass, sizeof (TestMixedPrivate)); +G_GNUC_END_IGNORE_DEPRECATIONS } static void |