Add some type safety to other pagemap accesses.
Introduce a descriptor for the pagemap config and check that the source descriptor is compatible with the destination type.
This commit is contained in:
@@ -206,8 +206,16 @@ extern "C"
|
||||
}
|
||||
|
||||
#ifdef SNMALLOC_EXPOSE_PAGEMAP
|
||||
SNMALLOC_EXPORT void* SNMALLOC_NAME_MANGLE(snmalloc_get_global_pagemap)(void)
|
||||
SNMALLOC_EXPORT void* SNMALLOC_NAME_MANGLE(snmalloc_get_global_pagemap)(
|
||||
PagemapConfig const** config)
|
||||
{
|
||||
if (config)
|
||||
{
|
||||
*config = &decltype(snmalloc::global_pagemap)::config;
|
||||
assert(
|
||||
decltype(snmalloc::global_pagemap)::cast_to_pagemap(
|
||||
&snmalloc::global_pagemap, *config) == &snmalloc::global_pagemap);
|
||||
}
|
||||
return &snmalloc::global_pagemap;
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user