changeset 95958:fbdde312e09d

(font_update_drivers): Fix crash when no drivers match.
author Andreas Schwab <schwab@suse.de>
date Sun, 15 Jun 2008 10:13:24 +0000
parents 42fbae40c9e0
children 22820f8cee46
files src/ChangeLog src/font.c
diffstat 2 files changed, 9 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Sun Jun 15 09:43:38 2008 +0000
+++ b/src/ChangeLog	Sun Jun 15 10:13:24 2008 +0000
@@ -1,3 +1,7 @@
+2008-06-15  Andreas Schwab  <schwab@suse.de>
+
+	* font.c (font_update_drivers): Fix crash when no drivers match.
+
 2008-06-15  Stefan Monnier  <monnier@iro.umontreal.ca>
 
 	* xfns.c (Fx_create_frame): internal-border-width default to 0 for Gtk.
--- a/src/font.c	Sun Jun 15 09:43:38 2008 +0000
+++ b/src/font.c	Sun Jun 15 10:13:24 2008 +0000
@@ -3272,7 +3272,7 @@
   if (! EQ (new_drivers, Qt))
     {
       /* Re-order the driver list according to new_drivers.  */
-      struct font_driver_list **list_table, *list;
+      struct font_driver_list **list_table, **next;
       Lisp_Object tail;
       int i;
 
@@ -3290,15 +3290,13 @@
 	  list_table[i] = list;
       list_table[i] = NULL;
 
-      f->font_driver_list = list = NULL;
+      next = &f->font_driver_list;
       for (i = 0; list_table[i]; i++)
 	{
-	  if (list)
-	    list->next = list_table[i], list = list->next;
-	  else
-	    f->font_driver_list = list = list_table[i];
+	  *next = list_table[i];
+	  next = &(*next)->next;
 	}
-      list->next = NULL;
+      *next = NULL;
     }
 
   for (list = f->font_driver_list; list; list = list->next)