Index: /trunk/psLib/src/sys/psMemory.c
===================================================================
--- /trunk/psLib/src/sys/psMemory.c	(revision 468)
+++ /trunk/psLib/src/sys/psMemory.c	(revision 469)
@@ -8,6 +8,6 @@
  *  @author Robert Lupton, Princeton University
  *
- *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-04-20 02:52:48 $
+ *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-04-20 02:58:46 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -48,7 +48,10 @@
     psMemExhaustedCallback old = memExhaustedCallback;
 
-    if (func != NULL) {
+    if (func != NULL)
+    {
         memExhaustedCallback = func;
-    } else {
+    }
+    else
+    {
         memExhaustedCallback = memExhaustedCallbackDefault;
     }
@@ -62,9 +65,12 @@
     checkMemBlock(ptr, __func__);
 
-    if (ptr->refCounter <= 0) {
+    if (ptr->refCounter <= 0)
+    {
         psError(__func__,
                 "Block %ld allocated at %s:%d freed more than once at %s:%d\n",
                 ptr->id, ptr->file, ptr->lineno, file, lineno);
-    } else if (ptr->refCounter > 1) {
+    }
+    else if (ptr->refCounter > 1)
+    {
         psError(__func__,
                 "Block %ld allocated at %s:%d freed while still referenced at %s:%d\n",
@@ -72,5 +78,6 @@
     }
 
-    if (lineno > 0) {
+    if (lineno > 0)
+    {
         psAbort(__func__, "Detected a problem in the memory system at %s:%d", file, lineno);
     }
@@ -82,7 +89,10 @@
     psMemProblemCallback old = memProblemCallback;
 
-    if (func != NULL) {
+    if (func != NULL)
+    {
         memProblemCallback = func;
-    } else {
+    }
+    else
+    {
         memProblemCallback = memProblemCallbackDefault;
     }
@@ -144,7 +154,10 @@
     psMemFreeCallback old = memAllocateCallback;
 
-    if (func != NULL) {
+    if (func != NULL)
+    {
         memAllocateCallback =  func;
-    } else {
+    }
+    else
+    {
         memAllocateCallback = memAllocateCallbackDefault;
     }
@@ -157,7 +170,10 @@
     psMemFreeCallback old = memFreeCallback;
 
-    if (func != NULL) {
+    if (func != NULL)
+    {
         memFreeCallback = func;
-    } else {
+    }
+    else
+    {
         memFreeCallback = memFreeCallbackDefault;
     }
@@ -188,15 +204,18 @@
     // we shouldn't call such things as p_psAlloc/p_psFree here.
 
-    if (m == NULL) {
+    if (m == NULL)
+    {
         psError(funcName,"Memory Corruption: NULL memory block found.");
         return(1);
     }
 
-    if (!ALIGNED(m)) {
+    if (!ALIGNED(m))
+    {
         psError(funcName, "psMemCheckCorruption: non-aligned memory block");
         return(1);
     }
 
-    if (m->startblock != P_PS_MEMMAGIC || m->endblock != P_PS_MEMMAGIC) {
+    if (m->startblock != P_PS_MEMMAGIC || m->endblock != P_PS_MEMMAGIC)
+    {
         psError(funcName, "psMemCheckCorruption: memory block %ld is corrupted", m->id);
         return(1);
@@ -213,11 +232,14 @@
     pthread_mutex_lock(&memBlockListMutex);
 
-    for (psMemBlock* iter=lastMemBlockAllocated; iter != NULL; iter=iter->nextBlock) {
-        if (checkMemBlock(iter, __func__)) {
+    for (psMemBlock* iter=lastMemBlockAllocated; iter != NULL; iter=iter->nextBlock)
+    {
+        if (checkMemBlock(iter, __func__))
+        {
             nbad++;
 
             memProblemCallback(iter, __func__, __LINE__);
 
-            if (abort_on_error) {
+            if (abort_on_error)
+            {
                 // release the lock on the memblock list
                 pthread_mutex_unlock(&memBlockListMutex);
@@ -237,7 +259,9 @@
     psMemBlock *ptr = malloc(sizeof(psMemBlock) + size);
 
-    if (ptr == NULL) {
+    if (ptr == NULL)
+    {
         ptr = memExhaustedCallback(size);
-        if (ptr == NULL) {
+        if (ptr == NULL)
+        {
             psAbort(__func__, "Failed to allocate %ld bytes at %s:%d",
                     size, file, lineno);
@@ -258,5 +282,6 @@
     ptr->previousBlock = NULL;
     ptr->nextBlock = lastMemBlockAllocated;
-    if (ptr->nextBlock != NULL) {
+    if (ptr->nextBlock != NULL)
+    {
         ptr->nextBlock->previousBlock = ptr;
     }
@@ -266,5 +291,6 @@
 
     //  Did the user ask to be informed about this allocation?
-    if (ptr->id == p_psMemAllocateID) {
+    if (ptr->id == p_psMemAllocateID)
+    {
         p_psMemAllocateID += memAllocateCallback(ptr);
     }
@@ -276,7 +302,10 @@
 void *p_psRealloc(void *vptr, size_t size, const char *file, int lineno)
 {
-    if (vptr == NULL) {
+    if (vptr == NULL)
+    {
         return p_psAlloc(size, file, lineno);
-    } else {
+    }
+    else
+    {
         psMemBlock *ptr = ((psMemBlock *)vptr) - 1;
 
@@ -286,8 +315,10 @@
 
         // the block location may have changed, so fix the linked list addresses.
-        if (ptr->nextBlock != NULL) {
+        if (ptr->nextBlock != NULL)
+        {
             ptr->nextBlock->previousBlock = ptr;
         }
-        if (ptr->previousBlock != NULL) {
+        if (ptr->previousBlock != NULL)
+        {
             ptr->previousBlock->nextBlock = ptr;
         }
@@ -301,5 +332,6 @@
 void p_psFree(void *vptr, const char *file, int lineno)
 {
-    if (vptr == NULL) {
+    if (vptr == NULL)
+    {
         return;
     }
@@ -308,27 +340,37 @@
 
     // Did the user ask to be informed about this deallocation?
-    if (ptr->id == p_psMemFreeID) {
+    if (ptr->id == p_psMemFreeID)
+    {
         p_psMemFreeID += memFreeCallback(ptr);
     }
 
-    if (checkMemBlock(ptr, "psFree") != 0) {
+    if (checkMemBlock(ptr, "psFree") != 0)
+    {
         memProblemCallback(ptr, file, lineno); // we may not own this block; don't free it
-    } else {
-        if (ptr->refCounter > 1) {
+    }
+    else
+    {
+        if (ptr->refCounter > 1)
+        {
             psError(__func__,"The buffer being freed is referenced elsewhere. "
                     "Buffer's reference count was decremented instead.");
             ptr->refCounter--;
             memProblemCallback(ptr, file, lineno);
-        } else {
+        }
+        else
+        {
 
             // cut the memBlock out of the memBlock list
             pthread_mutex_lock(&memBlockListMutex);
-            if (ptr->nextBlock != NULL) {
+            if (ptr->nextBlock != NULL)
+            {
                 ptr->nextBlock->previousBlock = ptr->previousBlock;
             }
-            if (ptr->previousBlock != NULL) {
+            if (ptr->previousBlock != NULL)
+            {
                 ptr->previousBlock->nextBlock = ptr->nextBlock;
             }
-            if (lastMemBlockAllocated == ptr) {
+            if (lastMemBlockAllocated == ptr)
+            {
                 lastMemBlockAllocated = ptr->nextBlock;
             }
@@ -356,9 +398,12 @@
     for (psMemBlock* iter = lastMemBlockAllocated; iter != NULL; iter=iter->nextBlock)
     {
-        if ( (iter->refCounter > 0) && (iter->id >= id0) ) {
+        if ( (iter->refCounter > 0) && (iter->id >= id0) )
+        {
             nleak++;
 
-            if (fd != NULL) {
-                if (nleak == 1) {
+            if (fd != NULL)
+            {
+                if (nleak == 1)
+                {
                     fprintf(fd, "   %20s:line ID\n", "file");
                 }
@@ -384,7 +429,9 @@
     for (psMemBlock* iter = lastMemBlockAllocated; iter != NULL; iter=iter->nextBlock)
     {
-        if ( (iter->refCounter > 0) && (iter->id >= id0) ) {
+        if ( (iter->refCounter > 0) && (iter->id >= id0) )
+        {
             (*arr)[j++] = iter;
-            if (j == nleak) { // found them all
+            if (j == nleak)
+            { // found them all
                 break;
             }
Index: /trunk/psLib/src/sysUtils/psMemory.c
===================================================================
--- /trunk/psLib/src/sysUtils/psMemory.c	(revision 468)
+++ /trunk/psLib/src/sysUtils/psMemory.c	(revision 469)
@@ -8,6 +8,6 @@
  *  @author Robert Lupton, Princeton University
  *
- *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-04-20 02:52:48 $
+ *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-04-20 02:58:46 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -48,7 +48,10 @@
     psMemExhaustedCallback old = memExhaustedCallback;
 
-    if (func != NULL) {
+    if (func != NULL)
+    {
         memExhaustedCallback = func;
-    } else {
+    }
+    else
+    {
         memExhaustedCallback = memExhaustedCallbackDefault;
     }
@@ -62,9 +65,12 @@
     checkMemBlock(ptr, __func__);
 
-    if (ptr->refCounter <= 0) {
+    if (ptr->refCounter <= 0)
+    {
         psError(__func__,
                 "Block %ld allocated at %s:%d freed more than once at %s:%d\n",
                 ptr->id, ptr->file, ptr->lineno, file, lineno);
-    } else if (ptr->refCounter > 1) {
+    }
+    else if (ptr->refCounter > 1)
+    {
         psError(__func__,
                 "Block %ld allocated at %s:%d freed while still referenced at %s:%d\n",
@@ -72,5 +78,6 @@
     }
 
-    if (lineno > 0) {
+    if (lineno > 0)
+    {
         psAbort(__func__, "Detected a problem in the memory system at %s:%d", file, lineno);
     }
@@ -82,7 +89,10 @@
     psMemProblemCallback old = memProblemCallback;
 
-    if (func != NULL) {
+    if (func != NULL)
+    {
         memProblemCallback = func;
-    } else {
+    }
+    else
+    {
         memProblemCallback = memProblemCallbackDefault;
     }
@@ -144,7 +154,10 @@
     psMemFreeCallback old = memAllocateCallback;
 
-    if (func != NULL) {
+    if (func != NULL)
+    {
         memAllocateCallback =  func;
-    } else {
+    }
+    else
+    {
         memAllocateCallback = memAllocateCallbackDefault;
     }
@@ -157,7 +170,10 @@
     psMemFreeCallback old = memFreeCallback;
 
-    if (func != NULL) {
+    if (func != NULL)
+    {
         memFreeCallback = func;
-    } else {
+    }
+    else
+    {
         memFreeCallback = memFreeCallbackDefault;
     }
@@ -188,15 +204,18 @@
     // we shouldn't call such things as p_psAlloc/p_psFree here.
 
-    if (m == NULL) {
+    if (m == NULL)
+    {
         psError(funcName,"Memory Corruption: NULL memory block found.");
         return(1);
     }
 
-    if (!ALIGNED(m)) {
+    if (!ALIGNED(m))
+    {
         psError(funcName, "psMemCheckCorruption: non-aligned memory block");
         return(1);
     }
 
-    if (m->startblock != P_PS_MEMMAGIC || m->endblock != P_PS_MEMMAGIC) {
+    if (m->startblock != P_PS_MEMMAGIC || m->endblock != P_PS_MEMMAGIC)
+    {
         psError(funcName, "psMemCheckCorruption: memory block %ld is corrupted", m->id);
         return(1);
@@ -213,11 +232,14 @@
     pthread_mutex_lock(&memBlockListMutex);
 
-    for (psMemBlock* iter=lastMemBlockAllocated; iter != NULL; iter=iter->nextBlock) {
-        if (checkMemBlock(iter, __func__)) {
+    for (psMemBlock* iter=lastMemBlockAllocated; iter != NULL; iter=iter->nextBlock)
+    {
+        if (checkMemBlock(iter, __func__))
+        {
             nbad++;
 
             memProblemCallback(iter, __func__, __LINE__);
 
-            if (abort_on_error) {
+            if (abort_on_error)
+            {
                 // release the lock on the memblock list
                 pthread_mutex_unlock(&memBlockListMutex);
@@ -237,7 +259,9 @@
     psMemBlock *ptr = malloc(sizeof(psMemBlock) + size);
 
-    if (ptr == NULL) {
+    if (ptr == NULL)
+    {
         ptr = memExhaustedCallback(size);
-        if (ptr == NULL) {
+        if (ptr == NULL)
+        {
             psAbort(__func__, "Failed to allocate %ld bytes at %s:%d",
                     size, file, lineno);
@@ -258,5 +282,6 @@
     ptr->previousBlock = NULL;
     ptr->nextBlock = lastMemBlockAllocated;
-    if (ptr->nextBlock != NULL) {
+    if (ptr->nextBlock != NULL)
+    {
         ptr->nextBlock->previousBlock = ptr;
     }
@@ -266,5 +291,6 @@
 
     //  Did the user ask to be informed about this allocation?
-    if (ptr->id == p_psMemAllocateID) {
+    if (ptr->id == p_psMemAllocateID)
+    {
         p_psMemAllocateID += memAllocateCallback(ptr);
     }
@@ -276,7 +302,10 @@
 void *p_psRealloc(void *vptr, size_t size, const char *file, int lineno)
 {
-    if (vptr == NULL) {
+    if (vptr == NULL)
+    {
         return p_psAlloc(size, file, lineno);
-    } else {
+    }
+    else
+    {
         psMemBlock *ptr = ((psMemBlock *)vptr) - 1;
 
@@ -286,8 +315,10 @@
 
         // the block location may have changed, so fix the linked list addresses.
-        if (ptr->nextBlock != NULL) {
+        if (ptr->nextBlock != NULL)
+        {
             ptr->nextBlock->previousBlock = ptr;
         }
-        if (ptr->previousBlock != NULL) {
+        if (ptr->previousBlock != NULL)
+        {
             ptr->previousBlock->nextBlock = ptr;
         }
@@ -301,5 +332,6 @@
 void p_psFree(void *vptr, const char *file, int lineno)
 {
-    if (vptr == NULL) {
+    if (vptr == NULL)
+    {
         return;
     }
@@ -308,27 +340,37 @@
 
     // Did the user ask to be informed about this deallocation?
-    if (ptr->id == p_psMemFreeID) {
+    if (ptr->id == p_psMemFreeID)
+    {
         p_psMemFreeID += memFreeCallback(ptr);
     }
 
-    if (checkMemBlock(ptr, "psFree") != 0) {
+    if (checkMemBlock(ptr, "psFree") != 0)
+    {
         memProblemCallback(ptr, file, lineno); // we may not own this block; don't free it
-    } else {
-        if (ptr->refCounter > 1) {
+    }
+    else
+    {
+        if (ptr->refCounter > 1)
+        {
             psError(__func__,"The buffer being freed is referenced elsewhere. "
                     "Buffer's reference count was decremented instead.");
             ptr->refCounter--;
             memProblemCallback(ptr, file, lineno);
-        } else {
+        }
+        else
+        {
 
             // cut the memBlock out of the memBlock list
             pthread_mutex_lock(&memBlockListMutex);
-            if (ptr->nextBlock != NULL) {
+            if (ptr->nextBlock != NULL)
+            {
                 ptr->nextBlock->previousBlock = ptr->previousBlock;
             }
-            if (ptr->previousBlock != NULL) {
+            if (ptr->previousBlock != NULL)
+            {
                 ptr->previousBlock->nextBlock = ptr->nextBlock;
             }
-            if (lastMemBlockAllocated == ptr) {
+            if (lastMemBlockAllocated == ptr)
+            {
                 lastMemBlockAllocated = ptr->nextBlock;
             }
@@ -356,9 +398,12 @@
     for (psMemBlock* iter = lastMemBlockAllocated; iter != NULL; iter=iter->nextBlock)
     {
-        if ( (iter->refCounter > 0) && (iter->id >= id0) ) {
+        if ( (iter->refCounter > 0) && (iter->id >= id0) )
+        {
             nleak++;
 
-            if (fd != NULL) {
-                if (nleak == 1) {
+            if (fd != NULL)
+            {
+                if (nleak == 1)
+                {
                     fprintf(fd, "   %20s:line ID\n", "file");
                 }
@@ -384,7 +429,9 @@
     for (psMemBlock* iter = lastMemBlockAllocated; iter != NULL; iter=iter->nextBlock)
     {
-        if ( (iter->refCounter > 0) && (iter->id >= id0) ) {
+        if ( (iter->refCounter > 0) && (iter->id >= id0) )
+        {
             (*arr)[j++] = iter;
-            if (j == nleak) { // found them all
+            if (j == nleak)
+            { // found them all
                 break;
             }
