diff --git a/include/mimalloc-stats.h b/include/mimalloc-stats.h index 4dc4c381..7c1ed770 100644 --- a/include/mimalloc-stats.h +++ b/include/mimalloc-stats.h @@ -92,8 +92,8 @@ typedef struct mi_stats_s extern "C" { #endif -mi_decl_export void mi_stats_get( size_t stats_size, mi_stats_t* stats ) mi_attr_noexcept; -mi_decl_export const char* mi_stats_get_json( size_t buf_size, char* buf ) mi_attr_noexcept; // use mi_free to free the result if the input buf == NULL +mi_decl_export void mi_stats_get( size_t stats_size, mi_stats_t* stats ) mi_attr_noexcept; +mi_decl_export char* mi_stats_get_json( size_t buf_size, char* buf ) mi_attr_noexcept; // use mi_free to free the result if the input buf == NULL #ifdef __cplusplus } diff --git a/src/stats.c b/src/stats.c index 36c7f23c..d9b26863 100644 --- a/src/stats.c +++ b/src/stats.c @@ -539,7 +539,7 @@ static void mi_heap_buf_print_counter_value(mi_heap_buf_t* hbuf, const char* nam #define MI_STAT_COUNT(stat) mi_heap_buf_print_count_value(&hbuf, #stat, &stats->stat); #define MI_STAT_COUNTER(stat) mi_heap_buf_print_counter_value(&hbuf, #stat, &stats->stat); -const char* mi_stats_get_json(size_t output_size, char* output_buf) mi_attr_noexcept { +char* mi_stats_get_json(size_t output_size, char* output_buf) mi_attr_noexcept { mi_heap_buf_t hbuf = { NULL, 0, 0, true }; if (output_size > 0 && output_buf != NULL) { _mi_memzero(output_buf, output_size); diff --git a/test/test-stress.c b/test/test-stress.c index 43d06ad5..9e041064 100644 --- a/test/test-stress.c +++ b/test/test-stress.c @@ -331,9 +331,9 @@ int main(int argc, char** argv) { #ifndef NDEBUG mi_debug_show_arenas(); mi_collect(true); - const char* json = mi_stats_get_json(0, NULL); + char* json = mi_stats_get_json(0, NULL); if (json != NULL) { - puts(json); + fputs(json,stderr); mi_free(json); } #endif