diff options
| -rw-r--r-- | src/ChangeLog | 8 | ||||
| -rw-r--r-- | src/xfont.c | 10 |
2 files changed, 12 insertions, 6 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 2be24fa851b..6f105ead811 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2014-11-14 Dmitry Antipov <dmantipov@yandex.ru> | ||
| 2 | |||
| 3 | * xfont.c (xfont_list_pattern): Do not allocate font entity object | ||
| 4 | for each candidate font but attempt to reuse it from previous improper | ||
| 5 | candidate, if any. | ||
| 6 | |||
| 1 | 2014-11-13 Paul Eggert <eggert@cs.ucla.edu> | 7 | 2014-11-13 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 8 | ||
| 3 | Avoid undefined behavior in color table hashing. | 9 | Avoid undefined behavior in color table hashing. |
| @@ -237,7 +243,7 @@ | |||
| 237 | functions in Vselection_converter_alist (Bug#18911). | 243 | functions in Vselection_converter_alist (Bug#18911). |
| 238 | (syms_of_nsselect): Remove Vselection_converter_alist. | 244 | (syms_of_nsselect): Remove Vselection_converter_alist. |
| 239 | 245 | ||
| 240 | (2014-10-31 Dmitry Antipov <dmantipov@yandex.ru> | 246 | 2014-10-31 Dmitry Antipov <dmantipov@yandex.ru> |
| 241 | 247 | ||
| 242 | * font.c (copy_font_spec): Redesign to avoid Fcopy_alist | 248 | * font.c (copy_font_spec): Redesign to avoid Fcopy_alist |
| 243 | and unnecessary initialization. Adjust comments. | 249 | and unnecessary initialization. Adjust comments. |
diff --git a/src/xfont.c b/src/xfont.c index 5e8dd370120..06a44794364 100644 --- a/src/xfont.c +++ b/src/xfont.c | |||
| @@ -386,7 +386,7 @@ xfont_list_pattern (Display *display, const char *pattern, | |||
| 386 | { | 386 | { |
| 387 | char **indices = alloca (sizeof (char *) * num_fonts); | 387 | char **indices = alloca (sizeof (char *) * num_fonts); |
| 388 | Lisp_Object *props = XVECTOR (xfont_scratch_props)->contents; | 388 | Lisp_Object *props = XVECTOR (xfont_scratch_props)->contents; |
| 389 | Lisp_Object scripts = Qnil; | 389 | Lisp_Object scripts = Qnil, entity = Qnil; |
| 390 | 390 | ||
| 391 | for (i = 0; i < ASIZE (xfont_scratch_props); i++) | 391 | for (i = 0; i < ASIZE (xfont_scratch_props); i++) |
| 392 | ASET (xfont_scratch_props, i, Qnil); | 392 | ASET (xfont_scratch_props, i, Qnil); |
| @@ -397,11 +397,11 @@ xfont_list_pattern (Display *display, const char *pattern, | |||
| 397 | for (i = 0; i < num_fonts; i++) | 397 | for (i = 0; i < num_fonts; i++) |
| 398 | { | 398 | { |
| 399 | ptrdiff_t len; | 399 | ptrdiff_t len; |
| 400 | Lisp_Object entity; | ||
| 401 | 400 | ||
| 402 | if (i > 0 && xstrcasecmp (indices[i - 1], indices[i]) == 0) | 401 | if (i > 0 && xstrcasecmp (indices[i - 1], indices[i]) == 0) |
| 403 | continue; | 402 | continue; |
| 404 | entity = font_make_entity (); | 403 | if (NILP (entity)) |
| 404 | entity = font_make_entity (); | ||
| 405 | len = xfont_decode_coding_xlfd (indices[i], -1, buf); | 405 | len = xfont_decode_coding_xlfd (indices[i], -1, buf); |
| 406 | if (font_parse_xlfd (buf, len, entity) < 0) | 406 | if (font_parse_xlfd (buf, len, entity) < 0) |
| 407 | continue; | 407 | continue; |
| @@ -459,7 +459,7 @@ xfont_list_pattern (Display *display, const char *pattern, | |||
| 459 | { | 459 | { |
| 460 | if (NILP (script) | 460 | if (NILP (script) |
| 461 | || xfont_chars_supported (chars, NULL, encoding, repertory)) | 461 | || xfont_chars_supported (chars, NULL, encoding, repertory)) |
| 462 | list = Fcons (entity, list); | 462 | list = Fcons (entity, list), entity = Qnil; |
| 463 | continue; | 463 | continue; |
| 464 | } | 464 | } |
| 465 | if (memcmp (props, aref_addr (entity, FONT_FOUNDRY_INDEX), | 465 | if (memcmp (props, aref_addr (entity, FONT_FOUNDRY_INDEX), |
| @@ -474,7 +474,7 @@ xfont_list_pattern (Display *display, const char *pattern, | |||
| 474 | } | 474 | } |
| 475 | if (NILP (script) | 475 | if (NILP (script) |
| 476 | || ! NILP (Fmemq (script, scripts))) | 476 | || ! NILP (Fmemq (script, scripts))) |
| 477 | list = Fcons (entity, list); | 477 | list = Fcons (entity, list), entity = Qnil; |
| 478 | } | 478 | } |
| 479 | XFreeFontNames (names); | 479 | XFreeFontNames (names); |
| 480 | } | 480 | } |