Skip to content
Permalink
Browse files
Since all the platform layers were using the same cut-and-paste of the
 malloc/realloc/free allocator, I moved it into physfs.c as a default, which
 is used if the platform layer doesn't offer a platform-specific default
 allocator, which none do at this point, but will soon.
  • Loading branch information
icculus committed Mar 20, 2007
1 parent bb1d757 commit 857d9bc84dab0ea6f0ce3e7d915da742bd7e51df

File 5 of 8 in 857d9bc

@@ -576,39 +576,10 @@ PHYSFS_sint64 __PHYSFS_platformGetLastModTime(const char *fname)


/* !!! FIXME: Don't use C runtime for allocators? */
int __PHYSFS_platformAllocatorInit(void)
int __PHYSFS_platformSetDefaultAllocator(PHYSFS_Allocator *a)
{
return(1); /* always succeeds. */
} /* __PHYSFS_platformAllocatorInit */


void __PHYSFS_platformAllocatorDeinit(void)
{
/* no-op */
} /* __PHYSFS_platformAllocatorInit */


void *__PHYSFS_platformAllocatorMalloc(PHYSFS_uint64 s)
{
BAIL_IF_MACRO(__PHYSFS_ui64FitsAddressSpace(s), ERR_OUT_OF_MEMORY, NULL);
#undef malloc
return(malloc((size_t) s));
} /* __PHYSFS_platformMalloc */


void *__PHYSFS_platformAllocatorRealloc(void *ptr, PHYSFS_uint64 s)
{
BAIL_IF_MACRO(__PHYSFS_ui64FitsAddressSpace(s), ERR_OUT_OF_MEMORY, NULL);
#undef realloc
return(realloc(ptr, (size_t) s));
} /* __PHYSFS_platformRealloc */


void __PHYSFS_platformAllocatorFree(void *ptr)
{
#undef free
free(ptr);
} /* __PHYSFS_platformAllocatorFree */
return(0); /* just use malloc() and friends. */
} /* __PHYSFS_platformSetDefaultAllocator */

#endif /* PHYSFS_PLATFORM_POCKETPC */

0 comments on commit 857d9bc

Please sign in to comment.