physfs.c
changeset 751 74dc021744de
parent 746 88780f7156d3
child 754 e7cd7411eadf
equal deleted inserted replaced
749:8cffa18efa85 751:74dc021744de
   775     BAIL_IF_MACRO(initialized, ERR_IS_INITIALIZED, 0);
   775     BAIL_IF_MACRO(initialized, ERR_IS_INITIALIZED, 0);
   776 
   776 
   777     if (!externalAllocator)
   777     if (!externalAllocator)
   778         setDefaultAllocator();
   778         setDefaultAllocator();
   779 
   779 
   780     BAIL_IF_MACRO(!allocator.Init(), NULL, 0);
   780     if (allocator.Init != NULL)
       
   781         BAIL_IF_MACRO(!allocator.Init(), NULL, 0);
   781 
   782 
   782     BAIL_IF_MACRO(!__PHYSFS_platformInit(), NULL, 0);
   783     BAIL_IF_MACRO(!__PHYSFS_platformInit(), NULL, 0);
   783 
   784 
   784     BAIL_IF_MACRO(!initializeMutexes(), NULL, 0);
   785     BAIL_IF_MACRO(!initializeMutexes(), NULL, 0);
   785 
   786 
   887     initialized = 0;
   888     initialized = 0;
   888 
   889 
   889     __PHYSFS_platformDestroyMutex(errorLock);
   890     __PHYSFS_platformDestroyMutex(errorLock);
   890     __PHYSFS_platformDestroyMutex(stateLock);
   891     __PHYSFS_platformDestroyMutex(stateLock);
   891 
   892 
   892     allocator.Deinit();
   893     if (allocator.Deinit != NULL)
       
   894         allocator.Deinit();
   893 
   895 
   894     errorLock = stateLock = NULL;
   896     errorLock = stateLock = NULL;
   895     return(1);
   897     return(1);
   896 } /* PHYSFS_deinit */
   898 } /* PHYSFS_deinit */
   897 
   899 
  2045     fh->bufpos = fh->buffill = 0;
  2047     fh->bufpos = fh->buffill = 0;
  2046     return(1);
  2048     return(1);
  2047 } /* PHYSFS_flush */
  2049 } /* PHYSFS_flush */
  2048 
  2050 
  2049 
  2051 
  2050 int PHYSFS_setAllocator(PHYSFS_Allocator *a)
  2052 int PHYSFS_setAllocator(const PHYSFS_Allocator *a)
  2051 {
  2053 {
  2052     BAIL_IF_MACRO(initialized, ERR_IS_INITIALIZED, 0);
  2054     BAIL_IF_MACRO(initialized, ERR_IS_INITIALIZED, 0);
  2053     externalAllocator = (a != NULL);
  2055     externalAllocator = (a != NULL);
  2054     if (externalAllocator)
  2056     if (externalAllocator)
  2055         memcpy(&allocator, a, sizeof (PHYSFS_Allocator));
  2057         memcpy(&allocator, a, sizeof (PHYSFS_Allocator));