Provide a fast path returning NULL when the limit is set to 0.

2006-11-16  Emmanuele Bassi  <ebassi@gnome.org>

	* gtk/gtkrecentmanager.c: Provide a fast path returning
	NULL when the limit is set to 0.

	* gtk/gtkrecentchooserdefault.c:
	* gtk/gtkrecentchoosermenu.c: Add the same fast path
	inside the RecentChooser implementation; add a check
	in the list clamping code. (#373466 and duplicates)
This commit is contained in:
Emmanuele Bassi
2006-11-16 09:57:45 +00:00
committed by Emmanuele Bassi
parent b99bea2489
commit cbf6d898fb
4 changed files with 23 additions and 2 deletions

View File

@ -607,8 +607,10 @@ gtk_recent_chooser_menu_get_items (GtkRecentChooser *chooser)
return NULL;
limit = gtk_recent_chooser_get_limit (chooser);
sort_type = gtk_recent_chooser_get_sort_type (chooser);
if (limit == 0)
return NULL;
sort_type = gtk_recent_chooser_get_sort_type (chooser);
switch (sort_type)
{
case GTK_RECENT_SORT_NONE:
@ -641,6 +643,8 @@ gtk_recent_chooser_menu_get_items (GtkRecentChooser *chooser)
GList *clamp, *l;
clamp = g_list_nth (items, limit - 1);
if (!clamp)
return items;
l = clamp->next;
clamp->next = NULL;