]> git.eshelyaron.com Git - emacs.git/commitdiff
* dispextern.h (struct face) [HAVE_XFT]: Ifdef 'extra' member.
authorDmitry Antipov <dmantipov@yandex.ru>
Tue, 10 Jun 2014 03:32:36 +0000 (07:32 +0400)
committerDmitry Antipov <dmantipov@yandex.ru>
Tue, 10 Jun 2014 03:32:36 +0000 (07:32 +0400)
* font.c (font_done_for_face):
* xface.c (realize_non_ascii_face): Adjust user.
* font.h (struct font_driver): Convert 'prepare_face' to return
void because its return value is never used anyway.
* xfont.c (xfont_prepare_face): Return void.
* xftfont.c (xftfont_prepare_face): Likewise.  Use xmalloc.
(xftfont_done_face): Use xfree.

src/ChangeLog
src/dispextern.h
src/font.c
src/font.h
src/xfaces.c
src/xfont.c
src/xftfont.c

index 95afceece262091f7859811971ea8ec9e8b99c1d..e050baeb935c86737ee6980dcfcfd42548a334a1 100644 (file)
@@ -5,6 +5,15 @@
        function.  Also adjust comment.
        * fringe.c, w32term.c, xdisp.c, xterm.c: All users changed.
 
+       * dispextern.h (struct face) [HAVE_XFT]: Ifdef 'extra' member.
+       * font.c (font_done_for_face):
+       * xface.c (realize_non_ascii_face): Adjust user.
+       * font.h (struct font_driver): Convert 'prepare_face' to return
+       void because its return value is never used anyway.
+       * xfont.c (xfont_prepare_face): Return void.
+       * xftfont.c (xftfont_prepare_face): Likewise.  Use xmalloc.
+       (xftfont_done_face): Use xfree.
+
 2014-06-09  Paul Eggert  <eggert@cs.ucla.edu>
 
        Say (accept-process-output P)'s result pertains to P if P is non-nil.
index 8b70985803a1c2a6fb14d81eb419b1f2e7eca8a5..21ed5f70ad2fce148214b04da170c92616d2af34 100644 (file)
@@ -1716,8 +1716,10 @@ struct face
      attributes except the font.  */
   struct face *ascii_face;
 
+#ifdef HAVE_XFT
   /* Extra member that a font-driver uses privately.  */
   void *extra;
+#endif  
 };
 
 
index b8b81fd3feae3cd6662350040aeaa59e2a85aae9..6113e1c3e71554ce96315d3c87ada5b18130fc5c 100644 (file)
@@ -3337,7 +3337,6 @@ font_done_for_face (struct frame *f, struct face *face)
 {
   if (face->font->driver->done_face)
     face->font->driver->done_face (f, face);
-  face->extra = NULL;
 }
 
 
index 4a525573cc2a452beef7749293573b82d897fbfa..42137deeaa48b1420c20dd3c0c6dfa0c081434c9 100644 (file)
@@ -564,11 +564,9 @@ struct font_driver
   /* Close FONT.  NOTE: this can be called by GC.  */
   void (*close) (struct font *font);
 
-  /* Optional (if FACE->extra is not used).
-     Prepare FACE for displaying characters by FONT on frame F by
-     storing some data in FACE->extra.  If successful, return 0.
-     Otherwise, return -1.  */
-  int (*prepare_face) (struct frame *f, struct face *face);
+  /* Prepare FACE for displaying characters by FONT on frame F by
+     storing some data in FACE->extra.  */
+  void (*prepare_face) (struct frame *f, struct face *face);
 
   /* Optional.
      Done FACE for displaying characters by FACE->font on frame F.  */
index a475acdb927e7b18cc5e406c31700de4c5d5ee54..4571137a249b73ea472f0e3504835596bdc5e580 100644 (file)
@@ -5483,7 +5483,6 @@ realize_non_ascii_face (struct frame *f, Lisp_Object font_object,
   face = xmalloc (sizeof *face);
   *face = *base_face;
   face->gc = 0;
-  face->extra = NULL;
   face->overstrike
     = (! NILP (font_object)
        && FONT_WEIGHT_NAME_NUMERIC (face->lface[LFACE_WEIGHT_INDEX]) > 100
index 525f00031c5b371eb4ea7ca4ccc048431bc4e132..f90904a018e705f4cc8fa1d7dc71da7a39775baa 100644 (file)
@@ -121,7 +121,7 @@ static Lisp_Object xfont_match (struct frame *, Lisp_Object);
 static Lisp_Object xfont_list_family (struct frame *);
 static Lisp_Object xfont_open (struct frame *, Lisp_Object, int);
 static void xfont_close (struct font *);
-static int xfont_prepare_face (struct frame *, struct face *);
+static void xfont_prepare_face (struct frame *, struct face *);
 static int xfont_has_char (Lisp_Object, int);
 static unsigned xfont_encode_char (struct font *, int);
 static int xfont_text_extents (struct font *, unsigned *, int,
@@ -916,15 +916,13 @@ xfont_close (struct font *font)
     }
 }
 
-static int
+static void
 xfont_prepare_face (struct frame *f, struct face *face)
 {
   block_input ();
   XSetFont (FRAME_X_DISPLAY (f), face->gc,
            ((struct xfont_info *) face->font)->xfont->fid);
   unblock_input ();
-
-  return 0;
 }
 
 static int
index 18c180f906a0a46fb376c3b37cff67d13713b60b..421eb713a15d99c8cd47ccd0865829d851dc47b2 100644 (file)
@@ -507,7 +507,7 @@ xftfont_close (struct font *font)
     }
 }
 
-static int
+static void
 xftfont_prepare_face (struct frame *f, struct face *face)
 {
   struct xftface_info *xftface_info;
@@ -517,17 +517,14 @@ xftfont_prepare_face (struct frame *f, struct face *face)
   if (face != face->ascii_face)
     {
       face->extra = face->ascii_face->extra;
-      return 0;
+      return;
     }
 #endif
 
-  xftface_info = malloc (sizeof *xftface_info);
-  if (! xftface_info)
-    return -1;
+  xftface_info = xmalloc (sizeof *xftface_info);
   xftfont_get_colors (f, face, face->gc, NULL,
                      &xftface_info->xft_fg, &xftface_info->xft_bg);
   face->extra = xftface_info;
-  return 0;
 }
 
 static void
@@ -545,7 +542,7 @@ xftfont_done_face (struct frame *f, struct face *face)
   xftface_info = (struct xftface_info *) face->extra;
   if (xftface_info)
     {
-      free (xftface_info);
+      xfree (xftface_info);
       face->extra = NULL;
     }
 }