Merge branch 'snapshot-stack-optimize' into 'master'

Minor optimizations to GtkSnapshot state stack

See merge request GNOME/gtk!2641
This commit is contained in:
Matthias Clasen 2020-09-29 18:44:07 +00:00
commit 687ed74d46
2 changed files with 7 additions and 3 deletions

View File

@ -141,7 +141,7 @@ gdk_array(is_empty) (const GdkArray *self)
return self->end == self->start;
}
G_GNUC_UNUSED static void
G_GNUC_UNUSED static inline void
gdk_array(reserve) (GdkArray *self,
gsize n)
{
@ -178,7 +178,7 @@ gdk_array(reserve) (GdkArray *self,
#endif
}
G_GNUC_UNUSED static void
G_GNUC_UNUSED static inline void
gdk_array(splice) (GdkArray *self,
gsize pos,
gsize removed,
@ -208,8 +208,10 @@ gdk_array(splice) (GdkArray *self,
memcpy (gdk_array(index) (self, pos),
additions,
added * sizeof (_T_));
#ifndef GDK_ARRAY_NO_MEMSET
else
memset (gdk_array(index) (self, pos), 0, added * sizeof (_T_));
#endif
}
@ -279,5 +281,5 @@ gdk_array(get) (const GdkArray *self,
#undef GDK_ARRAY_NULL_TERMINATED
#undef GDK_ARRAY_PREALLOC
#undef GDK_ARRAY_TYPE_NAME
#undef GDK_ARRAY_NO_MEMSET
#endif

View File

@ -132,6 +132,8 @@ static void gtk_snapshot_state_clear (GtkSnapshotState *state);
#define GDK_ARRAY_ELEMENT_TYPE GtkSnapshotState
#define GDK_ARRAY_FREE_FUNC gtk_snapshot_state_clear
#define GDK_ARRAY_BY_VALUE 1
#define GDK_ARRAY_PREALLOC 16
#define GDK_ARRAY_NO_MEMSET 1
#include "gdk/gdkarrayimpl.c"
/* This is a nasty little hack. We typedef GtkSnapshot to the fake object GdkSnapshot