summaryrefslogtreecommitdiff
path: root/src/xfont.c
diff options
context:
space:
mode:
authorDmitry Antipov <dmantipov@yandex.ru>2013-10-25 10:55:36 +0400
committerDmitry Antipov <dmantipov@yandex.ru>2013-10-25 10:55:36 +0400
commit78e0b35c45892995da596c65759fdece3e67129d (patch)
tree4e18a2b9f5703f8eb4c7151fc061f4c13892432e /src/xfont.c
parent963ce6361af7f8b7aefb63e7a50956e497020b12 (diff)
downloademacs-78e0b35c45892995da596c65759fdece3e67129d.tar.gz
Omit unused frame argument of font API's close function.
* font.h (struct font): Drop frame argument. Adjust comment. * font.c (font_clear_cache, font_close_object): Adjust users. * ftfont.c (ftfont_close): * ftxfont.c (ftxfont_close): * macfont.m (macfont_close): * nsfont.m (nsfont_close): * w32font.c (w32font_close): * xfont.c (xfont_close): * xftfont.c (xftfont_close): Adjust driver-specific close functions, tweak comments and make functions safe if called more than once for the same font object.
Diffstat (limited to 'src/xfont.c')
-rw-r--r--src/xfont.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/xfont.c b/src/xfont.c
index c5b8db3830c..1f87fb8783e 100644
--- a/src/xfont.c
+++ b/src/xfont.c
@@ -119,7 +119,7 @@ static Lisp_Object xfont_list (struct frame *, Lisp_Object);
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 frame *, struct font *);
+static void xfont_close (struct font *);
static int xfont_prepare_face (struct frame *, struct face *);
static int xfont_has_char (Lisp_Object, int);
static unsigned xfont_encode_char (struct font *, int);
@@ -890,11 +890,17 @@ xfont_open (struct frame *f, Lisp_Object entity, int pixel_size)
}
static void
-xfont_close (struct frame *f, struct font *font)
+xfont_close (struct font *font)
{
- block_input ();
- XFreeFont (FRAME_X_DISPLAY (f), ((struct xfont_info *) font)->xfont);
- unblock_input ();
+ struct xfont_info *xfi = (struct xfont_info *) font;
+
+ if (xfi->xfont)
+ {
+ block_input ();
+ XFreeFont (xfi->display, xfi->xfont);
+ unblock_input ();
+ xfi->xfont = NULL;
+ }
}
static int