aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Weissflog <floooh@gmail.com>2022-08-07 17:22:31 +0200
committerAndre Weissflog <floooh@gmail.com>2022-08-07 17:22:31 +0200
commit58512cf905fc4ea772c6d872d3010e3a201cf6e8 (patch)
treee11cd75f882a7f23e19864c395e52d87f82dd709
parent6054289497abe26dff60f461e2e6af5f3b69da7e (diff)
sokol_fontstash.h: remove clang analyzer workaround
...that same workaround triggers an analyzer warning if the analyzer can 'see' the call to sfons_destroy().
-rw-r--r--util/sokol_fontstash.h14
1 files changed, 1 insertions, 13 deletions
diff --git a/util/sokol_fontstash.h b/util/sokol_fontstash.h
index 30d4cde1..af9f18c1 100644
--- a/util/sokol_fontstash.h
+++ b/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) {