summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ChangeLog9
-rw-r--r--src/dispextern.h2
-rw-r--r--src/font.c1
-rw-r--r--src/font.h8
-rw-r--r--src/xfaces.c1
-rw-r--r--src/xfont.c6
-rw-r--r--src/xftfont.c11
7 files changed, 20 insertions, 18 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 95afceece26..e050baeb935 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -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.
diff --git a/src/dispextern.h b/src/dispextern.h
index 8b70985803a..21ed5f70ad2 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -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
};
diff --git a/src/font.c b/src/font.c
index b8b81fd3fea..6113e1c3e71 100644
--- a/src/font.c
+++ b/src/font.c
@@ -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;
}
diff --git a/src/font.h b/src/font.h
index 4a525573cc2..42137deeaa4 100644
--- a/src/font.h
+++ b/src/font.h
@@ -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. */
diff --git a/src/xfaces.c b/src/xfaces.c
index a475acdb927..4571137a249 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -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
diff --git a/src/xfont.c b/src/xfont.c
index 525f00031c5..f90904a018e 100644
--- a/src/xfont.c
+++ b/src/xfont.c
@@ -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
diff --git a/src/xftfont.c b/src/xftfont.c
index 18c180f906a..421eb713a15 100644
--- a/src/xftfont.c
+++ b/src/xftfont.c
@@ -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;
}
}