aboutsummaryrefslogtreecommitdiffstats
path: root/src/font.c
diff options
context:
space:
mode:
authorDmitry Antipov2012-07-11 10:14:19 +0400
committerDmitry Antipov2012-07-11 10:14:19 +0400
commitd923b542aa2d115bb87e72e156be837cea752536 (patch)
treee2a0c475d8d1aee4c790e77765554b6926871ab6 /src/font.c
parent57054ddd444bd1702f2bcc08321d3ed3a644448e (diff)
downloademacs-d923b542aa2d115bb87e72e156be837cea752536.tar.gz
emacs-d923b542aa2d115bb87e72e156be837cea752536.zip
Avoid call to strlen in fast_c_string_match_ignore_case.
* search.c (fast_c_string_match_ignore_case): Change to use length argument. Adjust users accordingly. * lisp.h (fast_c_string_match_ignore_case): Adjust prototype.
Diffstat (limited to 'src/font.c')
-rw-r--r--src/font.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/font.c b/src/font.c
index 27abbe25786..bbfda984a4d 100644
--- a/src/font.c
+++ b/src/font.c
@@ -1199,7 +1199,7 @@ font_parse_xlfd (char *name, ptrdiff_t len, Lisp_Object font)
1199 length), and return the name length. If FONT_SIZE_INDEX of FONT is 1199 length), and return the name length. If FONT_SIZE_INDEX of FONT is
1200 0, use PIXEL_SIZE instead. */ 1200 0, use PIXEL_SIZE instead. */
1201 1201
1202int 1202ptrdiff_t
1203font_unparse_xlfd (Lisp_Object font, int pixel_size, char *name, int nbytes) 1203font_unparse_xlfd (Lisp_Object font, int pixel_size, char *name, int nbytes)
1204{ 1204{
1205 char *p; 1205 char *p;
@@ -2642,15 +2642,18 @@ font_delete_unmatched (Lisp_Object vec, Lisp_Object spec, int size)
2642 if (! NILP (Vface_ignored_fonts)) 2642 if (! NILP (Vface_ignored_fonts))
2643 { 2643 {
2644 char name[256]; 2644 char name[256];
2645 ptrdiff_t namelen;
2645 Lisp_Object tail, regexp; 2646 Lisp_Object tail, regexp;
2646 2647
2647 if (font_unparse_xlfd (entity, 0, name, 256) >= 0) 2648 namelen = font_unparse_xlfd (entity, 0, name, 256);
2649 if (namelen >= 0)
2648 { 2650 {
2649 for (tail = Vface_ignored_fonts; CONSP (tail); tail = XCDR (tail)) 2651 for (tail = Vface_ignored_fonts; CONSP (tail); tail = XCDR (tail))
2650 { 2652 {
2651 regexp = XCAR (tail); 2653 regexp = XCAR (tail);
2652 if (STRINGP (regexp) 2654 if (STRINGP (regexp)
2653 && fast_c_string_match_ignore_case (regexp, name) >= 0) 2655 && fast_c_string_match_ignore_case (regexp, name,
2656 namelen) >= 0)
2654 break; 2657 break;
2655 } 2658 }
2656 if (CONSP (tail)) 2659 if (CONSP (tail))