diff options
author | Benjamin Otte <otte@redhat.com> | 2012-11-13 21:51:29 +0100 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2012-11-14 01:55:28 +0100 |
commit | c98ee1ec396ccd8cb4c87780ee08adad88fdf3e3 (patch) | |
tree | 42bbf6cdf4c743f90c6157b8a82040e85319903c /gtk/gtksizerequestcache.c | |
parent | 4366f80aabea3ba790109bd75517f2339ff6188b (diff) | |
download | gtk+-c98ee1ec396ccd8cb4c87780ee08adad88fdf3e3.tar.gz |
sizerequestcache: Make clear_cache clear all the cache
Diffstat (limited to 'gtk/gtksizerequestcache.c')
-rw-r--r-- | gtk/gtksizerequestcache.c | 51 |
1 files changed, 18 insertions, 33 deletions
diff --git a/gtk/gtksizerequestcache.c b/gtk/gtksizerequestcache.c index d098e402f0..f7597ebb78 100644 --- a/gtk/gtksizerequestcache.c +++ b/gtk/gtksizerequestcache.c @@ -31,46 +31,31 @@ _gtk_size_request_cache_init (SizeRequestCache *cache) memset (cache, 0, sizeof (SizeRequestCache)); } +static void +free_sizes (SizeRequest **sizes) +{ + gint i; + + for (i = 0; i < GTK_SIZE_REQUEST_CACHED_SIZES && sizes[i] != NULL; i++) + g_slice_free (SizeRequest, sizes[i]); + + g_slice_free1 (sizeof (SizeRequest *) * GTK_SIZE_REQUEST_CACHED_SIZES, sizes); +} + void _gtk_size_request_cache_free (SizeRequestCache *cache) { - _gtk_size_request_cache_clear (cache, GTK_SIZE_GROUP_HORIZONTAL); - _gtk_size_request_cache_clear (cache, GTK_SIZE_GROUP_VERTICAL); + if (cache->widths) + free_sizes (cache->widths); + if (cache->heights) + free_sizes (cache->heights); } void -_gtk_size_request_cache_clear (SizeRequestCache *cache, - GtkSizeGroupMode orientation) +_gtk_size_request_cache_clear (SizeRequestCache *cache) { - SizeRequest **sizes; - gint i; - - if (orientation == GTK_SIZE_GROUP_HORIZONTAL) - { - sizes = cache->widths; - - cache->widths = NULL; - cache->cached_widths = 0; - cache->last_cached_width = 0; - cache->cached_base_width = FALSE; - } - else - { - sizes = cache->heights; - - cache->heights = NULL; - cache->cached_heights = 0; - cache->last_cached_height = 0; - cache->cached_base_height = FALSE; - } - - if (sizes) - { - for (i = 0; i < GTK_SIZE_REQUEST_CACHED_SIZES && sizes[i] != NULL; i++) - g_slice_free (SizeRequest, sizes[i]); - - g_slice_free1 (sizeof (SizeRequest *) * GTK_SIZE_REQUEST_CACHED_SIZES, sizes); - } + _gtk_size_request_cache_free (cache); + _gtk_size_request_cache_init (cache); } |