[Scummvm-cvs-logs] SF.net SVN: scummvm: [31338] scummvm/trunk/common

eriktorbjorn at users.sourceforge.net eriktorbjorn at users.sourceforge.net
Sun Mar 30 20:53:16 CEST 2008


Revision: 31338
          http://scummvm.svn.sourceforge.net/scummvm/?rev=31338&view=rev
Author:   eriktorbjorn
Date:     2008-03-30 11:53:16 -0700 (Sun, 30 Mar 2008)

Log Message:
-----------
Some minor whitespace changes, and the customary "end of namespace" comment.

Modified Paths:
--------------
    scummvm/trunk/common/memorypool.cpp
    scummvm/trunk/common/memorypool.h

Modified: scummvm/trunk/common/memorypool.cpp
===================================================================
--- scummvm/trunk/common/memorypool.cpp	2008-03-30 18:41:55 UTC (rev 31337)
+++ scummvm/trunk/common/memorypool.cpp	2008-03-30 18:53:16 UTC (rev 31338)
@@ -26,8 +26,7 @@
 #include "common/memorypool.h"
 #include "common/util.h"
 
-namespace Common
-{
+namespace Common {
 
 static const size_t CHUNK_PAGE_SIZE = 32;
 
@@ -35,7 +34,7 @@
 	void* result = ::malloc(CHUNK_PAGE_SIZE * _chunkSize);
 	_pages.push_back(result);
 	void* current = result;
-	for(size_t i=1; i<CHUNK_PAGE_SIZE; ++i) {
+	for (size_t i = 1; i < CHUNK_PAGE_SIZE; ++i) {
 		void* next    = ((char*)current + _chunkSize);
 		*(void**)current = next;
 
@@ -56,13 +55,13 @@
 }
 
 MemoryPool::~MemoryPool() {
-	for(size_t i=0; i<_pages.size(); ++i)
+	for (size_t i = 0; i<_pages.size(); ++i)
 	::free(_pages[i]);
 }
 
 void* MemoryPool::malloc() {
 #if 1
-	if(!_next)
+	if (!_next)
 		_next = allocPage();
 
 	void* result = _next;
@@ -91,15 +90,15 @@
 	//std::sort(_pages.begin(), _pages.end());
 	Array<size_t> numberOfFreeChunksPerPage;
 	numberOfFreeChunksPerPage.resize(_pages.size());
-	for(size_t i=0; i<numberOfFreeChunksPerPage.size(); ++i) {
+	for (size_t i = 0; i < numberOfFreeChunksPerPage.size(); ++i) {
 		numberOfFreeChunksPerPage[i] = 0;
 	}
 
 	void* iterator = _next;
-	while(iterator) {
+	while (iterator) {
 		// This should be a binary search
-		for(size_t i=0; i<_pages.size(); ++i) {
-			if(isPointerInPage(iterator, _pages[i])) {
+		for (size_t i = 0; i < _pages.size(); ++i) {
+			if (isPointerInPage(iterator, _pages[i])) {
 				++numberOfFreeChunksPerPage[i];
 				break;
 			}
@@ -108,8 +107,8 @@
 	}
 
 	size_t freedPagesCount = 0;
-	for(size_t i=0; i<_pages.size(); ++i) {
-		if(numberOfFreeChunksPerPage[i] == CHUNK_PAGE_SIZE) {
+	for (size_t i = 0; i < _pages.size(); ++i) {
+		if (numberOfFreeChunksPerPage[i] == CHUNK_PAGE_SIZE) {
 			::free(_pages[i]);
 			_pages[i] = NULL; // TODO : Remove NULL values
 			++freedPagesCount;
@@ -119,4 +118,4 @@
 	//printf("%d freed pages\n", freedPagesCount); 
 }
 
-}
+}	// End of namespace Common

Modified: scummvm/trunk/common/memorypool.h
===================================================================
--- scummvm/trunk/common/memorypool.h	2008-03-30 18:41:55 UTC (rev 31337)
+++ scummvm/trunk/common/memorypool.h	2008-03-30 18:53:16 UTC (rev 31338)
@@ -29,11 +29,9 @@
 #include "common/scummsys.h"
 #include "common/array.h"
 
-namespace Common
-{
+namespace Common {
 
-class MemoryPool
-{
+class MemoryPool {
 private:
 	MemoryPool(const MemoryPool&);
 	MemoryPool& operator=(const MemoryPool&);
@@ -54,6 +52,6 @@
 	void	freeUnusedPages();
 };
 
-}
+}	// End of namespace Common
 
 #endif


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list