mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-07-06 19:38:41 +03:00
fn() is not a valid C prototype
This commit is contained in:
parent
c6c1d5fffd
commit
236cd2e65c
7 changed files with 40 additions and 40 deletions
|
@ -193,7 +193,7 @@ static size_t mi__msize_dbg_term(void* p, int block_type) {
|
|||
// ------------------------------------------------------
|
||||
// implement our own global atexit handler
|
||||
// ------------------------------------------------------
|
||||
typedef void (cbfun_t)();
|
||||
typedef void (cbfun_t)(void);
|
||||
typedef int (atexit_fun_t)(cbfun_t* fn);
|
||||
typedef uintptr_t encoded_t;
|
||||
|
||||
|
@ -229,7 +229,7 @@ static void init_canary()
|
|||
|
||||
|
||||
// initialize the list
|
||||
static void mi_initialize_atexit() {
|
||||
static void mi_initialize_atexit(void) {
|
||||
InitializeCriticalSection(&atexit_lock);
|
||||
init_canary();
|
||||
}
|
||||
|
@ -495,12 +495,12 @@ mi_decl_export void mi_patches_disable(void) {
|
|||
}
|
||||
|
||||
// Enable all patches normally
|
||||
mi_decl_export bool mi_patches_enable() {
|
||||
mi_decl_export bool mi_patches_enable(void) {
|
||||
return _mi_patches_apply( PATCH_TARGET, NULL );
|
||||
}
|
||||
|
||||
// Enable all patches in termination phase where free is a no-op
|
||||
mi_decl_export bool mi_patches_enable_term() {
|
||||
mi_decl_export bool mi_patches_enable_term(void) {
|
||||
return _mi_patches_apply(PATCH_TARGET_TERM, NULL);
|
||||
}
|
||||
|
||||
|
@ -544,7 +544,7 @@ static atexit_fun_t* crt_atexit = NULL;
|
|||
static atexit_fun_t* crt_at_quick_exit = NULL;
|
||||
|
||||
|
||||
static bool mi_patches_resolve() {
|
||||
static bool mi_patches_resolve(void) {
|
||||
// get all loaded modules
|
||||
HANDLE process = GetCurrentProcess(); // always -1, no need to release
|
||||
DWORD needed = 0;
|
||||
|
@ -604,12 +604,12 @@ static void NTAPI mi_fls_unwind(PVOID value) {
|
|||
return;
|
||||
}
|
||||
|
||||
static void mi_patches_atexit() {
|
||||
static void mi_patches_atexit(void) {
|
||||
mi_execute_exit_list(&atexit_list);
|
||||
mi_patches_enable_term(); // enter termination phase and patch realloc/free with a no-op
|
||||
}
|
||||
|
||||
static void mi_patches_at_quick_exit() {
|
||||
static void mi_patches_at_quick_exit(void) {
|
||||
mi_execute_exit_list(&at_quick_exit_list);
|
||||
mi_patches_enable_term(); // enter termination phase and patch realloc/free with a no-op
|
||||
}
|
||||
|
|
|
@ -157,12 +157,12 @@ void mi_collect(bool force) mi_attr_noexcept {
|
|||
Heap new
|
||||
----------------------------------------------------------- */
|
||||
|
||||
mi_heap_t* mi_heap_get_default() {
|
||||
mi_heap_t* mi_heap_get_default(void) {
|
||||
mi_thread_init();
|
||||
return mi_get_default_heap();
|
||||
}
|
||||
|
||||
mi_heap_t* mi_heap_get_backing() {
|
||||
mi_heap_t* mi_heap_get_backing(void) {
|
||||
mi_heap_t* heap = mi_heap_get_default();
|
||||
mi_assert_internal(heap!=NULL);
|
||||
mi_heap_t* bheap = heap->tld->heap_backing;
|
||||
|
@ -177,7 +177,7 @@ uintptr_t _mi_heap_random(mi_heap_t* heap) {
|
|||
return r;
|
||||
}
|
||||
|
||||
mi_heap_t* mi_heap_new() {
|
||||
mi_heap_t* mi_heap_new(void) {
|
||||
mi_heap_t* bheap = mi_heap_get_backing();
|
||||
mi_heap_t* heap = mi_heap_malloc_tp(bheap, mi_heap_t);
|
||||
if (heap==NULL) return NULL;
|
||||
|
|
18
src/init.c
18
src/init.c
|
@ -181,7 +181,7 @@ typedef struct mi_thread_data_s {
|
|||
} mi_thread_data_t;
|
||||
|
||||
// Initialize the thread local default heap, called from `mi_thread_init`
|
||||
static bool _mi_heap_init() {
|
||||
static bool _mi_heap_init(void) {
|
||||
if (mi_heap_is_initialized(_mi_heap_default)) return true;
|
||||
if (_mi_is_main_thread()) {
|
||||
// the main heap is statically allocated
|
||||
|
@ -212,7 +212,7 @@ static bool _mi_heap_init() {
|
|||
}
|
||||
|
||||
// Free the thread local default heap (called from `mi_thread_done`)
|
||||
static bool _mi_heap_done() {
|
||||
static bool _mi_heap_done(void) {
|
||||
mi_heap_t* heap = _mi_heap_default;
|
||||
if (!mi_heap_is_initialized(heap)) return true;
|
||||
|
||||
|
@ -285,7 +285,7 @@ static bool _mi_heap_done() {
|
|||
#endif
|
||||
|
||||
// Set up handlers so `mi_thread_done` is called automatically
|
||||
static void mi_process_setup_auto_thread_done() {
|
||||
static void mi_process_setup_auto_thread_done(void) {
|
||||
static bool tls_initialized = false; // fine if it races
|
||||
if (tls_initialized) return;
|
||||
tls_initialized = true;
|
||||
|
@ -299,12 +299,12 @@ static void mi_process_setup_auto_thread_done() {
|
|||
}
|
||||
|
||||
|
||||
bool _mi_is_main_thread() {
|
||||
bool _mi_is_main_thread(void) {
|
||||
return (_mi_heap_main.thread_id==0 || _mi_heap_main.thread_id == _mi_thread_id());
|
||||
}
|
||||
|
||||
// This is called from the `mi_malloc_generic`
|
||||
void mi_thread_init() mi_attr_noexcept
|
||||
void mi_thread_init(void) mi_attr_noexcept
|
||||
{
|
||||
// ensure our process has started already
|
||||
mi_process_init();
|
||||
|
@ -329,7 +329,7 @@ void mi_thread_init() mi_attr_noexcept
|
|||
_mi_verbose_message("thread init: 0x%zx\n", _mi_thread_id());
|
||||
}
|
||||
|
||||
void mi_thread_done() mi_attr_noexcept {
|
||||
void mi_thread_done(void) mi_attr_noexcept {
|
||||
// stats
|
||||
mi_heap_t* heap = mi_get_default_heap();
|
||||
if (!_mi_is_main_thread() && mi_heap_is_initialized(heap)) {
|
||||
|
@ -350,7 +350,7 @@ void mi_thread_done() mi_attr_noexcept {
|
|||
// --------------------------------------------------------
|
||||
static void mi_process_done(void);
|
||||
|
||||
void mi_process_init() mi_attr_noexcept {
|
||||
void mi_process_init(void) mi_attr_noexcept {
|
||||
// ensure we are called once
|
||||
if (_mi_process_is_initialized) return;
|
||||
_mi_process_is_initialized = true;
|
||||
|
@ -406,7 +406,7 @@ static void mi_process_done(void) {
|
|||
|
||||
#elif defined(__cplusplus)
|
||||
// C++: use static initialization to detect process start
|
||||
static bool _mi_process_init() {
|
||||
static bool _mi_process_init(void) {
|
||||
mi_process_init();
|
||||
return (mi_main_thread_id != 0);
|
||||
}
|
||||
|
@ -414,7 +414,7 @@ static void mi_process_done(void) {
|
|||
|
||||
#elif defined(__GNUC__) || defined(__clang__)
|
||||
// GCC,Clang: use the constructor attribute
|
||||
static void __attribute__((constructor)) _mi_process_init() {
|
||||
static void __attribute__((constructor)) _mi_process_init(void) {
|
||||
mi_process_init();
|
||||
}
|
||||
|
||||
|
|
2
src/os.c
2
src/os.c
|
@ -50,7 +50,7 @@ static void* mi_align_down_ptr(void* p, size_t alignment) {
|
|||
static void* os_pool_alloc(size_t size, size_t alignment, mi_os_tld_t* tld);
|
||||
|
||||
// cached OS page size
|
||||
size_t _mi_os_page_size() {
|
||||
size_t _mi_os_page_size(void) {
|
||||
static size_t page_size = 0;
|
||||
if (page_size == 0) {
|
||||
#if defined(_WIN32)
|
||||
|
|
14
src/stats.c
14
src/stats.c
|
@ -256,15 +256,15 @@ static void _mi_stats_print(mi_stats_t* stats, double secs, FILE* out) mi_attr_n
|
|||
}
|
||||
|
||||
static double mi_clock_end(double start);
|
||||
static double mi_clock_start();
|
||||
static double mi_clock_start(void);
|
||||
static double mi_time_start = 0.0;
|
||||
|
||||
static mi_stats_t* mi_stats_get_default() {
|
||||
static mi_stats_t* mi_stats_get_default(void) {
|
||||
mi_heap_t* heap = mi_heap_get_default();
|
||||
return &heap->tld->stats;
|
||||
}
|
||||
|
||||
void mi_stats_reset() mi_attr_noexcept {
|
||||
void mi_stats_reset(void) mi_attr_noexcept {
|
||||
mi_stats_t* stats = mi_stats_get_default();
|
||||
if (stats != &_mi_stats_main) { memset(stats, 0, sizeof(mi_stats_t)); }
|
||||
memset(&_mi_stats_main, 0, sizeof(mi_stats_t));
|
||||
|
@ -305,7 +305,7 @@ static double mi_to_seconds(LARGE_INTEGER t) {
|
|||
return ((double)(t.QuadPart) / freq);
|
||||
}
|
||||
|
||||
static double mi_clock_now() {
|
||||
static double mi_clock_now(void) {
|
||||
LARGE_INTEGER t;
|
||||
QueryPerformanceCounter(&t);
|
||||
return mi_to_seconds(t);
|
||||
|
@ -313,14 +313,14 @@ static double mi_clock_now() {
|
|||
#else
|
||||
#include <time.h>
|
||||
#ifdef CLOCK_REALTIME
|
||||
static double mi_clock_now() {
|
||||
static double mi_clock_now(void) {
|
||||
struct timespec t;
|
||||
clock_gettime(CLOCK_REALTIME, &t);
|
||||
return (double)t.tv_sec + (1.0e-9 * (double)t.tv_nsec);
|
||||
}
|
||||
#else
|
||||
// low resolution timer
|
||||
static double mi_clock_now() {
|
||||
static double mi_clock_now(void) {
|
||||
return ((double)clock() / (double)CLOCKS_PER_SEC);
|
||||
}
|
||||
#endif
|
||||
|
@ -329,7 +329,7 @@ static double mi_clock_now() {
|
|||
|
||||
static double mi_clock_diff = 0.0;
|
||||
|
||||
static double mi_clock_start() {
|
||||
static double mi_clock_start(void) {
|
||||
if (mi_clock_diff == 0.0) {
|
||||
double t0 = mi_clock_now();
|
||||
mi_clock_diff = mi_clock_now() - t0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue