[hackers] [st] Lazy font unloading too. || Christoph Lohmann

From: <git_AT_suckless.org>
Date: Sat, 11 May 2013 22:02:31 +0200

commit 8f47c4a4dea7272d72833d2ae26eacc3896d8f5c
Author: Christoph Lohmann <20h_AT_r-36.net>
Date: Sat May 11 21:59:55 2013 +0200

    Lazy font unloading too.

diff --git a/st.c b/st.c
index 56955a3..8475878 100644
--- a/st.c
+++ b/st.c
_AT_@ -369,6 +369,7 @@ static void xresettitle(void);
 static void xseturgency(int);
 static void xsetsel(char*);
 static void xtermclear(int, int, int, int);
+static void xunloadfont(Font *f);
 static void xunloadfonts(void);
 static void xresize(int, int);
 
_AT_@ -2734,6 +2735,14 @@ xloadfontset(Font *f) {
 }
 
 void
+xunloadfont(Font *f) {
+ XftFontClose(xw.dpy, f->match);
+ FcPatternDestroy(f->pattern);
+ if(f->set)
+ FcFontSetDestroy(f->set);
+}
+
+void
 xunloadfonts(void) {
         int i, ip;
 
_AT_@ -2749,18 +2758,10 @@ xunloadfonts(void) {
         frccur = -1;
         frclen = 0;
 
- XftFontClose(xw.dpy, dc.font.match);
- FcPatternDestroy(dc.font.pattern);
- FcFontSetDestroy(dc.font.set);
- XftFontClose(xw.dpy, dc.bfont.match);
- FcPatternDestroy(dc.bfont.pattern);
- FcFontSetDestroy(dc.bfont.set);
- XftFontClose(xw.dpy, dc.ifont.match);
- FcPatternDestroy(dc.ifont.pattern);
- FcFontSetDestroy(dc.ifont.set);
- XftFontClose(xw.dpy, dc.ibfont.match);
- FcPatternDestroy(dc.ibfont.pattern);
- FcFontSetDestroy(dc.ibfont.set);
+ xunloadfont(&dc.font);
+ xunloadfont(&dc.bfont);
+ xunloadfont(&dc.ifont);
+ xunloadfont(&dc.ibfont);
 }
 
 void
Received on Sat May 11 2013 - 22:02:31 CEST

This archive was generated by hypermail 2.3.0 : Sat May 11 2013 - 22:12:12 CEST