mirror of
https://github.com/pikami/st.git
synced 2024-11-25 21:35:42 +00:00
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:
parent
4e0135afec
commit
ed68fe7dce
7
x.c
7
x.c
@ -1243,14 +1243,9 @@ xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, int x
|
|||||||
fontpattern = FcFontSetMatch(0, fcsets, 1,
|
fontpattern = FcFontSetMatch(0, fcsets, 1,
|
||||||
fcpattern, &fcres);
|
fcpattern, &fcres);
|
||||||
|
|
||||||
/*
|
/* Allocate memory for the new cache entry. */
|
||||||
* Allocate memory for the new cache entry.
|
|
||||||
*/
|
|
||||||
if (frclen >= frccap) {
|
if (frclen >= frccap) {
|
||||||
frccap += 16;
|
frccap += 16;
|
||||||
if (!frc)
|
|
||||||
frc = xmalloc(frccap * sizeof(Fontcache));
|
|
||||||
else
|
|
||||||
frc = xrealloc(frc, frccap * sizeof(Fontcache));
|
frc = xrealloc(frc, frccap * sizeof(Fontcache));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user