mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-07-31 22:23:39 +02:00
Rename the generated private data getter function
As it turns out, we have examples of internal functions called type_name_get_private() in the wild (especially among older libraries), so we need to use a name for the per-instance private data getter function that hopefully won't conflict with anything.
This commit is contained in:
@@ -146,7 +146,7 @@ GType maman_bar_get_type (void);
|
||||
G_DEFINE_TYPE_WITH_PRIVATE() macro, or use the G_ADD_PRIVATE()
|
||||
macro with the G_DEFINE_TYPE_WITH_CODE() or the G_DEFINE_TYPE_EXTENDED()
|
||||
macros. The private structure is then defined in the .c file,
|
||||
and can be accessed using the <function>get_private()</function>
|
||||
and can be accessed using the <function>get_instance_private()</function>
|
||||
function generated by the G_DEFINE_TYPE_* macros.
|
||||
<programlisting>
|
||||
struct _MamanBarPrivate
|
||||
@@ -164,10 +164,10 @@ maman_bar_class_init (MamanBarClass *klass)
|
||||
static void
|
||||
maman_bar_init (MamanBar *self)
|
||||
{
|
||||
/* maman_bar_get_private() is generated by G_DEFINE_TYPE_WITH_PRIVATE()
|
||||
/* maman_bar_get_instance_private() is generated by G_DEFINE_TYPE_WITH_PRIVATE()
|
||||
* above, and it's local to the current compilation unit.
|
||||
*/
|
||||
MamanBarPrivate *priv = maman_bar_get_private (self);
|
||||
MamanBarPrivate *priv = maman_bar_get_instance_private (self);
|
||||
|
||||
priv->hsize = 42;
|
||||
}
|
||||
@@ -197,7 +197,7 @@ maman_bar_class_init (MamanBarClass *klass)
|
||||
static void
|
||||
maman_bar_init (MamanBar *self)
|
||||
{
|
||||
self->priv = maman_bar_get_private (self);
|
||||
self->priv = maman_bar_get_instance_private (self);
|
||||
self->priv->hsize = 42;
|
||||
}
|
||||
</para></listitem>
|
||||
@@ -330,7 +330,7 @@ maman_bar_class_init (MamanBarClass *klass)
|
||||
static void
|
||||
maman_bar_init (MamanBar *self)
|
||||
{
|
||||
self->priv = maman_bar_get_private (self);
|
||||
self->priv = maman_bar_get_instance_private (self);
|
||||
|
||||
/* initialize all public and private members to reasonable default values. */
|
||||
}
|
||||
@@ -471,7 +471,7 @@ maman_bar_class_init (MamanBarClass *klass)
|
||||
static void
|
||||
maman_bar_init (MamanBar *self);
|
||||
{
|
||||
self->priv = maman_bar_get_private (self);
|
||||
self->priv = maman_bar_get_instance_private (self);
|
||||
|
||||
self->priv->an_object = g_object_new (MAMAN_TYPE_BAZ, NULL);
|
||||
self->priv->a_string = g_strdup ("Maman");
|
||||
|
Reference in New Issue
Block a user