mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-23 01:18:53 +02:00
GTrashStack: uninline and deprecate
Deprecate GTrashStack and remove the inline implementations for the functions. This will help us clean up the mess that is inline functions in GLib. Because of how G_INLINE_FUNC worked, we have these functions on our ABI, so we must continue to export them as normal functions. We are safe to remove the inline versions, however, because any existing binaries will continue to carry them and any new builds will just start using the non-inline versions. https://bugzilla.gnome.org/show_bug.cgi?id=757374
This commit is contained in:
@@ -39,63 +39,16 @@ struct _GTrashStack
|
||||
GTrashStack *next;
|
||||
};
|
||||
|
||||
G_INLINE_FUNC void g_trash_stack_push (GTrashStack **stack_p,
|
||||
gpointer data_p);
|
||||
G_INLINE_FUNC gpointer g_trash_stack_pop (GTrashStack **stack_p);
|
||||
G_INLINE_FUNC gpointer g_trash_stack_peek (GTrashStack **stack_p);
|
||||
G_INLINE_FUNC guint g_trash_stack_height (GTrashStack **stack_p);
|
||||
|
||||
#if defined (G_CAN_INLINE) || defined (__G_TRASH_STACK_C__)
|
||||
|
||||
G_INLINE_FUNC void
|
||||
g_trash_stack_push (GTrashStack **stack_p,
|
||||
gpointer data_p)
|
||||
{
|
||||
GTrashStack *data = (GTrashStack *) data_p;
|
||||
|
||||
data->next = *stack_p;
|
||||
*stack_p = data;
|
||||
}
|
||||
G_INLINE_FUNC gpointer
|
||||
g_trash_stack_pop (GTrashStack **stack_p)
|
||||
{
|
||||
GTrashStack *data;
|
||||
|
||||
data = *stack_p;
|
||||
if (data)
|
||||
{
|
||||
*stack_p = data->next;
|
||||
/* NULLify private pointer here, most platforms store NULL as
|
||||
* subsequent 0 bytes
|
||||
*/
|
||||
data->next = NULL;
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
G_INLINE_FUNC gpointer
|
||||
g_trash_stack_peek (GTrashStack **stack_p)
|
||||
{
|
||||
GTrashStack *data;
|
||||
|
||||
data = *stack_p;
|
||||
|
||||
return data;
|
||||
}
|
||||
G_INLINE_FUNC guint
|
||||
g_trash_stack_height (GTrashStack **stack_p)
|
||||
{
|
||||
GTrashStack *data;
|
||||
guint i = 0;
|
||||
|
||||
for (data = *stack_p; data; data = data->next)
|
||||
i++;
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
#endif /* G_CAN_INLINE || __G_TRASH_STACK_C__ */
|
||||
GLIB_DEPRECATED_IN_2_48
|
||||
void g_trash_stack_push (GTrashStack **stack_p,
|
||||
gpointer data_p);
|
||||
GLIB_DEPRECATED_IN_2_48
|
||||
gpointer g_trash_stack_pop (GTrashStack **stack_p);
|
||||
GLIB_DEPRECATED_IN_2_48
|
||||
gpointer g_trash_stack_peek (GTrashStack **stack_p);
|
||||
GLIB_DEPRECATED_IN_2_48
|
||||
guint g_trash_stack_height (GTrashStack **stack_p);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __G_UTILS_H__ */
|
||||
#endif /* __G_TRASH_STACK_H_ */
|
||||
|
Reference in New Issue
Block a user