Alter FailFast behaviour of memcpy (#526)
This commit changes the codegen for error messages for failed memcpys. This no longer generates a stack frame and correctly tail calls the error messages generator. It also turns the error messages on in Release builds. This will lead to better adoption experience.
This commit is contained in:
committed by
GitHub
parent
87d71cce21
commit
c445de8eb4
@@ -90,7 +90,12 @@ void memcpy_unchecked(void* dst, const void* src, size_t size)
|
||||
NOINLINE
|
||||
void memcpy_platform_checked(void* dst, const void* src, size_t size)
|
||||
{
|
||||
check_bounds(dst, size, "");
|
||||
if (SNMALLOC_UNLIKELY(!check_bounds(dst, size)))
|
||||
{
|
||||
report_fatal_bounds_error(dst, size, "");
|
||||
return;
|
||||
}
|
||||
|
||||
memcpy(dst, src, size);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user