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."
This commit is contained in:
Hiltjo Posthuma 2019-03-03 11:29:43 +01:00
parent 4e0135afec
commit ed68fe7dce
1 changed files with 2 additions and 7 deletions

9
x.c
View File

@ -1243,15 +1243,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,