changeset 35664:16e83e3dab3d

* src/macterm.c (mac_font_pattern_match): Allocate three more bytes to regex for '^', '$', and '\0'. * src/macterm.c (x_list_fonts): Protect pattern and newlist from garbage collection.
author Andrew Choi <akochoi@shaw.ca>
date Sun, 28 Jan 2001 15:47:04 +0000
parents e5dea4a61cab
children 2ce207b252dc
files mac/ChangeLog mac/src/macterm.c
diffstat 2 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mac/ChangeLog	Sun Jan 28 15:41:57 2001 +0000
+++ b/mac/ChangeLog	Sun Jan 28 15:47:04 2001 +0000
@@ -1,5 +1,11 @@
 2001-01-28  Andrew Choi  <akochoi@i-cable.com>
 
+	* src/macterm.c (mac_font_pattern_match): Allocate three more
+	bytes to regex for '^', '$', and '\0'.
+
+	* src/macterm.c (x_list_fonts): Protect pattern and newlist from
+	garbage collection.
+	
 	* src/macfns.c (QCconversion): Replaces QCalgorithm.
 
 	* src/macfns.c (image_ascent, lookup_image): Adapt to change of
--- a/mac/src/macterm.c	Sun Jan 28 15:41:57 2001 +0000
+++ b/mac/src/macterm.c	Sun Jan 28 15:47:04 2001 +0000
@@ -10197,7 +10197,7 @@
     char * fontname;
     char * pattern;
 {
-  char *regex = (char *) alloca (strlen (pattern) * 2);
+  char *regex = (char *) alloca (strlen (pattern) * 2 + 3);
   char *font_name_copy = (char *) alloca (strlen (fontname) + 1);
   char *ptr;
 
@@ -10424,12 +10424,15 @@
   Lisp_Object newlist = Qnil;
   int n_fonts = 0;
   int i;
+  struct gcpro gcpro1, gcpro2;
 
   if (font_name_table == NULL)  /* Initialize when first used.  */
     init_font_name_table ();
 
   ptnstr = XSTRING (pattern)->data;
 
+  GCPRO2 (pattern, newlist);
+
   /* Scan and matching bitmap fonts.  */
   for (i = 0; i < font_name_count; i++)
     {
@@ -10445,6 +10448,8 @@
   
   /* MAC_TODO: add code for matching outline fonts here */
 
+  UNGCPRO;
+
   return newlist;
 }