Author: fireball
Date: Tue Sep 29 11:14:08 2009
New Revision: 43221
URL:
http://svn.reactos.org/svn/reactos?rev=43221&view=rev
Log:
[fullfat]
- Remove all malloc/free usage in the library and substitute them by user-provided
FF_Malloc and FF_Free functions.
- Cleanup fullfat.rbuild.
Modified:
trunk/reactos/include/reactos/libs/fullfat/ff_memory.h
trunk/reactos/lib/3rdparty/fullfat/ff_file.c
trunk/reactos/lib/3rdparty/fullfat/ff_hash.c
trunk/reactos/lib/3rdparty/fullfat/ff_ioman.c
trunk/reactos/lib/3rdparty/fullfat/fullfat.rbuild
Modified: trunk/reactos/include/reactos/libs/fullfat/ff_memory.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/libs/fullf…
==============================================================================
--- trunk/reactos/include/reactos/libs/fullfat/ff_memory.h [iso-8859-1] (original)
+++ trunk/reactos/include/reactos/libs/fullfat/ff_memory.h [iso-8859-1] Tue Sep 29
11:14:08 2009
@@ -52,5 +52,8 @@
void FF_putShort (FF_T_UINT8 *pBuffer, FF_T_UINT16 offset, FF_T_UINT16 Value);
void FF_putLong (FF_T_UINT8 *pBuffer, FF_T_UINT16 offset, FF_T_UINT32 Value);
+void *FF_Malloc(FF_T_UINT32 allocSize);
+void FF_Free(void *pBuffer);
+
#endif
Modified: trunk/reactos/lib/3rdparty/fullfat/ff_file.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/fullfat/ff_fi…
==============================================================================
--- trunk/reactos/lib/3rdparty/fullfat/ff_file.c [iso-8859-1] (original)
+++ trunk/reactos/lib/3rdparty/fullfat/ff_file.c [iso-8859-1] Tue Sep 29 11:14:08 2009
@@ -163,7 +163,7 @@
}
return (FF_FILE *)NULL;
}
- pFile = malloc(sizeof(FF_FILE));
+ pFile = FF_Malloc(sizeof(FF_FILE));
if(!pFile) {
if(pError) {
*pError = FF_ERR_NOT_ENOUGH_MEMORY;
Modified: trunk/reactos/lib/3rdparty/fullfat/ff_hash.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/fullfat/ff_ha…
==============================================================================
--- trunk/reactos/lib/3rdparty/fullfat/ff_hash.c [iso-8859-1] (original)
+++ trunk/reactos/lib/3rdparty/fullfat/ff_hash.c [iso-8859-1] Tue Sep 29 11:14:08 2009
@@ -53,7 +53,7 @@
*
**/
FF_HASH_TABLE FF_CreateHashTable() {
- FF_HASH_TABLE pHash = (FF_HASH_TABLE) malloc(sizeof(struct _FF_HASH_TABLE));
+ FF_HASH_TABLE pHash = (FF_HASH_TABLE) FF_Malloc(sizeof(struct _FF_HASH_TABLE));
if(pHash) {
FF_ClearHashTable(pHash);
Modified: trunk/reactos/lib/3rdparty/fullfat/ff_ioman.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/fullfat/ff_io…
==============================================================================
--- trunk/reactos/lib/3rdparty/fullfat/ff_ioman.c [iso-8859-1] (original)
+++ trunk/reactos/lib/3rdparty/fullfat/ff_ioman.c [iso-8859-1] Tue Sep 29 11:14:08 2009
@@ -89,7 +89,7 @@
return NULL; // Memory Size not a multiple of BlkSize > 0
}
- pIoman = (FF_IOMAN *) malloc(sizeof(FF_IOMAN));
+ pIoman = (FF_IOMAN *) FF_Malloc(sizeof(FF_IOMAN));
if(!pIoman) { // Ensure malloc() succeeded.
if(pError) {
@@ -106,7 +106,7 @@
pIoman->pPartition = NULL;
pIoman->pSemaphore = NULL;
- pIoman->pPartition = (FF_PARTITION *) malloc(sizeof(FF_PARTITION));
+ pIoman->pPartition = (FF_PARTITION *) FF_Malloc(sizeof(FF_PARTITION));
if(pIoman->pPartition) { // If succeeded, flag that allocation.
pIoman->MemAllocation |= FF_IOMAN_ALLOC_PART;
pIoman->pPartition->LastFreeCluster = 0;
@@ -127,7 +127,7 @@
return NULL;
}
- pIoman->pBlkDevice = (FF_BLK_DEVICE *) malloc(sizeof(FF_BLK_DEVICE));
+ pIoman->pBlkDevice = (FF_BLK_DEVICE *) FF_Malloc(sizeof(FF_BLK_DEVICE));
if(pIoman->pBlkDevice) { // If succeeded, flag that allocation.
pIoman->MemAllocation |= FF_IOMAN_ALLOC_BLKDEV;
@@ -145,7 +145,7 @@
if(pCacheMem) {
pIoman->pCacheMem = pCacheMem;
}else { // No-Cache buffer provided (malloc)
- pLong = (FF_T_UINT32 *) malloc(Size);
+ pLong = (FF_T_UINT32 *) FF_Malloc(Size);
pIoman->pCacheMem = (FF_T_UINT8 *) pLong;
if(!pIoman->pCacheMem) {
pIoman->MemAllocation |= FF_IOMAN_ALLOC_BUFFERS;
@@ -163,7 +163,7 @@
/* Malloc() memory for buffer objects. (FullFAT never refers to a buffer directly
but uses buffer objects instead. Allows us to provide thread safety.
*/
- pIoman->pBuffers = (FF_BUFFER *) malloc(sizeof(FF_BUFFER) * pIoman->CacheSize);
+ pIoman->pBuffers = (FF_BUFFER *) FF_Malloc(sizeof(FF_BUFFER) *
pIoman->CacheSize);
if(pIoman->pBuffers) {
pIoman->MemAllocation |= FF_IOMAN_ALLOC_BUFDESCR;
@@ -196,22 +196,22 @@
// Ensure pPartition pointer was allocated.
if((pIoman->MemAllocation & FF_IOMAN_ALLOC_PART)) {
- free(pIoman->pPartition);
+ FF_Free(pIoman->pPartition);
}
// Ensure pBlkDevice pointer was allocated.
if((pIoman->MemAllocation & FF_IOMAN_ALLOC_BLKDEV)) {
- free(pIoman->pBlkDevice);
+ FF_Free(pIoman->pBlkDevice);
}
// Ensure pBuffers pointer was allocated.
if((pIoman->MemAllocation & FF_IOMAN_ALLOC_BUFDESCR)) {
- free(pIoman->pBuffers);
+ FF_Free(pIoman->pBuffers);
}
// Ensure pCacheMem pointer was allocated.
if((pIoman->MemAllocation & FF_IOMAN_ALLOC_BUFFERS)) {
- free(pIoman->pCacheMem);
+ FF_Free(pIoman->pCacheMem);
}
// Destroy any Semaphore that was created.
@@ -220,7 +220,7 @@
}
// Finally free the FF_IOMAN object.
- free(pIoman);
+ FF_Free(pIoman);
return FF_ERR_NONE;
}
Modified: trunk/reactos/lib/3rdparty/fullfat/fullfat.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/fullfat/fullf…
==============================================================================
--- trunk/reactos/lib/3rdparty/fullfat/fullfat.rbuild [iso-8859-1] (original)
+++ trunk/reactos/lib/3rdparty/fullfat/fullfat.rbuild [iso-8859-1] Tue Sep 29 11:14:08
2009
@@ -1,8 +1,7 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
-<module name="fullfat" type="staticlibrary"
allowwarnings="true">
+<module name="fullfat" type="staticlibrary">
<include base="ReactOS">include/reactos/libs/fullfat</include>
- <define name="_DISABLE_TIDENTS" />
<define name="__NTDRIVER__" />
<define name="__NO_CTYPE_INLINES" />