Avoid using word 'crazy' (#11396)

Avoid using word 'crazy' and simplify the comment of else branch
This commit is contained in:
cloudhan 2022-05-05 23:07:50 +08:00 committed by GitHub
parent 5ae461ec0a
commit eca4cbc419
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -52,10 +52,9 @@ char* __cxa_demangle(const char* mangled_name, char* buf, size_t* n, int* status
if (!initialize_output_buffer(buf, n, buf_size, 1024)) {
internal_status = DEMANGLE_MEMORY_ALLOCATION_FAILURE;
} else {
// This might cause a truncated mangled name being returned without error,
// but should be fine for debugging purpose.
strncpy(buf, mangled_name, buf_size);
// Blindly guard the output buffer, this might cause a truncated mangled name being returned without error status,
// but this should be fine for debugging purpose. As we are returning the mangle name directly, if the caller is
// doing crazy stuff with the name, it should both fail with the return mangled name and a truncated mangled name.
buf[buf_size - 1] = '\0';
}