|
@@ -1125,9 +1125,7 @@ void __PHYSFS_platformAllocatorDeinit(void)
|
|
|
|
|
|
|
|
void *__PHYSFS_platformAllocatorMalloc(PHYSFS_uint64 s)
|
|
void *__PHYSFS_platformAllocatorMalloc(PHYSFS_uint64 s)
|
|
|
{
|
|
{
|
|
|
- /* make sure s isn't larger than the address space of the platform... */
|
|
|
|
|
- if ( s > (0xFFFFFFFFFFFFFFFF >> (64-(sizeof (size_t) * 8))) )
|
|
|
|
|
- BAIL_MACRO(ERR_OUT_OF_MEMORY, NULL);
|
|
|
|
|
|
|
+ BAIL_IF_MACRO(__PHYSFS_ui64FitsAddressSpace(s), ERR_OUT_OF_MEMORY, NULL);
|
|
|
#undef malloc
|
|
#undef malloc
|
|
|
return(malloc((size_t) s));
|
|
return(malloc((size_t) s));
|
|
|
} /* __PHYSFS_platformMalloc */
|
|
} /* __PHYSFS_platformMalloc */
|
|
@@ -1135,9 +1133,7 @@ void *__PHYSFS_platformAllocatorMalloc(PHYSFS_uint64 s)
|
|
|
|
|
|
|
|
void *__PHYSFS_platformAllocatorRealloc(void *ptr, PHYSFS_uint64 s)
|
|
void *__PHYSFS_platformAllocatorRealloc(void *ptr, PHYSFS_uint64 s)
|
|
|
{
|
|
{
|
|
|
- /* make sure s isn't larger than the address space of the platform... */
|
|
|
|
|
- if ( s > (0xFFFFFFFFFFFFFFFF >> (64-(sizeof (size_t) * 8))) )
|
|
|
|
|
- BAIL_MACRO(ERR_OUT_OF_MEMORY, NULL);
|
|
|
|
|
|
|
+ BAIL_IF_MACRO(__PHYSFS_ui64FitsAddressSpace(s), ERR_OUT_OF_MEMORY, NULL);
|
|
|
#undef realloc
|
|
#undef realloc
|
|
|
return(realloc(ptr, (size_t) s));
|
|
return(realloc(ptr, (size_t) s));
|
|
|
} /* __PHYSFS_platformRealloc */
|
|
} /* __PHYSFS_platformRealloc */
|