diff options
author | Alexander Larsson <alexl@redhat.com> | 2020-09-29 16:00:30 +0200 |
---|---|---|
committer | Alexander Larsson <alexl@redhat.com> | 2020-09-29 16:02:59 +0200 |
commit | 18b8b499de22907ad1177953fb8ef734c721b586 (patch) | |
tree | eadc6aa4f6680a37278fb016713653dee0c44305 | |
parent | 8a0dd452d2d9141e68f2d5eb82475735adb7c861 (diff) | |
download | gtk+-18b8b499de22907ad1177953fb8ef734c721b586.tar.gz |
gdkarray: Add support for GDK_ARRAY_NO_MEMSET
If all your callers already initialize the array element as needed,
then we don't need to memset it to zero first.
This is pretty useful for the snapshot state stack, because due
to the per-node-type data area the elements on the stack are
quite large, but often a lot of it is not used.
-rw-r--r-- | gdk/gdkarrayimpl.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/gdk/gdkarrayimpl.c b/gdk/gdkarrayimpl.c index 65b74a3f59..003c67fd59 100644 --- a/gdk/gdkarrayimpl.c +++ b/gdk/gdkarrayimpl.c @@ -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 |