diff options
Diffstat (limited to 'src/fontset.c')
| -rw-r--r-- | src/fontset.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/fontset.c b/src/fontset.c index d99a3bcb7ef..c415fdfa8fd 100644 --- a/src/fontset.c +++ b/src/fontset.c | |||
| @@ -1079,10 +1079,11 @@ fontset_pattern_regexp (Lisp_Object pattern) | |||
| 1079 | /* If PATTERN is not full XLFD we convert "*" to ".*". Otherwise | 1079 | /* If PATTERN is not full XLFD we convert "*" to ".*". Otherwise |
| 1080 | we convert "*" to "[^-]*" which is much faster in regular | 1080 | we convert "*" to "[^-]*" which is much faster in regular |
| 1081 | expression matching. */ | 1081 | expression matching. */ |
| 1082 | if (ndashes < 14) | 1082 | ptrdiff_t regexsize = (SBYTES (pattern) |
| 1083 | p1 = regex = alloca (SBYTES (pattern) + 2 * nstars + 2 * nescs + 1); | 1083 | + (ndashes < 14 ? 2 : 5) * nstars |
| 1084 | else | 1084 | + 2 * nescs + 1); |
| 1085 | p1 = regex = alloca (SBYTES (pattern) + 5 * nstars + 2 * nescs + 1); | 1085 | USE_SAFE_ALLOCA; |
| 1086 | p1 = regex = SAFE_ALLOCA (regexsize); | ||
| 1086 | 1087 | ||
| 1087 | *p1++ = '^'; | 1088 | *p1++ = '^'; |
| 1088 | for (p0 = SDATA (pattern); *p0; p0++) | 1089 | for (p0 = SDATA (pattern); *p0; p0++) |
| @@ -1110,6 +1111,7 @@ fontset_pattern_regexp (Lisp_Object pattern) | |||
| 1110 | 1111 | ||
| 1111 | Vcached_fontset_data = Fcons (build_string (SSDATA (pattern)), | 1112 | Vcached_fontset_data = Fcons (build_string (SSDATA (pattern)), |
| 1112 | build_string ((char *) regex)); | 1113 | build_string ((char *) regex)); |
| 1114 | SAFE_FREE (); | ||
| 1113 | } | 1115 | } |
| 1114 | 1116 | ||
| 1115 | return CACHED_FONTSET_REGEX; | 1117 | return CACHED_FONTSET_REGEX; |
| @@ -1460,8 +1462,8 @@ appended. By default, FONT-SPEC overrides the previous settings. */) | |||
| 1460 | registry = AREF (font_spec, FONT_REGISTRY_INDEX); | 1462 | registry = AREF (font_spec, FONT_REGISTRY_INDEX); |
| 1461 | if (! NILP (registry)) | 1463 | if (! NILP (registry)) |
| 1462 | registry = Fdowncase (SYMBOL_NAME (registry)); | 1464 | registry = Fdowncase (SYMBOL_NAME (registry)); |
| 1463 | encoding = find_font_encoding (concat3 (family, build_string ("-"), | 1465 | AUTO_STRING (dash, "-"); |
| 1464 | registry)); | 1466 | encoding = find_font_encoding (concat3 (family, dash, registry)); |
| 1465 | if (NILP (encoding)) | 1467 | if (NILP (encoding)) |
| 1466 | encoding = Qascii; | 1468 | encoding = Qascii; |
| 1467 | 1469 | ||
| @@ -1573,7 +1575,7 @@ appended. By default, FONT-SPEC overrides the previous settings. */) | |||
| 1573 | 1575 | ||
| 1574 | if (ascii_changed) | 1576 | if (ascii_changed) |
| 1575 | { | 1577 | { |
| 1576 | Lisp_Object tail, fr, alist; | 1578 | Lisp_Object tail, fr; |
| 1577 | int fontset_id = XINT (FONTSET_ID (fontset)); | 1579 | int fontset_id = XINT (FONTSET_ID (fontset)); |
| 1578 | 1580 | ||
| 1579 | set_fontset_ascii (fontset, fontname); | 1581 | set_fontset_ascii (fontset, fontname); |
| @@ -1596,8 +1598,8 @@ appended. By default, FONT-SPEC overrides the previous settings. */) | |||
| 1596 | if (! NILP (font_object)) | 1598 | if (! NILP (font_object)) |
| 1597 | { | 1599 | { |
| 1598 | update_auto_fontset_alist (font_object, fontset); | 1600 | update_auto_fontset_alist (font_object, fontset); |
| 1599 | alist = list1 (Fcons (Qfont, Fcons (name, font_object))); | 1601 | AUTO_FRAME_ARG (arg, Qfont, Fcons (name, font_object)); |
| 1600 | Fmodify_frame_parameters (fr, alist); | 1602 | Fmodify_frame_parameters (fr, arg); |
| 1601 | } | 1603 | } |
| 1602 | } | 1604 | } |
| 1603 | } | 1605 | } |
| @@ -1892,7 +1894,9 @@ format is the same as above. */) | |||
| 1892 | 1894 | ||
| 1893 | /* Recode fontsets realized on FRAME from the base fontset FONTSET | 1895 | /* Recode fontsets realized on FRAME from the base fontset FONTSET |
| 1894 | in the table `realized'. */ | 1896 | in the table `realized'. */ |
| 1895 | realized[0] = alloca (word_size * ASIZE (Vfontset_table)); | 1897 | USE_SAFE_ALLOCA; |
| 1898 | SAFE_ALLOCA_LISP (realized[0], 2 * ASIZE (Vfontset_table)); | ||
| 1899 | realized[1] = realized[0] + ASIZE (Vfontset_table); | ||
| 1896 | for (i = j = 0; i < ASIZE (Vfontset_table); i++) | 1900 | for (i = j = 0; i < ASIZE (Vfontset_table); i++) |
| 1897 | { | 1901 | { |
| 1898 | elt = FONTSET_FROM_ID (i); | 1902 | elt = FONTSET_FROM_ID (i); |
| @@ -1903,7 +1907,6 @@ format is the same as above. */) | |||
| 1903 | } | 1907 | } |
| 1904 | realized[0][j] = Qnil; | 1908 | realized[0][j] = Qnil; |
| 1905 | 1909 | ||
| 1906 | realized[1] = alloca (word_size * ASIZE (Vfontset_table)); | ||
| 1907 | for (i = j = 0; ! NILP (realized[0][i]); i++) | 1910 | for (i = j = 0; ! NILP (realized[0][i]); i++) |
| 1908 | { | 1911 | { |
| 1909 | elt = FONTSET_DEFAULT (realized[0][i]); | 1912 | elt = FONTSET_DEFAULT (realized[0][i]); |
| @@ -1995,6 +1998,7 @@ format is the same as above. */) | |||
| 1995 | break; | 1998 | break; |
| 1996 | } | 1999 | } |
| 1997 | 2000 | ||
| 2001 | SAFE_FREE (); | ||
| 1998 | return tables[0]; | 2002 | return tables[0]; |
| 1999 | } | 2003 | } |
| 2000 | 2004 | ||