Enforce mi_stat wrapper for performance and consistency

Statistics wrapper macros, mi_stat_{increase,counter_increase} are
defined as no-op when MI_STAT equals to 0 (no runtime statistics).
However, even MI_STAT is set to 0, internal functions such as
_mi_stat_increase are invoked unexpectedly. This patch enforces the use
of mi_stat wrapper macros and MI_STAT.
This commit is contained in:
Jim Huang 2019-07-21 15:12:13 +08:00
parent e2b4127a16
commit e5f37eb806
6 changed files with 42 additions and 30 deletions

View file

@ -341,7 +341,7 @@ void _mi_stat_increase(mi_stat_count_t* stat, size_t amount);
void _mi_stat_decrease(mi_stat_count_t* stat, size_t amount);
void _mi_stat_counter_increase(mi_stat_counter_t* stat, size_t amount);
#if (MI_STAT)
#if MI_STAT>0
#define mi_stat_increase(stat,amount) _mi_stat_increase( &(stat), amount)
#define mi_stat_decrease(stat,amount) _mi_stat_decrease( &(stat), amount)
#define mi_stat_counter_increase(stat,amount) _mi_stat_counter_increase( &(stat), amount)