Reformat the codebase with the clang-format 18.

This commit is contained in:
guangli-dai
2025-06-13 12:31:12 -07:00
committed by Guangli Dai
parent a952a3b8b0
commit 6200e8987f
346 changed files with 18286 additions and 17770 deletions

View File

@@ -2,19 +2,16 @@
static void
noop_alloc_hook(void *extra, hook_alloc_t type, void *result,
uintptr_t result_raw, uintptr_t args_raw[3]) {
}
uintptr_t result_raw, uintptr_t args_raw[3]) {}
static void
noop_dalloc_hook(void *extra, hook_dalloc_t type, void *address,
uintptr_t args_raw[3]) {
}
noop_dalloc_hook(
void *extra, hook_dalloc_t type, void *address, uintptr_t args_raw[3]) {}
static void
noop_expand_hook(void *extra, hook_expand_t type, void *address,
size_t old_usize, size_t new_usize, uintptr_t result_raw,
uintptr_t args_raw[4]) {
}
uintptr_t args_raw[4]) {}
static void
malloc_free_loop(int iters) {
@@ -26,23 +23,23 @@ malloc_free_loop(int iters) {
static void
test_hooked(int iters) {
hooks_t hooks = {&noop_alloc_hook, &noop_dalloc_hook, &noop_expand_hook,
NULL};
hooks_t hooks = {
&noop_alloc_hook, &noop_dalloc_hook, &noop_expand_hook, NULL};
int err;
void *handles[HOOK_MAX];
int err;
void *handles[HOOK_MAX];
size_t sz = sizeof(handles[0]);
for (int i = 0; i < HOOK_MAX; i++) {
err = mallctl("experimental.hooks.install", &handles[i],
&sz, &hooks, sizeof(hooks));
err = mallctl("experimental.hooks.install", &handles[i], &sz,
&hooks, sizeof(hooks));
assert(err == 0);
timedelta_t timer;
timer_start(&timer);
malloc_free_loop(iters);
timer_stop(&timer);
malloc_printf("With %d hook%s: %"FMTu64"us\n", i + 1,
malloc_printf("With %d hook%s: %" FMTu64 "us\n", i + 1,
i + 1 == 1 ? "" : "s", timer_usec(&timer));
}
for (int i = 0; i < HOOK_MAX; i++) {
@@ -59,7 +56,7 @@ test_unhooked(int iters) {
malloc_free_loop(iters);
timer_stop(&timer);
malloc_printf("Without hooks: %"FMTu64"us\n", timer_usec(&timer));
malloc_printf("Without hooks: %" FMTu64 "us\n", timer_usec(&timer));
}
int