[PATCH] use goto in xloadfonts()

From: Michael Reed <m.reed_AT_mykolab.com>
Date: Fri, 19 Jun 2015 16:58:04 -0400

---
 st.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/st.c b/st.c
index 666edec..ffd80df 100644
--- a/st.c
+++ b/st.c
_AT_@ -3071,7 +3071,7 @@ xloadfonts(char *fontstr, double fontsize) {
 	}
 
 	if(!pattern)
-		die("st: can't open font %s\n", fontstr);
+		goto err;
 
 	if(fontsize > 1) {
 		FcPatternDel(pattern, FC_PIXEL_SIZE);
_AT_@ -3100,7 +3100,7 @@ xloadfonts(char *fontstr, double fontsize) {
 	FcDefaultSubstitute(pattern);
 
 	if(xloadfont(&dc.font, pattern))
-		die("st: can't open font %s\n", fontstr);
+		goto err;
 
 	if(usedfontsize < 0) {
 		FcPatternGetDouble(dc.font.match->pattern,
_AT_@ -3117,19 +3117,23 @@ xloadfonts(char *fontstr, double fontsize) {
 	FcPatternDel(pattern, FC_SLANT);
 	FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ITALIC);
 	if(xloadfont(&dc.ifont, pattern))
-		die("st: can't open font %s\n", fontstr);
+		goto err;
 
 	FcPatternDel(pattern, FC_WEIGHT);
 	FcPatternAddInteger(pattern, FC_WEIGHT, FC_WEIGHT_BOLD);
 	if(xloadfont(&dc.ibfont, pattern))
-		die("st: can't open font %s\n", fontstr);
+		goto err;
 
 	FcPatternDel(pattern, FC_SLANT);
 	FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ROMAN);
 	if(xloadfont(&dc.bfont, pattern))
-		die("st: can't open font %s\n", fontstr);
+		goto err;
 
 	FcPatternDestroy(pattern);
+	return;
+
+err:
+	die("st: can't open font %s\n", fontstr);
 }
 
 void
-- 
2.4.3
--------------030808050604080800040100--
Received on Mon Sep 17 2001 - 00:00:00 CEST

This archive was generated by hypermail 2.3.0 : Fri Jun 19 2015 - 23:12:10 CEST