Setter macros for fontsets.
[bpt/emacs.git] / src / fontset.c
index 891a89f..f9b6e81 100644 (file)
@@ -1,6 +1,6 @@
 /* Fontset handler.
 
-Copyright (C) 2001-2011  Free Software Foundation, Inc.
+Copyright (C) 2001-2012  Free Software Foundation, Inc.
 Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
   2005, 2006, 2007, 2008, 2009, 2010, 2011
   National Institute of Advanced Industrial Science and Technology (AIST)
@@ -24,16 +24,14 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
-/* #define FONTSET_DEBUG */
-
 #include <config.h>
 #include <stdio.h>
 #include <setjmp.h>
 
 #include "lisp.h"
 #include "blockinput.h"
-#include "buffer.h"
 #include "character.h"
+#include "buffer.h"
 #include "charset.h"
 #include "ccl.h"
 #include "keyboard.h"
@@ -55,13 +53,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "font.h"
 
-#undef xassert
-#ifdef FONTSET_DEBUG
-#define xassert(X)     do {if (!(X)) abort ();} while (0)
-#else   /* not FONTSET_DEBUG */
-#define xassert(X)     (void) 0
-#endif /* not FONTSET_DEBUG */
-
 /* FONTSET
 
    A fontset is a collection of font related information to give
@@ -166,7 +157,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
    These structures are hidden from the other codes than this file.
    The other codes handle fontsets only by their ID numbers.  They
    usually use the variable name `fontset' for IDs.  But, in this
-   file, we always use varialbe name `id' for IDs, and name `fontset'
+   file, we always use variable name `id' for IDs, and name `fontset'
    for an actual fontset object, i.e., char-table.
 
 */
@@ -206,9 +197,8 @@ static void accumulate_script_ranges (Lisp_Object, Lisp_Object,
                                       Lisp_Object);
 static void set_fontset_font (Lisp_Object, Lisp_Object);
 
-#ifdef FONTSET_DEBUG
-
-/* Return 1 if ID is a valid fontset id, else return 0.  */
+/* Return 1 if ID is a valid fontset id, else return 0.
+   Optimized away if ENABLE_CHECKING is not defined.  */
 
 static int
 fontset_id_valid_p (int id)
@@ -216,8 +206,6 @@ fontset_id_valid_p (int id)
   return (id >= 0 && id < ASIZE (Vfontset_table) - 1);
 }
 
-#endif
-
 
 \f
 /********** MACROS AND FUNCTIONS TO HANDLE FONTSET **********/
@@ -226,26 +214,46 @@ fontset_id_valid_p (int id)
 #define FONTSET_FROM_ID(id) AREF (Vfontset_table, id)
 
 /* Macros to access special values of FONTSET.  */
-#define FONTSET_ID(fontset)            XCHAR_TABLE (fontset)->extras[0]
+
+#define FONTSET_ID(fontset) XCHAR_TABLE (fontset)->extras[0]
+#define SET_FONTSET_ID(fontset, id)            \
+  set_char_table_extras ((fontset), 0, (id))
 
 /* Macros to access special values of (base) FONTSET.  */
-#define FONTSET_NAME(fontset)          XCHAR_TABLE (fontset)->extras[1]
-#define FONTSET_ASCII(fontset)         XCHAR_TABLE (fontset)->extras[4]
-/* #define FONTSET_SPEC(fontset)       XCHAR_TABLE (fontset)->extras[5] */
+
+#define FONTSET_NAME(fontset) XCHAR_TABLE (fontset)->extras[1]
+#define SET_FONTSET_NAME(fontset, name)                \
+  set_char_table_extras ((fontset), 1, (name))
+
+#define FONTSET_ASCII(fontset) XCHAR_TABLE (fontset)->extras[4]
+#define SET_FONTSET_ASCII(fontset, ascii)      \
+  set_char_table_extras ((fontset), 4, (ascii))
 
 /* Macros to access special values of (realized) FONTSET.  */
-#define FONTSET_BASE(fontset)          XCHAR_TABLE (fontset)->extras[2]
-#define FONTSET_FRAME(fontset)         XCHAR_TABLE (fontset)->extras[3]
-/* #define FONTSET_OBJLIST(fontset)    XCHAR_TABLE (fontset)->extras[4] */
-#define FONTSET_NOFONT_FACE(fontset)   XCHAR_TABLE (fontset)->extras[5]
-/* #define FONTSET_REPERTORY(fontset)  XCHAR_TABLE (fontset)->extras[6] */
-#define FONTSET_DEFAULT(fontset)       XCHAR_TABLE (fontset)->extras[7]
+
+#define FONTSET_BASE(fontset) XCHAR_TABLE (fontset)->extras[2]
+#define SET_FONTSET_BASE(fontset, base)                \
+  set_char_table_extras ((fontset), 2, (base))
+
+#define FONTSET_FRAME(fontset) XCHAR_TABLE (fontset)->extras[3]
+#define SET_FONTSET_FRAME(fontset, frame)      \
+  set_char_table_extras ((fontset), 3, (frame))
+
+#define FONTSET_NOFONT_FACE(fontset) XCHAR_TABLE (fontset)->extras[5]
+#define SET_FONTSET_NOFONT_FACE(fontset, face) \
+  set_char_table_extras ((fontset), 5, (face))
+
+#define FONTSET_DEFAULT(fontset) XCHAR_TABLE (fontset)->extras[7]
+#define SET_FONTSET_DEFAULT(fontset, def)      \
+  set_char_table_extras ((fontset), 7, (def))
 
 /* For both base and realized fontset.  */
-#define FONTSET_FALLBACK(fontset)      XCHAR_TABLE (fontset)->extras[8]
 
-#define BASE_FONTSET_P(fontset)                (NILP (FONTSET_BASE (fontset)))
+#define FONTSET_FALLBACK(fontset) XCHAR_TABLE (fontset)->extras[8]
+#define SET_FONTSET_FALLBACK(fontset, fallback)                \
+  set_char_table_extras ((fontset), 8, (fallback))
 
+#define BASE_FONTSET_P(fontset) (NILP (FONTSET_BASE (fontset)))
 
 /* Macros for FONT-DEF and RFONT-DEF of fontset.  */
 #define FONT_DEF_NEW(font_def, font_spec, encoding, repertory) \
@@ -277,7 +285,7 @@ fontset_id_valid_p (int id)
 #define RFONT_DEF_NEW(rfont_def, font_def)             \
   do {                                                 \
     (rfont_def) = Fmake_vector (make_number (4), Qnil);        \
-    ASET ((rfont_def), 1, (font_def));         \
+    ASET ((rfont_def), 1, (font_def));                 \
     RFONT_DEF_SET_SCORE ((rfont_def), 0);              \
   } while (0)
 
@@ -319,12 +327,13 @@ fontset_ref (Lisp_Object fontset, int c)
    replace with ELT, if ADD is `prepend', prepend ELT, otherwise,
    append ELT.  */
 
-#define FONTSET_ADD(fontset, range, elt, add)                               \
-  (NILP (add)                                                               \
-   ? (NILP (range)                                                          \
-      ? (FONTSET_FALLBACK (fontset) = Fmake_vector (make_number (1), (elt))) \
-      : Fset_char_table_range ((fontset), (range),                          \
-                              Fmake_vector (make_number (1), (elt))))       \
+#define FONTSET_ADD(fontset, range, elt, add)                          \
+  (NILP (add)                                                          \
+   ? (NILP (range)                                                     \
+      ? (SET_FONTSET_FALLBACK                                          \
+        (fontset, Fmake_vector (make_number (1), (elt))))              \
+      : Fset_char_table_range ((fontset), (range),                     \
+                              Fmake_vector (make_number (1), (elt))))  \
    : fontset_add ((fontset), (range), (elt), (add)))
 
 static Lisp_Object
@@ -353,8 +362,8 @@ fontset_add (Lisp_Object fontset, Lisp_Object range, Lisp_Object elt, Lisp_Objec
   else
     {
       args[idx] = FONTSET_FALLBACK (fontset);
-      FONTSET_FALLBACK (fontset)
-       = NILP (args[idx]) ? args[1 - idx] : Fvconcat (2, args);
+      SET_FONTSET_FALLBACK
+       (fontset, NILP (args[idx]) ? args[1 - idx] : Fvconcat (2, args));
     }
   return Qnil;
 }
@@ -441,7 +450,7 @@ reorder_font_vector (Lisp_Object font_group, struct font *font)
     }
 
   if (score_changed)
-    qsort (XVECTOR (vec)->contents, size, sizeof (Lisp_Object),
+    qsort (XVECTOR (vec)->contents, size, word_size,
           fontset_compare_rfontdef);
   XSETCAR (font_group, make_number (charset_ordered_list_tick));
 }
@@ -459,7 +468,7 @@ fontset_get_font_group (Lisp_Object fontset, int c)
   Lisp_Object base_fontset;
   int from = 0, to = MAX_CHAR, i;
 
-  xassert (! BASE_FONTSET_P (fontset));
+  eassert (! BASE_FONTSET_P (fontset));
   if (c >= 0)
     font_group = CHAR_TABLE_REF (fontset, c);
   else
@@ -497,7 +506,7 @@ fontset_get_font_group (Lisp_Object fontset, int c)
   if (c >= 0)
     char_table_set_range (fontset, from, to, font_group);
   else
-    FONTSET_FALLBACK (fontset) = font_group;
+    SET_FONTSET_FALLBACK (fontset, font_group);
   return font_group;
 }
 
@@ -633,7 +642,7 @@ fontset_find_font (Lisp_Object fontset, int c, struct face *face, int id, int fa
            {
              /* Something strange happened, perhaps because of a
                 Font-backend problem.  Too avoid crashing, record
-                that this spec is unsable.  It may be better to find
+                that this spec is unusable.  It may be better to find
                 another font of the same spec, but currently we don't
                 have such an API.  */
              RFONT_DEF_SET_FACE (rfont_def, -1);
@@ -645,7 +654,7 @@ fontset_find_font (Lisp_Object fontset, int c, struct face *face, int id, int fa
       if (font_has_char (f, font_object, c))
        goto found;
 
-      /* Find a font already opened, maching with the current spec,
+      /* Find a font already opened, matching with the current spec,
         and supporting C. */
       font_def = RFONT_DEF_FONT_DEF (rfont_def);
       for (; found_index + 1 < ASIZE (vec); found_index++)
@@ -732,8 +741,9 @@ fontset_font (Lisp_Object fontset, int c, struct face *face, int id)
   if (! EQ (base_fontset, Vdefault_fontset))
     {
       if (NILP (FONTSET_DEFAULT (fontset)))
-       FONTSET_DEFAULT (fontset)
-         = make_fontset (FONTSET_FRAME (fontset), Qnil, Vdefault_fontset);
+       SET_FONTSET_DEFAULT
+         (fontset,
+          make_fontset (FONTSET_FRAME (fontset), Qnil, Vdefault_fontset));
       FONT_DEFERRED_LOG ("default fontset: font for", make_number (c), Qnil);
       default_rfont_def
        = fontset_find_font (FONTSET_DEFAULT (fontset), c, face, id, 0);
@@ -793,16 +803,14 @@ make_fontset (Lisp_Object frame, Lisp_Object name, Lisp_Object base)
 
   fontset = Fmake_char_table (Qfontset, Qnil);
 
-  FONTSET_ID (fontset) = make_number (id);
+  SET_FONTSET_ID (fontset, make_number (id));
   if (NILP (base))
-    {
-      FONTSET_NAME (fontset) = name;
-    }
+    SET_FONTSET_NAME (fontset, name);
   else
     {
-      FONTSET_NAME (fontset) = Qnil;
-      FONTSET_FRAME (fontset) = frame;
-      FONTSET_BASE (fontset) = base;
+      SET_FONTSET_NAME (fontset, Qnil);
+      SET_FONTSET_FRAME (fontset, frame);
+      SET_FONTSET_BASE (fontset, base);
     }
 
   ASET (Vfontset_table, id, fontset);
@@ -848,7 +856,7 @@ free_realized_fontset (FRAME_PTR f, Lisp_Object fontset)
   if (0)
     for (tail = FONTSET_OBJLIST (fontset); CONSP (tail); tail = XCDR (tail))
       {
-       xassert (FONT_OBJECT_P (XCAR (tail)));
+       eassert (FONT_OBJECT_P (XCAR (tail)));
        font_close_object (f, XCAR (tail));
       }
 #endif
@@ -865,8 +873,8 @@ free_face_fontset (FRAME_PTR f, struct face *face)
   fontset = FONTSET_FROM_ID (face->fontset);
   if (NILP (fontset))
     return;
-  xassert (! BASE_FONTSET_P (fontset));
-  xassert (f == XFRAME (FONTSET_FRAME (fontset)));
+  eassert (! BASE_FONTSET_P (fontset));
+  eassert (f == XFRAME (FONTSET_FRAME (fontset)));
   free_realized_fontset (f, fontset);
   ASET (Vfontset_table, face->fontset, Qnil);
   if (face->fontset < next_fontset_id)
@@ -876,8 +884,8 @@ free_face_fontset (FRAME_PTR f, struct face *face)
       int id = XINT (FONTSET_ID (FONTSET_DEFAULT (fontset)));
 
       fontset = AREF (Vfontset_table, id);
-      xassert (!NILP (fontset) && ! BASE_FONTSET_P (fontset));
-      xassert (f == XFRAME (FONTSET_FRAME (fontset)));
+      eassert (!NILP (fontset) && ! BASE_FONTSET_P (fontset));
+      eassert (f == XFRAME (FONTSET_FRAME (fontset)));
       free_realized_fontset (f, fontset);
       ASET (Vfontset_table, id, Qnil);
       if (id < next_fontset_id)
@@ -907,7 +915,7 @@ face_suitable_for_char_p (struct face *face, int c)
 
 
 /* Return ID of face suitable for displaying character C on frame F.
-   FACE must be reazlied for ASCII characters in advance.  Called from
+   FACE must be realized for ASCII characters in advance.  Called from
    the macro FACE_FOR_CHAR.  */
 
 int
@@ -924,9 +932,9 @@ face_for_char (FRAME_PTR f, struct face *face, int c, int pos, Lisp_Object objec
   if (ASCII_CHAR_P (c) || face->fontset < 0)
     return face->ascii_face->id;
 
-  xassert (fontset_id_valid_p (face->fontset));
+  eassert (fontset_id_valid_p (face->fontset));
   fontset = FONTSET_FROM_ID (face->fontset);
-  xassert (!BASE_FONTSET_P (fontset));
+  eassert (!BASE_FONTSET_P (fontset));
 
   if (pos < 0)
     {
@@ -970,10 +978,10 @@ face_for_char (FRAME_PTR f, struct face *face, int c, int pos, Lisp_Object objec
       else
        {
          face_id = face_for_font (f, Qnil, face);
-         FONTSET_NOFONT_FACE (fontset) = make_number (face_id);
+         SET_FONTSET_NOFONT_FACE (fontset, make_number (face_id));
        }
     }
-  xassert (face_id >= 0);
+  eassert (face_id >= 0);
   return face_id;
 }
 
@@ -992,9 +1000,9 @@ font_for_char (struct face *face, int c, int pos, Lisp_Object object)
       return font_object;
     }
 
-  xassert (fontset_id_valid_p (face->fontset));
+  eassert (fontset_id_valid_p (face->fontset));
   fontset = FONTSET_FROM_ID (face->fontset);
-  xassert (!BASE_FONTSET_P (fontset));
+  eassert (!BASE_FONTSET_P (fontset));
   if (pos < 0)
     {
       id = -1;
@@ -1039,8 +1047,7 @@ make_fontset_for_ascii_face (FRAME_PTR f, int base_fontset_id, struct face *face
       base_fontset = FONTSET_FROM_ID (base_fontset_id);
       if (!BASE_FONTSET_P (base_fontset))
        base_fontset = FONTSET_BASE (base_fontset);
-      if (! BASE_FONTSET_P (base_fontset))
-       abort ();
+      eassert (BASE_FONTSET_P (base_fontset));
     }
   else
     base_fontset = Vdefault_fontset;
@@ -1090,13 +1097,13 @@ fontset_pattern_regexp (Lisp_Object pattern)
            nescs++;
        }
 
-      /* If PATTERN is not full XLFD we conert "*" to ".*".  Otherwise
+      /* If PATTERN is not full XLFD we convert "*" to ".*".  Otherwise
         we convert "*" to "[^-]*" which is much faster in regular
         expression matching.  */
       if (ndashes < 14)
-       p1 = regex = (unsigned char *) alloca (SBYTES (pattern) + 2 * nstars + 2 * nescs + 1);
+       p1 = regex = alloca (SBYTES (pattern) + 2 * nstars + 2 * nescs + 1);
       else
-       p1 = regex = (unsigned char *) alloca (SBYTES (pattern) + 5 * nstars + 2 * nescs + 1);
+       p1 = regex = alloca (SBYTES (pattern) + 5 * nstars + 2 * nescs + 1);
 
       *p1++ = '^';
       for (p0 = SDATA (pattern); *p0; p0++)
@@ -1348,7 +1355,7 @@ accumulate_script_ranges (Lisp_Object arg, Lisp_Object range, Lisp_Object val)
 
    In FONTSET, set FONT_DEF in a fashion specified by ADD for
    characters in RANGE and ranges in SCRIPT_RANGE_LIST before RANGE.
-   The consumed ranges are poped up from SCRIPT_RANGE_LIST, and the
+   The consumed ranges are popped up from SCRIPT_RANGE_LIST, and the
    new SCRIPT_RANGE_LIST is stored in ARG.
 
    If ASCII is nil, don't set FONT_DEF for ASCII characters.  It is
@@ -1593,7 +1600,7 @@ appended.  By default, FONT-SPEC overrides the previous settings.  */)
       Lisp_Object tail, fr, alist;
       int fontset_id = XINT (FONTSET_ID (fontset));
 
-      FONTSET_ASCII (fontset) = fontname;
+      SET_FONTSET_ASCII (fontset, fontname);
       name = FONTSET_NAME (fontset);
       FOR_EACH_FRAME (tail, fr)
        {
@@ -1658,7 +1665,7 @@ FONT-SPEC is a vector, a cons, or a string.  See the documentation of
       char xlfd[256];
       int len;
 
-      if (font_parse_xlfd (SSDATA (name), font_spec) < 0)
+      if (font_parse_xlfd (SSDATA (name), SBYTES (name), font_spec) < 0)
        error ("Fontset name must be in XLFD format");
       short_name = AREF (font_spec, FONT_REGISTRY_INDEX);
       if (strncmp (SSDATA (SYMBOL_NAME (short_name)), "fontset-", 8)
@@ -1671,7 +1678,7 @@ FONT-SPEC is a vector, a cons, or a string.  See the documentation of
       len = font_unparse_xlfd (font_spec, 0, xlfd, 256);
       if (len < 0)
        error ("Invalid fontset name (perhaps too long): %s", SDATA (name));
-      FONTSET_ASCII (fontset) = make_unibyte_string (xlfd, len);
+      SET_FONTSET_ASCII (fontset, make_unibyte_string (xlfd, len));
     }
   else
     {
@@ -1680,11 +1687,11 @@ FONT-SPEC is a vector, a cons, or a string.  See the documentation of
       Fset_char_table_range (fontset, Qt, Qnil);
     }
 
-  for (; ! NILP (fontlist); fontlist = Fcdr (fontlist))
+  for (; CONSP (fontlist); fontlist = XCDR (fontlist))
     {
       Lisp_Object elt, script;
 
-      elt = Fcar (fontlist);
+      elt = XCAR (fontlist);
       script = Fcar (elt);
       elt = Fcdr (elt);
       if (CONSP (elt) && (NILP (XCDR (elt)) || CONSP (XCDR (elt))))
@@ -1704,7 +1711,7 @@ static Lisp_Object auto_fontset_alist;
 /* Number of automatically created fontsets.  */
 static ptrdiff_t num_auto_fontsets;
 
-/* Retun a fontset synthesized from FONT-OBJECT.  This is called from
+/* Return a fontset synthesized from FONT-OBJECT.  This is called from
    x_new_font when FONT-OBJECT is used for the default ASCII font of a
    frame, and the returned fontset is used for the default fontset of
    that frame.  The fontset specifies a font of the same registry as
@@ -1737,8 +1744,7 @@ fontset_from_font (Lisp_Object font_object)
   fontset_spec = copy_font_spec (font_spec);
   ASET (fontset_spec, FONT_REGISTRY_INDEX, alias);
   name = Ffont_xlfd_name (fontset_spec, Qnil);
-  if (NILP (name))
-    abort ();
+  eassert (!NILP (name));
   fontset = make_fontset (Qnil, name, Qnil);
   Vfontset_alias_alist = Fcons (Fcons (name, SYMBOL_NAME (alias)),
                                Vfontset_alias_alist);
@@ -1758,7 +1764,7 @@ fontset_from_font (Lisp_Object font_object)
     Fset_fontset_font (name, Qnil, font_spec, Qnil, Qnil);
   }
 
-  FONTSET_ASCII (fontset) = font_name;
+  SET_FONTSET_ASCII (fontset, font_name);
 
   return XINT (FONTSET_ID (fontset));
 }
@@ -1790,7 +1796,7 @@ update_auto_fontset_alist (Lisp_Object font_object, Lisp_Object fontset)
 /* Return a cons (FONT-OBJECT . GLYPH-CODE).
    FONT-OBJECT is the font for the character at POSITION in the current
    buffer.  This is computed from all the text properties and overlays
-   that apply to POSITION.  POSTION may be nil, in which case,
+   that apply to POSITION.  POSITION may be nil, in which case,
    FONT-SPEC is the font for displaying the character CH with the
    default face.
 
@@ -1905,8 +1911,7 @@ format is the same as above.  */)
 
   /* Recode fontsets realized on FRAME from the base fontset FONTSET
      in the table `realized'.  */
-  realized[0] = (Lisp_Object *) alloca (sizeof (Lisp_Object)
-                                       * ASIZE (Vfontset_table));
+  realized[0] = alloca (word_size * ASIZE (Vfontset_table));
   for (i = j = 0; i < ASIZE (Vfontset_table); i++)
     {
       elt = FONTSET_FROM_ID (i);
@@ -1917,8 +1922,7 @@ format is the same as above.  */)
     }
   realized[0][j] = Qnil;
 
-  realized[1] = (Lisp_Object *) alloca (sizeof (Lisp_Object)
-                                       * ASIZE (Vfontset_table));
+  realized[1] = alloca (word_size * ASIZE (Vfontset_table));
   for (i = j = 0; ! NILP (realized[0][i]); i++)
     {
       elt = FONTSET_DEFAULT (realized[0][i]);
@@ -1932,7 +1936,7 @@ format is the same as above.  */)
   if (!EQ (fontset, Vdefault_fontset))
     {
       tables[1] = Fmake_char_table (Qnil, Qnil);
-      XCHAR_TABLE (tables[0])->extras[0] = tables[1];
+      set_char_table_extras (tables[0], 0, tables[1]);
       fontsets[1] = Vdefault_fontset;
     }
 
@@ -1995,7 +1999,7 @@ format is the same as above.  */)
              if (c <= MAX_5_BYTE_CHAR)
                char_table_set_range (tables[k], c, to, alist);
              else
-               XCHAR_TABLE (tables[k])->defalt = alist;
+               set_char_table_defalt (tables[k], alist);
 
              /* At last, change each elements to font names.  */
              for (; CONSP (alist); alist = XCDR (alist))
@@ -2104,7 +2108,7 @@ DEFUN ("fontset-list", Ffontset_list, Sfontset_list, 0, 0, 0,
 }
 
 
-#ifdef FONTSET_DEBUG
+#ifdef ENABLE_CHECKING
 
 Lisp_Object dump_fontset (Lisp_Object) EXTERNALLY_VISIBLE;
 
@@ -2131,7 +2135,8 @@ dump_fontset (Lisp_Object fontset)
 
          if (FRAME_LIVE_P (f))
            ASET (vec, 1,
-                 Fcons (FONTSET_NAME (FONTSET_BASE (fontset)), f->name));
+                 Fcons (FONTSET_NAME (FONTSET_BASE (fontset)),
+                        f->name));
          else
            ASET (vec, 1,
                  Fcons (FONTSET_NAME (FONTSET_BASE (fontset)), Qnil));
@@ -2154,7 +2159,7 @@ DEFUN ("fontset-list-all", Ffontset_list_all, Sfontset_list_all, 0, 0, 0,
       val = Fcons (dump_fontset (AREF (Vfontset_table, i)), val);
   return (Fnreverse (val));
 }
-#endif /* FONTSET_DEBUG */
+#endif /* ENABLE_CHECKING */
 
 void
 syms_of_fontset (void)
@@ -2176,9 +2181,10 @@ syms_of_fontset (void)
 
   Vdefault_fontset = Fmake_char_table (Qfontset, Qnil);
   staticpro (&Vdefault_fontset);
-  FONTSET_ID (Vdefault_fontset) = make_number (0);
-  FONTSET_NAME (Vdefault_fontset)
-    = make_pure_c_string ("-*-*-*-*-*-*-*-*-*-*-*-*-fontset-default");
+  SET_FONTSET_ID (Vdefault_fontset, make_number (0));
+  SET_FONTSET_NAME 
+    (Vdefault_fontset,
+     build_pure_c_string ("-*-*-*-*-*-*-*-*-*-*-*-*-fontset-default"));
   ASET (Vfontset_table, 0, Vdefault_fontset);
   next_fontset_id = 1;
 
@@ -2224,12 +2230,12 @@ alternate fontnames (if any) are tried instead.  */);
   DEFVAR_LISP ("fontset-alias-alist", Vfontset_alias_alist,
               doc: /* Alist of fontset names vs the aliases.  */);
   Vfontset_alias_alist = Fcons (Fcons (FONTSET_NAME (Vdefault_fontset),
-                                      make_pure_c_string ("fontset-default")),
+                                      build_pure_c_string ("fontset-default")),
                                Qnil);
 
   DEFVAR_LISP ("vertical-centering-font-regexp",
               Vvertical_centering_font_regexp,
-              doc: /* *Regexp matching font names that require vertical centering on display.
+              doc: /* Regexp matching font names that require vertical centering on display.
 When a character is displayed with such fonts, the character is displayed
 at the vertical center of lines.  */);
   Vvertical_centering_font_regexp = Qnil;
@@ -2245,7 +2251,7 @@ at the vertical center of lines.  */);
   defsubr (&Sfontset_info);
   defsubr (&Sfontset_font);
   defsubr (&Sfontset_list);
-#ifdef FONTSET_DEBUG
+#ifdef ENABLE_CHECKING
   defsubr (&Sfontset_list_all);
 #endif
 }