summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Choi <akochoi@shaw.ca>2001-01-28 15:47:04 +0000
committerAndrew Choi <akochoi@shaw.ca>2001-01-28 15:47:04 +0000
commitb179a3a28f7dcd67532d0122c01837bf9a0e999c (patch)
tree91feeaec8977e32f48c1ac7c718b418f2d3b63ec
parent5604ec34e4b9414637d0501f30c79a4b871008a0 (diff)
downloademacs-b179a3a28f7dcd67532d0122c01837bf9a0e999c.tar.gz
* 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.
-rw-r--r--mac/ChangeLog6
-rw-r--r--mac/src/macterm.c7
2 files changed, 12 insertions, 1 deletions
diff --git a/mac/ChangeLog b/mac/ChangeLog
index acdd5fe3a90..e7dae4c2e29 100644
--- a/mac/ChangeLog
+++ b/mac/ChangeLog
@@ -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
diff --git a/mac/src/macterm.c b/mac/src/macterm.c
index ed9280e42eb..2b7ea0f0a61 100644
--- a/mac/src/macterm.c
+++ b/mac/src/macterm.c
@@ -10197,7 +10197,7 @@ mac_font_pattern_match (fontname, pattern)
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 @@ x_list_fonts (struct frame *f,
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 @@ x_list_fonts (struct frame *f,
/* MAC_TODO: add code for matching outline fonts here */
+ UNGCPRO;
+
return newlist;
}