Browse Source

sokol_fontstash.h: remove clang analyzer workaround

...that same workaround triggers an analyzer warning if
the analyzer can 'see' the call to sfons_destroy().
Andre Weissflog 3 years ago
parent
commit
58512cf905
1 changed files with 1 additions and 13 deletions
  1. 1 13
      util/sokol_fontstash.h

+ 1 - 13
util/sokol_fontstash.h

@@ -1861,16 +1861,6 @@ static sfons_desc_t _sfons_desc_defaults(const sfons_desc_t* desc) {
     return res;
 }
 
-// NOTE clang analyzer will report a potential memory leak for the call
-// to _sfons_malloc_clear in the sfons_create() function, this is a false positive
-// (the freeing happens in sfons_destroy()). The following macro
-// silences the false positive when compilation happens with the analyzer active
-#if __clang_analyzer__
-#define _SFONS_CLANG_ANALYZER_SILENCE_POTENTIAL_LEAK_FALSE_POSITIVE(a,x) _sfons_free(a,x)
-#else
-#define _SFONS_CLANG_ANALYZER_SILENCE_POTENTIAL_LEAK_FALSE_POSITIVE(a,x)
-#endif
-
 SOKOL_API_IMPL FONScontext* sfons_create(const sfons_desc_t* desc) {
     SOKOL_ASSERT(desc);
     SOKOL_ASSERT((desc->allocator.alloc && desc->allocator.free) || (!desc->allocator.alloc && !desc->allocator.free));
@@ -1887,9 +1877,7 @@ SOKOL_API_IMPL FONScontext* sfons_create(const sfons_desc_t* desc) {
     params.renderDraw = _sfons_render_draw;
     params.renderDelete = _sfons_render_delete;
     params.userPtr = sfons;
-    FONScontext* ctx = fonsCreateInternal(&params);
-    _SFONS_CLANG_ANALYZER_SILENCE_POTENTIAL_LEAK_FALSE_POSITIVE(&desc->allocator, sfons);
-    return ctx;
+    return fonsCreateInternal(&params);
 }
 
 SOKOL_API_IMPL void sfons_destroy(FONScontext* ctx) {