Refill some copyright headers.
[bpt/emacs.git] / src / xfaces.c
index 9a6bbd1..9d3c592 100644 (file)
@@ -1,6 +1,8 @@
 /* xfaces.c -- "Face" primitives.
+
    Copyright (C) 1993, 1994, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-                 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+  2005, 2006, 2007, 2008, 2009, 2010, 2011
+  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -321,11 +323,6 @@ Lisp_Object QCreverse_video;
 Lisp_Object QCoverline, QCstrike_through, QCbox, QCinherit;
 Lisp_Object QCfontset;
 
-/* Keywords symbols used for font properties.  */
-extern Lisp_Object QCfoundry, QCadstyle, QCregistry;
-extern Lisp_Object QCspacing, QCsize, QCavgwidth;
-extern Lisp_Object Qp;
-
 /* Symbols used for attribute values.  */
 
 Lisp_Object Qnormal, Qbold, Qultra_light, Qextra_light, Qlight;
@@ -351,7 +348,6 @@ Lisp_Object Qframe_set_background_mode;
 Lisp_Object Qdefault, Qtool_bar, Qregion, Qfringe;
 Lisp_Object Qheader_line, Qscroll_bar, Qcursor, Qborder, Qmouse, Qmenu;
 Lisp_Object Qmode_line_inactive, Qvertical_border;
-extern Lisp_Object Qmode_line;
 
 /* The symbol `face-alias'.  A symbols having that property is an
    alias for another face.  Value of the property is the name of
@@ -359,8 +355,6 @@ extern Lisp_Object Qmode_line;
 
 Lisp_Object Qface_alias;
 
-extern Lisp_Object Qcircular_list;
-
 /* Default stipple pattern used on monochrome displays.  This stipple
    pattern is used on monochrome displays instead of shades of gray
    for a face background color.  See `set-face-stipple' for possible
@@ -411,7 +405,6 @@ Lisp_Object Qforeground_color, Qbackground_color;
 /* The symbols `face' and `mouse-face' used as text properties.  */
 
 Lisp_Object Qface;
-extern Lisp_Object Qmouse_face;
 
 /* Property for basic faces which other faces cannot inherit.  */
 
@@ -513,7 +506,6 @@ struct named_merge_point;
 static void map_tty_color (struct frame *, struct face *,
                            enum lface_attribute_index, int *);
 static Lisp_Object resolve_face_name (Lisp_Object, int);
-static int may_use_scalable_font_p (const char *);
 static void set_font_frame_param (Lisp_Object, Lisp_Object);
 static int get_lface_attributes (struct frame *, Lisp_Object, Lisp_Object *,
                                  int, struct named_merge_point *);
@@ -521,7 +513,7 @@ static int load_pixmap (struct frame *, Lisp_Object, unsigned *, unsigned *);
 static struct frame *frame_or_selected_frame (Lisp_Object, int);
 static void load_face_colors (struct frame *, struct face *, Lisp_Object *);
 static void free_face_colors (struct frame *, struct face *);
-static int face_color_gray_p (struct frame *, char *);
+static int face_color_gray_p (struct frame *, const char *);
 static struct face *realize_face (struct face_cache *, Lisp_Object *,
                                   int);
 static struct face *realize_non_ascii_face (struct frame *, Lisp_Object,
@@ -626,7 +618,7 @@ unregister_colors (pixels, n)
 
 DEFUN ("dump-colors", Fdump_colors, Sdump_colors, 0, 0, 0,
        doc: /* Dump currently allocated colors to stderr.  */)
-     ()
+  (void)
 {
   int i, n;
 
@@ -726,10 +718,7 @@ x_free_gc (struct frame *f, GC gc)
 /* W32 emulation of GCs */
 
 static INLINE GC
-x_create_gc (f, mask, xgcv)
-     struct frame *f;
-     unsigned long mask;
-     XGCValues *xgcv;
+x_create_gc (struct frame *f, unsigned long mask, XGCValues *xgcv)
 {
   GC gc;
   BLOCK_INPUT;
@@ -743,9 +732,7 @@ x_create_gc (f, mask, xgcv)
 /* Free GC which was used on frame F.  */
 
 static INLINE void
-x_free_gc (f, gc)
-     struct frame *f;
-     GC gc;
+x_free_gc (struct frame *f, GC gc)
 {
   IF_DEBUG (xassert (--ngcs >= 0));
   xfree (gc);
@@ -757,21 +744,18 @@ x_free_gc (f, gc)
 /* NS emulation of GCs */
 
 static INLINE GC
-x_create_gc (f, mask, xgcv)
-     struct frame *f;
-     unsigned long mask;
-     XGCValues *xgcv;
+x_create_gc (struct frame *f,
+             unsigned long mask,
+             XGCValues *xgcv)
 {
   GC gc = xmalloc (sizeof (*gc));
   if (gc)
-      bcopy (xgcv, gc, sizeof (XGCValues));
+    memcpy (gc, xgcv, sizeof (XGCValues));
   return gc;
 }
 
 static INLINE void
-x_free_gc (f, gc)
-     struct frame *f;
-     GC gc;
+x_free_gc (struct frame *f, GC gc)
 {
   xfree (gc);
 }
@@ -951,8 +935,7 @@ clear_face_cache (int clear_fonts_p)
 DEFUN ("clear-face-cache", Fclear_face_cache, Sclear_face_cache, 0, 1, 0,
        doc: /* Clear face caches on all frames.
 Optional THOROUGHLY non-nil means try to free unused fonts, too.  */)
-     (thoroughly)
-     Lisp_Object thoroughly;
+  (Lisp_Object thoroughly)
 {
   clear_face_cache (!NILP (thoroughly));
   ++face_change_count;
@@ -974,8 +957,7 @@ A bitmap specification is either a string, a file name, or a list
 HEIGHT is its height, and DATA is a string containing the bits of
 the pixmap.  Bits are stored row by row, each row occupies
 \(WIDTH + 7)/8 bytes.  */)
-     (object)
-     Lisp_Object object;
+  (Lisp_Object object)
 {
   int pixmap_p = 0;
 
@@ -1179,7 +1161,8 @@ tty_lookup_color (struct frame *f, Lisp_Object color, XColor *tty_color, XColor
 /* A version of defined_color for non-X frames.  */
 
 int
-tty_defined_color (struct frame *f, char *color_name, XColor *color_def, int alloc)
+tty_defined_color (struct frame *f, const char *color_name,
+                  XColor *color_def, int alloc)
 {
   int status = 1;
 
@@ -1214,7 +1197,7 @@ tty_defined_color (struct frame *f, char *color_name, XColor *color_def, int all
    This does the right thing for any type of frame.  */
 
 int
-defined_color (struct frame *f, char *color_name, XColor *color_def, int alloc)
+defined_color (struct frame *f, const char *color_name, XColor *color_def, int alloc)
 {
   if (!FRAME_WINDOW_P (f))
     return tty_defined_color (f, color_name, color_def, alloc);
@@ -1274,7 +1257,7 @@ tty_color_name (struct frame *f, int idx)
    The criterion implemented here is not a terribly sophisticated one.  */
 
 static int
-face_color_gray_p (struct frame *f, char *color_name)
+face_color_gray_p (struct frame *f, const char *color_name)
 {
   XColor color;
   int gray_p;
@@ -1301,7 +1284,7 @@ face_color_gray_p (struct frame *f, char *color_name)
    color.  */
 
 static int
-face_color_supported_p (struct frame *f, char *color_name, int background_p)
+face_color_supported_p (struct frame *f, const char *color_name, int background_p)
 {
   Lisp_Object frame;
   XColor not_used;
@@ -1327,8 +1310,7 @@ DEFUN ("color-gray-p", Fcolor_gray_p, Scolor_gray_p, 1, 2, 0,
        doc: /* Return non-nil if COLOR is a shade of gray (or white or black).
 FRAME specifies the frame and thus the display for interpreting COLOR.
 If FRAME is nil or omitted, use the selected frame.  */)
-     (color, frame)
-     Lisp_Object color, frame;
+  (Lisp_Object color, Lisp_Object frame)
 {
   struct frame *f;
 
@@ -1349,8 +1331,7 @@ BACKGROUND-P non-nil means COLOR is used as a background.
 Otherwise, this function tells whether it can be used as a foreground.
 If FRAME is nil or omitted, use the selected frame.
 COLOR must be a valid color name.  */)
-     (color, frame, background_p)
-     Lisp_Object frame, color, background_p;
+  (Lisp_Object color, Lisp_Object frame, Lisp_Object background_p)
 {
   struct frame *f;
 
@@ -1687,8 +1668,7 @@ FULL is the full name of the font, and REGISTRY-AND-ENCODING is a string
 giving the registry and encoding of the font.
 The result list is sorted according to the current setting of
 the face font sort order.  */)
-     (family, frame)
-     Lisp_Object family, frame;
+  (Lisp_Object family, Lisp_Object frame)
 {
   Lisp_Object font_spec, list, *drivers, vec;
   int i, nfonts, ndrivers;
@@ -1785,8 +1765,7 @@ fonts to match.  The first MAXIMUM fonts are reported.
 The optional fifth argument WIDTH, if specified, is a number of columns
 occupied by a character of a font.  In that case, return only fonts
 the WIDTH times as wide as FACE on FRAME.  */)
-     (pattern, face, frame, maximum, width)
-    Lisp_Object pattern, face, frame, maximum, width;
+  (Lisp_Object pattern, Lisp_Object face, Lisp_Object frame, Lisp_Object maximum, Lisp_Object width)
 {
   struct frame *f;
   int size, avgwidth;
@@ -2190,8 +2169,8 @@ get_lface_attributes_no_remap (struct frame *f, Lisp_Object face_name, Lisp_Obje
   lface = lface_from_face_name_no_resolve (f, face_name, signal_p);
 
   if (! NILP (lface))
-    bcopy (XVECTOR (lface)->contents, attrs,
-          LFACE_VECTOR_SIZE * sizeof *attrs);
+    memcpy (attrs, XVECTOR (lface)->contents,
+           LFACE_VECTOR_SIZE * sizeof *attrs);
 
   return !NILP (lface);
 }
@@ -2717,8 +2696,7 @@ If FACE was not known as a face before, create a new one.
 If optional argument FRAME is specified, make a frame-local face
 for that frame.  Otherwise operate on the global face definition.
 Value is a vector of face attributes.  */)
-     (face, frame)
-     Lisp_Object face, frame;
+  (Lisp_Object face, Lisp_Object frame)
 {
   Lisp_Object global_lface, lface;
   struct frame *f;
@@ -2806,8 +2784,7 @@ FACE should be a symbol or string.
 If optional second argument FRAME is non-nil, check for the
 existence of a frame-local face with name FACE on that frame.
 Otherwise check for the existence of a global face.  */)
-     (face, frame)
-     Lisp_Object face, frame;
+  (Lisp_Object face, Lisp_Object frame)
 {
   Lisp_Object lface;
 
@@ -2835,8 +2812,7 @@ definition of TO on NEW-FRAME.  If NEW-FRAME is nil,
 FRAME controls where the data is copied to.
 
 The value is TO.  */)
-     (from, to, frame, new_frame)
-     Lisp_Object from, to, frame, new_frame;
+  (Lisp_Object from, Lisp_Object to, Lisp_Object frame, Lisp_Object new_frame)
 {
   Lisp_Object lface, copy;
 
@@ -2861,8 +2837,8 @@ The value is TO.  */)
       copy = Finternal_make_lisp_face (to, new_frame);
     }
 
-  bcopy (XVECTOR (lface)->contents, XVECTOR (copy)->contents,
-        LFACE_VECTOR_SIZE * sizeof (Lisp_Object));
+  memcpy (XVECTOR (copy)->contents, XVECTOR (lface)->contents,
+         LFACE_VECTOR_SIZE * sizeof (Lisp_Object));
 
   /* Changing a named face means that all realized faces depending on
      that face are invalid.  Since we cannot tell which realized faces
@@ -2887,8 +2863,7 @@ FRAME nil means change the face of the selected frame.
 FRAME t means change the default for new frames.
 FRAME 0 means change the face on all frames, and change the default
   for new frames.  */)
-     (face, attr, value, frame)
-     Lisp_Object face, attr, value, frame;
+  (Lisp_Object face, Lisp_Object attr, Lisp_Object value, Lisp_Object frame)
 {
   Lisp_Object lface;
   Lisp_Object old_value = Qnil;
@@ -3514,8 +3489,7 @@ set_font_frame_param (Lisp_Object frame, Lisp_Object lface)
 
 DEFUN ("internal-face-x-get-resource", Finternal_face_x_get_resource,
        Sinternal_face_x_get_resource, 3, 3, 0, doc: /* */)
-     (resource, class, frame)
-     Lisp_Object resource, class, frame;
+  (Lisp_Object resource, Lisp_Object class, Lisp_Object frame)
 {
   Lisp_Object value = Qnil;
   CHECK_STRING (resource);
@@ -3560,8 +3534,7 @@ DEFUN ("internal-set-lisp-face-attribute-from-resource",
        Finternal_set_lisp_face_attribute_from_resource,
        Sinternal_set_lisp_face_attribute_from_resource,
        3, 4, 0, doc: /* */)
-     (face, attr, value, frame)
-     Lisp_Object face, attr, value, frame;
+  (Lisp_Object face, Lisp_Object attr, Lisp_Object value, Lisp_Object frame)
 {
   CHECK_SYMBOL (face);
   CHECK_SYMBOL (attr);
@@ -3611,8 +3584,7 @@ DEFUN ("internal-set-lisp-face-attribute-from-resource",
 /* Make menus on frame F appear as specified by the `menu' face.  */
 
 static void
-x_update_menu_appearance (f)
-     struct frame *f;
+x_update_menu_appearance (struct frame *f)
 {
   struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
   XrmDatabase rdb;
@@ -3685,8 +3657,6 @@ x_update_menu_appearance (f)
          if (! NILP (xlfd))
            {
 #if defined HAVE_X_I18N
-             extern char *xic_create_fontsetname
-                (char *base_fontname, Bool motif);
              char *fontsetname = xic_create_fontsetname (SDATA (xlfd), motif);
 #else
              char *fontsetname = (char *) SDATA (xlfd);
@@ -3722,8 +3692,7 @@ A relative value is one that doesn't entirely override whatever is
 inherited from another face.  For most possible attributes,
 the only relative value that users see is `unspecified'.
 However, for :height, floating point values are also relative.  */)
-     (attribute, value)
-     Lisp_Object attribute, value;
+  (Lisp_Object attribute, Lisp_Object value)
 {
   if (EQ (value, Qunspecified) || (EQ (value, Qignore_defface)))
     return Qt;
@@ -3738,8 +3707,7 @@ DEFUN ("merge-face-attribute", Fmerge_face_attribute, Smerge_face_attribute,
        doc: /* Return face ATTRIBUTE VALUE1 merged with VALUE2.
 If VALUE1 or VALUE2 are absolute (see `face-attribute-relative-p'), then
 the result will be absolute, otherwise it will be relative.  */)
-     (attribute, value1, value2)
-     Lisp_Object attribute, value1, value2;
+  (Lisp_Object attribute, Lisp_Object value1, Lisp_Object value2)
 {
   if (EQ (value1, Qunspecified) || EQ (value1, Qignore_defface))
     return value2;
@@ -3759,8 +3727,7 @@ face attribute name, signal an error.
 If the optional argument FRAME is given, report on face SYMBOL in that
 frame.  If FRAME is t, report on the defaults for face SYMBOL (for new
 frames).  If FRAME is omitted or nil, use the selected frame.  */)
-     (symbol, keyword, frame)
-     Lisp_Object symbol, keyword, frame;
+  (Lisp_Object symbol, Lisp_Object keyword, Lisp_Object frame)
 {
   Lisp_Object lface, value = Qnil;
 
@@ -3827,8 +3794,7 @@ DEFUN ("internal-lisp-face-attribute-values",
        Sinternal_lisp_face_attribute_values, 1, 1, 0,
        doc: /* Return a list of valid discrete values for face attribute ATTR.
 Value is nil if ATTR doesn't have a discrete set of valid values.  */)
-     (attr)
-     Lisp_Object attr;
+  (Lisp_Object attr)
 {
   Lisp_Object result = Qnil;
 
@@ -3851,8 +3817,7 @@ DEFUN ("internal-merge-in-global-face", Finternal_merge_in_global_face,
        Sinternal_merge_in_global_face, 2, 2, 0,
        doc: /* Add attributes from frame-default definition of FACE to FACE on FRAME.
 Default face attributes override any local face attributes.  */)
-     (face, frame)
-     Lisp_Object face, frame;
+  (Lisp_Object face, Lisp_Object frame)
 {
   int i;
   Lisp_Object global_lface, local_lface, *gvec, *lvec;
@@ -3890,9 +3855,9 @@ Default face attributes override any local face attributes.  */)
        {
          /* Ensure that the face vector is fully specified by merging
             the previously-cached vector.  */
-         bcopy (oldface->lface, attrs, sizeof attrs);
+         memcpy (attrs, oldface->lface, sizeof attrs);
          merge_face_vectors (f, lvec, attrs, 0);
-         bcopy (attrs, lvec, sizeof attrs);
+         memcpy (lvec, attrs, sizeof attrs);
          newface = realize_face (c, lvec, DEFAULT_FACE_ID);
 
          if ((! UNSPECIFIEDP (gvec[LFACE_FAMILY_INDEX])
@@ -3930,8 +3895,7 @@ If FRAME is t, report on the defaults for face FACE (for new frames).
 If FRAME is omitted or nil, use the selected frame.  And, in this case,
 if the optional third argument CHARACTER is given,
 return the font name used for CHARACTER.  */)
-     (face, frame, character)
-     Lisp_Object face, frame, character;
+  (Lisp_Object face, Lisp_Object frame, Lisp_Object character)
 {
   if (EQ (frame, Qt))
     {
@@ -3997,7 +3961,7 @@ face_attr_equal_p (Lisp_Object v1, Lisp_Object v2)
       if (SBYTES (v1) != SBYTES (v2))
        return 0;
 
-      return bcmp (SDATA (v1), SDATA (v2), SBYTES (v1)) == 0;
+      return memcmp (SDATA (v1), SDATA (v2), SBYTES (v1)) == 0;
 
     case_Lisp_Int:
     case Lisp_Symbol:
@@ -4031,8 +3995,7 @@ DEFUN ("internal-lisp-face-equal-p", Finternal_lisp_face_equal_p,
 If the optional argument FRAME is given, report on FACE1 and FACE2 in that frame.
 If FRAME is t, report on the defaults for FACE1 and FACE2 (for new frames).
 If FRAME is omitted or nil, use the selected frame.  */)
-     (face1, face2, frame)
-     Lisp_Object face1, face2, frame;
+  (Lisp_Object face1, Lisp_Object face2, Lisp_Object frame)
 {
   int equal_p;
   struct frame *f;
@@ -4061,8 +4024,7 @@ DEFUN ("internal-lisp-face-empty-p", Finternal_lisp_face_empty_p,
 If the optional argument FRAME is given, report on face FACE in that frame.
 If FRAME is t, report on the defaults for face FACE (for new frames).
 If FRAME is omitted or nil, use the selected frame.  */)
-     (face, frame)
-     Lisp_Object face, frame;
+  (Lisp_Object face, Lisp_Object frame)
 {
   struct frame *f;
   Lisp_Object lface;
@@ -4090,8 +4052,7 @@ DEFUN ("frame-face-alist", Fframe_face_alist, Sframe_face_alist,
        0, 1, 0,
        doc: /* Return an alist of frame-local faces defined on FRAME.
 For internal use only.  */)
-     (frame)
-     Lisp_Object frame;
+  (Lisp_Object frame)
 {
   struct frame *f = frame_or_selected_frame (frame, 0);
   return f->face_alist;
@@ -4169,9 +4130,9 @@ static struct face *
 make_realized_face (Lisp_Object *attr)
 {
   struct face *face = (struct face *) xmalloc (sizeof *face);
-  bzero (face, sizeof *face);
+  memset (face, 0, sizeof *face);
   face->ascii_face = face;
-  bcopy (attr, face->lface, sizeof face->lface);
+  memcpy (face->lface, attr, sizeof face->lface);
   return face;
 }
 
@@ -4281,8 +4242,7 @@ DEFUN ("color-distance", Fcolor_distance, Scolor_distance, 2, 3, 0,
 COLOR1 and COLOR2 may be either strings containing the color name,
 or lists of the form (RED GREEN BLUE).
 If FRAME is unspecified or nil, the current frame is used.  */)
-     (color1, color2, frame)
-     Lisp_Object color1, color2, frame;
+  (Lisp_Object color1, Lisp_Object color2, Lisp_Object frame)
 {
   struct frame *f;
   XColor cdef1, cdef2;
@@ -4316,10 +4276,10 @@ make_face_cache (struct frame *f)
   int size;
 
   c = (struct face_cache *) xmalloc (sizeof *c);
-  bzero (c, sizeof *c);
+  memset (c, 0, sizeof *c);
   size = FACE_CACHE_BUCKETS_SIZE * sizeof *c->buckets;
   c->buckets = (struct face **) xmalloc (size);
-  bzero (c->buckets, size);
+  memset (c->buckets, 0, size);
   c->size = 50;
   c->faces_by_id = (struct face **) xmalloc (c->size * sizeof *c->faces_by_id);
   c->f = f;
@@ -4383,7 +4343,7 @@ free_realized_faces (struct face_cache *c)
 
       c->used = 0;
       size = FACE_CACHE_BUCKETS_SIZE * sizeof *c->buckets;
-      bzero (c->buckets, size);
+      memset (c->buckets, 0, size);
 
       /* Must do a thorough redisplay the next time.  Mark current
         matrices as invalid because they will reference faces freed
@@ -4580,7 +4540,7 @@ uncache_face (struct face_cache *c, struct face *face)
    Value is the ID of the face found.  If no suitable face is found,
    realize a new one.  */
 
-INLINE int
+static INLINE int
 lookup_face (struct frame *f, Lisp_Object *attr)
 {
   struct face_cache *cache = FRAME_FACE_CACHE (f);
@@ -4680,7 +4640,7 @@ lookup_named_face (struct frame *f, Lisp_Object symbol, int signal_p)
   if (! get_lface_attributes (f, symbol, symbol_attrs, signal_p, 0))
     return -1;
 
-  bcopy (default_face->lface, attrs, sizeof attrs);
+  memcpy (attrs, default_face->lface, sizeof attrs);
   merge_face_vectors (f, symbol_attrs, attrs, 0);
 
   return lookup_face (f, attrs);
@@ -4781,7 +4741,7 @@ smaller_face (struct frame *f, int face_id, int steps)
   steps = eabs (steps);
 
   face = FACE_FROM_ID (f, face_id);
-  bcopy (face->lface, attrs, sizeof attrs);
+  memcpy (attrs, face->lface, sizeof attrs);
   pt = last_pt = XFASTINT (attrs[LFACE_HEIGHT_INDEX]);
   new_face_id = face_id;
   last_height = FONT_HEIGHT (face->font);
@@ -4832,7 +4792,7 @@ face_with_height (struct frame *f, int face_id, int height)
     return face_id;
 
   face = FACE_FROM_ID (f, face_id);
-  bcopy (face->lface, attrs, sizeof attrs);
+  memcpy (attrs, face->lface, sizeof attrs);
   attrs[LFACE_HEIGHT_INDEX] = make_number (height);
   font_clear_prop (attrs, FONT_SIZE_INDEX);
   face_id = lookup_face (f, attrs);
@@ -4862,7 +4822,7 @@ lookup_derived_face (struct frame *f, Lisp_Object symbol, int face_id, int signa
   if (!get_lface_attributes (f, symbol, symbol_attrs, signal_p, 0))
     return -1;
 
-  bcopy (default_face->lface, attrs, sizeof attrs);
+  memcpy (attrs, default_face->lface, sizeof attrs);
   merge_face_vectors (f, symbol_attrs, attrs, 0);
   return lookup_face (f, attrs);
 }
@@ -4870,8 +4830,7 @@ lookup_derived_face (struct frame *f, Lisp_Object symbol, int face_id, int signa
 DEFUN ("face-attributes-as-vector", Fface_attributes_as_vector,
        Sface_attributes_as_vector, 1, 1, 0,
        doc: /* Return a vector of face attributes corresponding to PLIST.  */)
-     (plist)
-     Lisp_Object plist;
+  (Lisp_Object plist)
 {
   Lisp_Object lface;
   lface = Fmake_vector (make_number (LFACE_VECTOR_SIZE),
@@ -4953,7 +4912,7 @@ x_supports_face_attributes_p (struct frame *f, Lisp_Object *attrs, struct face *
       Lisp_Object merged_attrs[LFACE_VECTOR_SIZE];
       int i;
 
-      bcopy (def_attrs, merged_attrs, sizeof merged_attrs);
+      memcpy (merged_attrs, def_attrs, sizeof merged_attrs);
 
       merge_face_vectors (f, attrs, merged_attrs, 0);
 
@@ -5188,8 +5147,7 @@ any display that can display bold, and a `:foreground \"yellow\"' as long
 as it can display a yellowish color, but `:slant italic' will _not_ be
 satisfied by the tty display code's automatic substitution of a `dim'
 face for italic.  */)
-  (attributes, display)
-     Lisp_Object attributes, display;
+  (Lisp_Object attributes, Lisp_Object display)
 {
   int supports = 0, i;
   Lisp_Object frame;
@@ -5266,15 +5224,14 @@ first in ORDER are matched first, e.g. if `:height' appears before
 `:weight' in ORDER, font selection first tries to find a font with
 a suitable height, and then tries to match the font weight.
 Value is ORDER.  */)
-     (order)
-     Lisp_Object order;
+  (Lisp_Object order)
 {
   Lisp_Object list;
   int i;
   int indices[DIM (font_sort_order)];
 
   CHECK_LIST (order);
-  bzero (indices, sizeof indices);
+  memset (indices, 0, sizeof indices);
   i = 0;
 
   for (list = order;
@@ -5306,9 +5263,9 @@ Value is ORDER.  */)
     if (indices[i] == 0)
       signal_error ("Invalid font sort order", order);
 
-  if (bcmp (indices, font_sort_order, sizeof indices) != 0)
+  if (memcmp (indices, font_sort_order, sizeof indices) != 0)
     {
-      bcopy (indices, font_sort_order, sizeof font_sort_order);
+      memcpy (font_sort_order, indices, sizeof font_sort_order);
       free_all_realized_faces (Qnil);
     }
 
@@ -5325,8 +5282,7 @@ DEFUN ("internal-set-alternative-font-family-alist",
 ALIST is an alist of (FAMILY ALTERNATIVE1 ALTERNATIVE2 ...) entries.
 Each ALTERNATIVE is tried in order if no fonts of font family FAMILY can
 be found.  Value is ALIST.  */)
-     (alist)
-     Lisp_Object alist;
+  (Lisp_Object alist)
 {
   Lisp_Object entry, tail, tail2;
 
@@ -5355,8 +5311,7 @@ DEFUN ("internal-set-alternative-font-registry-alist",
 ALIST is an alist of (REGISTRY ALTERNATIVE1 ALTERNATIVE2 ...) entries.
 Each ALTERNATIVE is tried in order if no fonts of font registry REGISTRY can
 be found.  Value is ALIST.  */)
-     (alist)
-     Lisp_Object alist;
+  (Lisp_Object alist)
 {
   Lisp_Object entry, tail, tail2;
 
@@ -5553,7 +5508,7 @@ realize_default_face (struct frame *f)
   /* Realize the face; it must be fully-specified now.  */
   xassert (lface_fully_specified_p (XVECTOR (lface)->contents));
   check_lface (lface);
-  bcopy (XVECTOR (lface)->contents, attrs, sizeof attrs);
+  memcpy (attrs, XVECTOR (lface)->contents, sizeof attrs);
   face = realize_face (c, attrs, DEFAULT_FACE_ID);
 
 #ifdef HAVE_WINDOW_SYSTEM
@@ -5632,6 +5587,7 @@ realize_face (struct face_cache *cache, Lisp_Object *attrs, int former_face_id)
       struct face *former_face = cache->faces_by_id[former_face_id];
       uncache_face (cache, former_face);
       free_realized_face (cache->f, former_face);
+      SET_FRAME_GARBAGED (cache->f);
     }
 
   if (FRAME_WINDOW_P (cache->f))
@@ -6040,8 +5996,7 @@ This affects bold faces on TTYs whose foreground is the default background
 color of the display and whose background is the default foreground color.
 For such faces, the bold face attribute is ignored if this variable
 is non-nil.  */)
-     (suppress)
-     Lisp_Object suppress;
+  (Lisp_Object suppress)
 {
   tty_suppress_bold_inverse_default_colors_p = !NILP (suppress);
   ++face_change_count;
@@ -6074,7 +6029,7 @@ compute_char_face (struct frame *f, int ch, Lisp_Object prop)
     {
       Lisp_Object attrs[LFACE_VECTOR_SIZE];
       struct face *default_face = FACE_FROM_ID (f, DEFAULT_FACE_ID);
-      bcopy (default_face->lface, attrs, sizeof attrs);
+      memcpy (attrs, default_face->lface, sizeof attrs);
       merge_face_ref (f, prop, attrs, 1, 0);
       face_id = lookup_face (f, attrs);
     }
@@ -6101,15 +6056,10 @@ compute_char_face (struct frame *f, int ch, Lisp_Object prop)
    The face returned is suitable for displaying ASCII characters.  */
 
 int
-face_at_buffer_position (w, pos, region_beg, region_end,
-                        endptr, limit, mouse, base_face_id)
-     struct window *w;
-     EMACS_INT pos;
-     EMACS_INT region_beg, region_end;
-     EMACS_INT *endptr;
-     EMACS_INT limit;
-     int mouse;
-     int base_face_id;
+face_at_buffer_position (struct window *w, EMACS_INT pos,
+                        EMACS_INT region_beg, EMACS_INT region_end,
+                        EMACS_INT *endptr, EMACS_INT limit,
+                        int mouse, int base_face_id)
 {
   struct frame *f = XFRAME (w->frame);
   Lisp_Object attrs[LFACE_VECTOR_SIZE];
@@ -6163,7 +6113,7 @@ face_at_buffer_position (w, pos, region_beg, region_end,
     return default_face->id;
 
   /* Begin with attributes from the default face.  */
-  bcopy (default_face->lface, attrs, sizeof attrs);
+  memcpy (attrs, default_face->lface, sizeof attrs);
 
   /* Merge in attributes specified via text properties.  */
   if (!NILP (prop))
@@ -6209,15 +6159,10 @@ face_at_buffer_position (w, pos, region_beg, region_end,
    simply disregards the `face' properties of all overlays.  */
 
 int
-face_for_overlay_string (w, pos, region_beg, region_end,
-                        endptr, limit, mouse, overlay)
-     struct window *w;
-     EMACS_INT pos;
-     EMACS_INT region_beg, region_end;
-     EMACS_INT *endptr;
-     EMACS_INT limit;
-     int mouse;
-     Lisp_Object overlay;
+face_for_overlay_string (struct window *w, EMACS_INT pos,
+                        EMACS_INT region_beg, EMACS_INT region_end,
+                        EMACS_INT *endptr, EMACS_INT limit,
+                        int mouse, Lisp_Object overlay)
 {
   struct frame *f = XFRAME (w->frame);
   Lisp_Object attrs[LFACE_VECTOR_SIZE];
@@ -6257,7 +6202,7 @@ face_for_overlay_string (w, pos, region_beg, region_end,
     return DEFAULT_FACE_ID;
 
   /* Begin with attributes from the default face.  */
-  bcopy (default_face->lface, attrs, sizeof attrs);
+  memcpy (attrs, default_face->lface, sizeof attrs);
 
   /* Merge in attributes specified via text properties.  */
   if (!NILP (prop))
@@ -6302,15 +6247,11 @@ face_for_overlay_string (w, pos, region_beg, region_end,
    for displaying ASCII characters.  */
 
 int
-face_at_string_position (w, string, pos, bufpos, region_beg,
-                        region_end, endptr, base_face_id, mouse_p)
-     struct window *w;
-     Lisp_Object string;
-     EMACS_INT pos, bufpos;
-     EMACS_INT region_beg, region_end;
-     EMACS_INT *endptr;
-     enum face_id base_face_id;
-     int mouse_p;
+face_at_string_position (struct window *w, Lisp_Object string,
+                        EMACS_INT pos, EMACS_INT bufpos,
+                        EMACS_INT region_beg, EMACS_INT region_end,
+                        EMACS_INT *endptr, enum face_id base_face_id,
+                        int mouse_p)
 {
   Lisp_Object prop, position, end, limit;
   struct frame *f = XFRAME (WINDOW_FRAME (w));
@@ -6358,7 +6299,7 @@ face_at_string_position (w, string, pos, bufpos, region_beg,
     return base_face->id;
 
   /* Begin with attributes from the base face.  */
-  bcopy (base_face->lface, attrs, sizeof attrs);
+  memcpy (attrs, base_face->lface, sizeof attrs);
 
   /* Merge in attributes specified via text properties.  */
   if (!NILP (prop))
@@ -6413,7 +6354,7 @@ merge_faces (struct frame *f, Lisp_Object face_name, int face_id, int base_face_
     }
 
   /* Begin with attributes from the base face.  */
-  bcopy (base_face->lface, attrs, sizeof attrs);
+  memcpy (attrs, base_face->lface, sizeof attrs);
 
   if (!NILP (face_name))
     {
@@ -6446,8 +6387,7 @@ DEFUN ("x-load-color-file", Fx_load_color_file,
 The file should define one named RGB color per line like so:
   R G B   name
 where R,G,B are numbers between 0 and 255 and name is an arbitrary string.  */)
-    (filename)
-    Lisp_Object filename;
+  (Lisp_Object filename)
 {
   FILE *fp;
   Lisp_Object cmap = Qnil;
@@ -6529,8 +6469,7 @@ dump_realized_face (face)
 
 
 DEFUN ("dump-face", Fdump_face, Sdump_face, 0, 1, 0, doc: /* */)
-     (n)
-     Lisp_Object n;
+  (Lisp_Object n)
 {
   if (NILP (n))
     {
@@ -6564,7 +6503,7 @@ DEFUN ("dump-face", Fdump_face, Sdump_face, 0, 1, 0, doc: /* */)
 
 DEFUN ("show-face-resources", Fshow_face_resources, Sshow_face_resources,
        0, 0, 0, doc: /* */)
-     ()
+  (void)
 {
   fprintf (stderr, "number of colors = %d\n", ncolors_allocated);
   fprintf (stderr, "number of pixmaps = %d\n", npixmaps_allocated);
@@ -6794,7 +6733,8 @@ See `set-face-stipple' for possible values for this variable.  */);
   Vface_default_stipple = make_pure_c_string ("gray3");
 
   DEFVAR_LISP ("tty-defined-color-alist", &Vtty_defined_color_alist,
-   doc: /* An alist of defined terminal colors and their RGB values.  */);
+   doc: /* An alist of defined terminal colors and their RGB values.
+See the docstring of `tty-color-alist' for the details.  */);
   Vtty_defined_color_alist = Qnil;
 
   DEFVAR_LISP ("scalable-fonts-allowed", &Vscalable_fonts_allowed,
@@ -6820,10 +6760,10 @@ Each element is of the form:
    (FACE REPLACEMENT...),
 
 which causes display of the face FACE to use REPLACEMENT... instead.
-REPLACEMENT... is interpreted the same way the value of a `face' text
-property is: it may be (1) A face name, (2) A list of face names, (3) A
-property-list of face attribute/value pairs, or (4) A list of face names
-intermixed with lists containing face attribute/value pairs.
+REPLACEMENT... is interpreted the same way as the value of a `face'
+text property: it may be (1) A face name, (2) A list of face names,
+(3) A property-list of face attribute/value pairs, or (4) A list of
+face names or lists containing face attribute/value pairs.
 
 Multiple entries in REPLACEMENT... are merged together to form the final
 result, with faces or attributes earlier in the list taking precedence
@@ -6847,7 +6787,11 @@ face definitions.  For instance, the mode my-mode could define a face
 `my-mode-default', and then in the mode setup function, do:
 
    (set (make-local-variable 'face-remapping-alist)
-        '((default my-mode-default)))).  */);
+        '((default my-mode-default)))).
+
+Because Emacs normally only redraws screen areas when the underlying
+buffer contents change, you may need to call `redraw-display' after
+changing this variable for it to take effect.  */);
   Vface_remapping_alist = Qnil;
 
   DEFVAR_LISP ("face-font-rescale-alist", &Vface_font_rescale_alist,
@@ -6867,5 +6811,3 @@ a font of 10 point, we actually use a font of 10 * RESCALE-RATIO point.  */);
 #endif
 }
 
-/* arch-tag: 8a0f7598-5517-408d-9ab3-1da6fcd4c749
-   (do not change this comment) */