aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenichi Handa2008-05-23 02:24:31 +0000
committerKenichi Handa2008-05-23 02:24:31 +0000
commitdbf46ba612e54e24f0b619013b3a40b3d2ba9d84 (patch)
tree7ede4e62918f8ebf2b470d289bcc9e0d60d98a4f /src
parentde24e3eb5175b2441778f8ce5f12937f8892cb0c (diff)
downloademacs-dbf46ba612e54e24f0b619013b3a40b3d2ba9d84.tar.gz
emacs-dbf46ba612e54e24f0b619013b3a40b3d2ba9d84.zip
Delete unused variables and add casting for char *
throughout the file. (fontset_font): Try the fallback fonts of the current fontset before consulting the default fontset.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog12
-rw-r--r--src/fontset.c60
2 files changed, 41 insertions, 31 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 2536edb971e..9d457989376 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,15 @@
12008-05-23 Kenichi Handa <handa@m17n.org>
2
3 * fontset.c: Delete unused variables and add casting for char *
4 throughout the file.
5 (fontset_font): Try the fallback fonts of the current fontset
6 before consulting the default fontset.
7
8 * ftfont.c (ftfont_spec_pattern): Free charset if necessary.
9
10 * xfont.c (xfont_list_pattern): Free names returned from
11 XListFonts.
12
12008-05-22 Jason Rumney <jasonr@gnu.org> 132008-05-22 Jason Rumney <jasonr@gnu.org>
2 14
3 * font.c: Don't include strings.h. 15 * font.c: Don't include strings.h.
diff --git a/src/fontset.c b/src/fontset.c
index 59929c0b4a7..264be229f38 100644
--- a/src/fontset.c
+++ b/src/fontset.c
@@ -578,7 +578,7 @@ fontset_find_font (fontset, c, face, id, fallback)
578 /* Find the first available font in the vector of RFONT-DEF. */ 578 /* Find the first available font in the vector of RFONT-DEF. */
579 for (; i < ASIZE (vec); i++) 579 for (; i < ASIZE (vec); i++)
580 { 580 {
581 Lisp_Object font_def, font_entity, font_object; 581 Lisp_Object font_entity, font_object;
582 582
583 elt = AREF (vec, i); 583 elt = AREF (vec, i);
584 if (NILP (elt)) 584 if (NILP (elt))
@@ -683,25 +683,26 @@ fontset_font (fontset, c, face, id)
683 return rfont_def; 683 return rfont_def;
684 if (EQ (rfont_def, Qt)) 684 if (EQ (rfont_def, Qt))
685 return Qnil; 685 return Qnil;
686 base_fontset = FONTSET_BASE (fontset);
687 /* Try a font-group for C of the default fontset. */
688 if (! EQ (base_fontset, Vdefault_fontset))
689 {
690 if (NILP (FONTSET_DEFAULT (fontset)))
691 FONTSET_DEFAULT (fontset)
692 = make_fontset (FONTSET_FRAME (fontset), Qnil, Vdefault_fontset);
693 rfont_def = fontset_find_font (FONTSET_DEFAULT (fontset), c, face, id, 0);
694 if (VECTORP (rfont_def))
695 return (rfont_def);
696 }
697
698 /* Try a fallback font-group. */ 686 /* Try a fallback font-group. */
699 rfont_def = fontset_find_font (fontset, c, face, id, 1); 687 rfont_def = fontset_find_font (fontset, c, face, id, 1);
700 if (! VECTORP (rfont_def) 688 if (VECTORP (rfont_def))
701 && ! EQ (base_fontset, Vdefault_fontset)) 689 return rfont_def;
702 /* Try a fallback font-group of the default fontset . */ 690 if (EQ (rfont_def, Qt))
703 rfont_def = fontset_find_font (FONTSET_DEFAULT (fontset), c, face, id, 1); 691 return Qnil;
704 692
693 base_fontset = FONTSET_BASE (fontset);
694 if (EQ (base_fontset, Vdefault_fontset))
695 return Qnil;
696
697 /* Try a font-group for C of the default fontset. */
698 if (NILP (FONTSET_DEFAULT (fontset)))
699 FONTSET_DEFAULT (fontset)
700 = make_fontset (FONTSET_FRAME (fontset), Qnil, Vdefault_fontset);
701 rfont_def = fontset_find_font (FONTSET_DEFAULT (fontset), c, face, id, 0);
702 if (VECTORP (rfont_def))
703 return rfont_def;
704 /* Try a fallback font-group of the default fontset . */
705 rfont_def = fontset_find_font (FONTSET_DEFAULT (fontset), c, face, id, 1);
705 if (! VECTORP (rfont_def)) 706 if (! VECTORP (rfont_def))
706 /* Remeber that we have no font for C. */ 707 /* Remeber that we have no font for C. */
707 FONTSET_SET (fontset, make_number (c), Qt); 708 FONTSET_SET (fontset, make_number (c), Qt);
@@ -972,7 +973,7 @@ make_fontset_for_ascii_face (f, base_fontset_id, face)
972 the corresponding regular expression. */ 973 the corresponding regular expression. */
973static Lisp_Object Vcached_fontset_data; 974static Lisp_Object Vcached_fontset_data;
974 975
975#define CACHED_FONTSET_NAME (SDATA (XCAR (Vcached_fontset_data))) 976#define CACHED_FONTSET_NAME ((char *) SDATA (XCAR (Vcached_fontset_data)))
976#define CACHED_FONTSET_REGEX (XCDR (Vcached_fontset_data)) 977#define CACHED_FONTSET_REGEX (XCDR (Vcached_fontset_data))
977 978
978/* If fontset name PATTERN contains any wild card, return regular 979/* If fontset name PATTERN contains any wild card, return regular
@@ -982,13 +983,13 @@ static Lisp_Object
982fontset_pattern_regexp (pattern) 983fontset_pattern_regexp (pattern)
983 Lisp_Object pattern; 984 Lisp_Object pattern;
984{ 985{
985 if (!index (SDATA (pattern), '*') 986 if (!index ((char *) SDATA (pattern), '*')
986 && !index (SDATA (pattern), '?')) 987 && !index ((char *) SDATA (pattern), '?'))
987 /* PATTERN does not contain any wild cards. */ 988 /* PATTERN does not contain any wild cards. */
988 return Qnil; 989 return Qnil;
989 990
990 if (!CONSP (Vcached_fontset_data) 991 if (!CONSP (Vcached_fontset_data)
991 || strcmp (SDATA (pattern), CACHED_FONTSET_NAME)) 992 || strcmp ((char *) SDATA (pattern), CACHED_FONTSET_NAME))
992 { 993 {
993 /* We must at first update the cached data. */ 994 /* We must at first update the cached data. */
994 unsigned char *regex, *p0, *p1; 995 unsigned char *regex, *p0, *p1;
@@ -1029,8 +1030,8 @@ fontset_pattern_regexp (pattern)
1029 *p1++ = '$'; 1030 *p1++ = '$';
1030 *p1++ = 0; 1031 *p1++ = 0;
1031 1032
1032 Vcached_fontset_data = Fcons (build_string (SDATA (pattern)), 1033 Vcached_fontset_data = Fcons (build_string ((char *) SDATA (pattern)),
1033 build_string (regex)); 1034 build_string ((char *) regex));
1034 } 1035 }
1035 1036
1036 return CACHED_FONTSET_REGEX; 1037 return CACHED_FONTSET_REGEX;
@@ -1145,7 +1146,7 @@ list_fontsets (f, pattern, size)
1145 1146
1146 if (STRINGP (regexp) 1147 if (STRINGP (regexp)
1147 ? (fast_string_match (regexp, name) < 0) 1148 ? (fast_string_match (regexp, name) < 0)
1148 : strcmp (SDATA (pattern), SDATA (name))) 1149 : strcmp ((char *) SDATA (pattern), (char *) SDATA (name)))
1149 continue; 1150 continue;
1150 1151
1151 val = Fcons (Fcopy_sequence (FONTSET_NAME (fontset)), val); 1152 val = Fcons (Fcopy_sequence (FONTSET_NAME (fontset)), val);
@@ -1253,11 +1254,10 @@ generate_ascii_font_name (name, ascii_spec)
1253 Lisp_Object name, ascii_spec; 1254 Lisp_Object name, ascii_spec;
1254{ 1255{
1255 Lisp_Object font_spec = Ffont_spec (0, NULL); 1256 Lisp_Object font_spec = Ffont_spec (0, NULL);
1256 Lisp_Object vec;
1257 int i; 1257 int i;
1258 char xlfd[256]; 1258 char xlfd[256];
1259 1259
1260 if (font_parse_xlfd (SDATA (name), font_spec) < 0) 1260 if (font_parse_xlfd ((char *) SDATA (name), font_spec) < 0)
1261 error ("Not an XLFD font name: %s", SDATA (name)); 1261 error ("Not an XLFD font name: %s", SDATA (name));
1262 for (i = FONT_FOUNDRY_INDEX; i < FONT_EXTRA_INDEX; i++) 1262 for (i = FONT_FOUNDRY_INDEX; i < FONT_EXTRA_INDEX; i++)
1263 if (! NILP (AREF (ascii_spec, i))) 1263 if (! NILP (AREF (ascii_spec, i)))
@@ -1519,7 +1519,6 @@ FONT-SPEC is a vector, a cons, or a string. See the documentation of
1519 Lisp_Object name, fontlist; 1519 Lisp_Object name, fontlist;
1520{ 1520{
1521 Lisp_Object fontset; 1521 Lisp_Object fontset;
1522 Lisp_Object val;
1523 int id; 1522 int id;
1524 1523
1525 CHECK_STRING (name); 1524 CHECK_STRING (name);
@@ -1534,10 +1533,10 @@ FONT-SPEC is a vector, a cons, or a string. See the documentation of
1534 char xlfd[256]; 1533 char xlfd[256];
1535 int len; 1534 int len;
1536 1535
1537 if (font_parse_xlfd (SDATA (name), font_spec) < 0) 1536 if (font_parse_xlfd ((char *) SDATA (name), font_spec) < 0)
1538 error ("Fontset name must be in XLFD format"); 1537 error ("Fontset name must be in XLFD format");
1539 short_name = AREF (font_spec, FONT_REGISTRY_INDEX); 1538 short_name = AREF (font_spec, FONT_REGISTRY_INDEX);
1540 if (strncmp (SDATA (SYMBOL_NAME (short_name)), "fontset-", 8) 1539 if (strncmp ((char *) SDATA (SYMBOL_NAME (short_name)), "fontset-", 8)
1541 || SBYTES (SYMBOL_NAME (short_name)) < 9) 1540 || SBYTES (SYMBOL_NAME (short_name)) < 9)
1542 error ("Registry field of fontset name must be \"fontset-*\""); 1541 error ("Registry field of fontset name must be \"fontset-*\"");
1543 Vfontset_alias_alist = Fcons (Fcons (name, SYMBOL_NAME (short_name)), 1542 Vfontset_alias_alist = Fcons (Fcons (name, SYMBOL_NAME (short_name)),
@@ -1654,7 +1653,7 @@ If the named font is not yet loaded, return nil. */)
1654 CHECK_LIVE_FRAME (frame); 1653 CHECK_LIVE_FRAME (frame);
1655 f = XFRAME (frame); 1654 f = XFRAME (frame);
1656 1655
1657 font_object = font_open_by_name (f, SDATA (name)); 1656 font_object = font_open_by_name (f, (char *) SDATA (name));
1658 if (NILP (font_object)) 1657 if (NILP (font_object))
1659 return Qnil; 1658 return Qnil;
1660 font = XFONT_OBJECT (font_object); 1659 font = XFONT_OBJECT (font_object);
@@ -1710,7 +1709,6 @@ DEFUN ("internal-char-font", Finternal_char_font, Sinternal_char_font, 1, 2, 0,
1710 int c; 1709 int c;
1711 struct frame *f; 1710 struct frame *f;
1712 struct face *face; 1711 struct face *face;
1713 Lisp_Object rfont_def;
1714 int cs_id; 1712 int cs_id;
1715 1713
1716 if (NILP (position)) 1714 if (NILP (position))