aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2019-11-30 11:41:09 +0000
committerDaniel Eklöf <daniel@ekloef.se>2019-11-30 11:41:09 +0000
commit10f563dc6bf0710b16a3699da47c60c7305f142b (patch)
treee78e36a7956023409967ce0b3469dee5cb90ca34
parentfont: destructor: pop elements as we go (diff)
font: cache_size -> glyph_cache_size
This makes it more clear it has nothing to do with the font cache.
-rw-r--r--font.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/font.c b/font.c
index d7460e21..da2ad380 100644
--- a/font.c
+++ b/font.c
@@ -20,7 +20,7 @@
static FT_Library ft_lib;
static mtx_t ft_lock;
-static const size_t cache_size = 512;
+static const size_t glyph_cache_size = 512;
struct font_cache_entry {
uint64_t hash;
@@ -288,7 +288,7 @@ from_font_set(FcPattern *pattern, FcFontSet *fonts, int start_idx,
font->fc_fonts = !is_fallback ? fonts : NULL;
font->fc_loaded_fallbacks = calloc(
fonts->nfont, sizeof(font->fc_loaded_fallbacks[0]));
- font->glyph_cache = calloc(cache_size, sizeof(font->glyph_cache[0]));
+ font->glyph_cache = calloc(glyph_cache_size, sizeof(font->glyph_cache[0]));
}
double max_x_advance = ft_face->size->metrics.max_advance / 64.;
@@ -433,7 +433,7 @@ font_from_name(font_list_t names, const char *attributes)
static size_t
hash_index(wchar_t wc)
{
- return wc % cache_size;
+ return wc % glyph_cache_size;
}
static bool
@@ -768,7 +768,7 @@ font_destroy(struct font *font)
FcFontSetDestroy(font->fc_fonts);
- for (size_t i = 0; i < cache_size && font->glyph_cache != NULL; i++) {
+ for (size_t i = 0; i < glyph_cache_size && font->glyph_cache != NULL; i++) {
if (font->glyph_cache[i] == NULL)
continue;