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

@ -3,20 +3,24 @@
static safety_check_abort_hook_t safety_check_abort;
void safety_check_fail_sized_dealloc(bool current_dealloc, const void *ptr,
void
safety_check_fail_sized_dealloc(bool current_dealloc, const void *ptr,
size_t true_size, size_t input_size) {
char *src = current_dealloc ? "the current pointer being freed" :
"in thread cache, possibly from previous deallocations";
char *src = current_dealloc
? "the current pointer being freed"
: "in thread cache, possibly from previous deallocations";
char *suggest_debug_build = config_debug ? "" : " --enable-debug or";
safety_check_fail("<jemalloc>: size mismatch detected (true size %zu "
safety_check_fail(
"<jemalloc>: size mismatch detected (true size %zu "
"vs input size %zu), likely caused by application sized "
"deallocation bugs (source address: %p, %s). Suggest building with"
"%s address sanitizer for debugging. Abort.\n",
true_size, input_size, ptr, src, suggest_debug_build);
}
void safety_check_set_abort(safety_check_abort_hook_t abort_fn) {
void
safety_check_set_abort(safety_check_abort_hook_t abort_fn) {
safety_check_abort = abort_fn;
}
@ -25,7 +29,8 @@ void safety_check_set_abort(safety_check_abort_hook_t abort_fn) {
* because there are cases only logging crash stack traces.
*/
static void
safety_check_detected_heap_corruption___run_address_sanitizer_build_to_debug(const char *buf) {
safety_check_detected_heap_corruption___run_address_sanitizer_build_to_debug(
const char *buf) {
if (safety_check_abort == NULL) {
malloc_write(buf);
abort();
@ -34,7 +39,8 @@ safety_check_detected_heap_corruption___run_address_sanitizer_build_to_debug(con
}
}
void safety_check_fail(const char *format, ...) {
void
safety_check_fail(const char *format, ...) {
char buf[MALLOC_PRINTF_BUFSIZE];
va_list ap;
@ -42,5 +48,6 @@ void safety_check_fail(const char *format, ...) {
malloc_vsnprintf(buf, MALLOC_PRINTF_BUFSIZE, format, ap);
va_end(ap);
safety_check_detected_heap_corruption___run_address_sanitizer_build_to_debug(buf);
safety_check_detected_heap_corruption___run_address_sanitizer_build_to_debug(
buf);
}