commit 46a17a9aaf65da9952885fa5059b7bc45529fb75
parent 233f0a7dc793a104ec5febe6bf6ad361b694137c
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sun, 3 Mar 2019 11:29:43 +0100
simplify (greedy) font caching allocating a bit
POSIX says:
"If ptr is a null pointer, realloc() shall be equivalent to malloc() for the
specified size."
Diffstat:
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/x.c b/x.c
@@ -1272,15 +1272,10 @@ xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, int x
fontpattern = FcFontSetMatch(0, fcsets, 1,
fcpattern, &fcres);
- /*
- * Allocate memory for the new cache entry.
- */
+ /* Allocate memory for the new cache entry. */
if (frclen >= frccap) {
frccap += 16;
- if (!frc)
- frc = xmalloc(frccap * sizeof(Fontcache));
- else
- frc = xrealloc(frc, frccap * sizeof(Fontcache));
+ frc = xrealloc(frc, frccap * sizeof(Fontcache));
}
frc[frclen].font = XftFontOpenPattern(xw.dpy,