diff --git a/src/memtracer/allocator.cpp b/src/memtracer/allocator.cpp index e83eccdb5..5eaecb991 100644 --- a/src/memtracer/allocator.cpp +++ b/src/memtracer/allocator.cpp @@ -46,7 +46,7 @@ mt_visible void *calloc(size_t nelem, size_t size) return calloc_buffer; } size_t alloc_size = nelem * size; - void * ptr = malloc(alloc_size); + void *ptr = malloc(alloc_size); if (ptr == NULL) [[unlikely]] { return NULL; } @@ -109,7 +109,7 @@ mt_visible int munmap(void *addr, size_t length) mt_visible char *strdup(const char *s) MT_THROW { size_t len = strlen(s); - char * p = (char *)malloc(len + 1); + char *p = (char *)malloc(len + 1); if (p == NULL) { return NULL; } @@ -120,9 +120,9 @@ mt_visible char *strdup(const char *s) MT_THROW mt_visible char *strndup(const char *s, size_t n) MT_THROW { - const char * end = (const char *)memchr(s, 0, n); + const char *end = (const char *)memchr(s, 0, n); const size_t m = (end != NULL ? (size_t)(end - s) : n); - char * t = (char *)malloc(m + 1); + char *t = (char *)malloc(m + 1); if (t == NULL) return NULL; memcpy(t, s, m); @@ -178,7 +178,7 @@ mt_visible long int syscall(long int __sysno, ...) exit(-1); } #elif defined(__MACH__) -mt_visible void *brk(const void *addr) +mt_visible void *brk(const void *addr) { MEMTRACER_LOG("brk not supported\n"); exit(-1); diff --git a/src/memtracer/memtracer.cpp b/src/memtracer/memtracer.cpp index 3e6810b5d..beafdfd83 100644 --- a/src/memtracer/memtracer.cpp +++ b/src/memtracer/memtracer.cpp @@ -61,7 +61,7 @@ void MemTracer::init() // init memory limit const char *memory_limit_str = std::getenv("MT_MEMORY_LIMIT"); if (memory_limit_str != nullptr) { - char * end; + char *end; unsigned long long value = std::strtoull(memory_limit_str, &end, 10); if (end != memory_limit_str && *end == '\0') { MT.set_memory_limit(static_cast(value)); @@ -73,7 +73,7 @@ void MemTracer::init() // init print_interval const char *print_interval_ms_str = std::getenv("MT_PRINT_INTERVAL_MS"); if (print_interval_ms_str != nullptr) { - char * end; + char *end; unsigned long long value = std::strtoull(print_interval_ms_str, &end, 10); if (end != print_interval_ms_str && *end == '\0') { MT.set_print_interval(static_cast(value)); @@ -148,7 +148,7 @@ void MemTracer::init_hook_funcs_impl() void MemTracer::stat() { const size_t print_interval_ms = MT.print_interval(); - const size_t sleep_interval = 100; // 100 ms + const size_t sleep_interval = 100; // 100 ms while (!MT.is_stop()) { if (REACH_TIME_INTERVAL(print_interval_ms)) { // TODO: optimize the output format