[Bf-blender-cvs] [2a967d444f1] master: BLF: blf_glyph_cache_free Made Static

Harley Acheson noreply at git.blender.org
Sat Feb 5 02:38:24 CET 2022


Commit: 2a967d444f11514891c5d229993d486df06c066e
Author: Harley Acheson
Date:   Fri Feb 4 17:37:23 2022 -0800
Branches: master
https://developer.blender.org/rB2a967d444f11514891c5d229993d486df06c066e

BLF: blf_glyph_cache_free Made Static

blf_glyph_cache_free does not need to be public.

See D13395 for more details.

Differential Revision: https://developer.blender.org/D13395

Reviewed by Campbell Barton

===================================================================

M	source/blender/blenfont/intern/blf_font.c
M	source/blender/blenfont/intern/blf_glyph.c
M	source/blender/blenfont/intern/blf_internal.h

===================================================================

diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c
index 14d3a208f69..c03cdc3d16d 100644
--- a/source/blender/blenfont/intern/blf_font.c
+++ b/source/blender/blenfont/intern/blf_font.c
@@ -1318,12 +1318,7 @@ FontBLF *blf_font_new_from_mem(const char *name, const unsigned char *mem, int m
 
 void blf_font_free(FontBLF *font)
 {
-  BLI_spin_lock(&blf_glyph_cache_mutex);
-  GlyphCacheBLF *gc;
-
-  while ((gc = BLI_pophead(&font->cache))) {
-    blf_glyph_cache_free(gc);
-  }
+  blf_glyph_cache_clear(font);
 
   if (font->kerning_cache) {
     MEM_freeN(font->kerning_cache);
@@ -1337,8 +1332,6 @@ void blf_font_free(FontBLF *font)
     MEM_freeN(font->name);
   }
   MEM_freeN(font);
-
-  BLI_spin_unlock(&blf_glyph_cache_mutex);
 }
 
 /** \} */
diff --git a/source/blender/blenfont/intern/blf_glyph.c b/source/blender/blenfont/intern/blf_glyph.c
index 4f25f99b65c..b87a784adff 100644
--- a/source/blender/blenfont/intern/blf_glyph.c
+++ b/source/blender/blenfont/intern/blf_glyph.c
@@ -122,20 +122,7 @@ void blf_glyph_cache_release(FontBLF *font)
   BLI_spin_unlock(font->glyph_cache_mutex);
 }
 
-void blf_glyph_cache_clear(FontBLF *font)
-{
-  GlyphCacheBLF *gc;
-
-  BLI_spin_lock(font->glyph_cache_mutex);
-
-  while ((gc = BLI_pophead(&font->cache))) {
-    blf_glyph_cache_free(gc);
-  }
-
-  BLI_spin_unlock(font->glyph_cache_mutex);
-}
-
-void blf_glyph_cache_free(GlyphCacheBLF *gc)
+static void blf_glyph_cache_free(GlyphCacheBLF *gc)
 {
   GlyphBLF *g;
   for (uint i = 0; i < ARRAY_SIZE(gc->bucket); i++) {
@@ -152,6 +139,19 @@ void blf_glyph_cache_free(GlyphCacheBLF *gc)
   MEM_freeN(gc);
 }
 
+void blf_glyph_cache_clear(FontBLF *font)
+{
+  GlyphCacheBLF *gc;
+
+  BLI_spin_lock(font->glyph_cache_mutex);
+
+  while ((gc = BLI_pophead(&font->cache))) {
+    blf_glyph_cache_free(gc);
+  }
+
+  BLI_spin_unlock(font->glyph_cache_mutex);
+}
+
 /**
  * Try to find a glyph in cache.
  *
diff --git a/source/blender/blenfont/intern/blf_internal.h b/source/blender/blenfont/intern/blf_internal.h
index 4e36f522981..04b7a3ca13b 100644
--- a/source/blender/blenfont/intern/blf_internal.h
+++ b/source/blender/blenfont/intern/blf_internal.h
@@ -148,7 +148,6 @@ struct GlyphCacheBLF *blf_glyph_cache_new(struct FontBLF *font);
 struct GlyphCacheBLF *blf_glyph_cache_acquire(struct FontBLF *font);
 void blf_glyph_cache_release(struct FontBLF *font);
 void blf_glyph_cache_clear(struct FontBLF *font);
-void blf_glyph_cache_free(struct GlyphCacheBLF *gc);
 
 /**
  * Create (or load from cache) a fully-rendered bitmap glyph.



More information about the Bf-blender-cvs mailing list