Index: trunk/psLib/src/sysUtils/psMemory.c
===================================================================
--- trunk/psLib/src/sysUtils/psMemory.c	(revision 1840)
+++ trunk/psLib/src/sysUtils/psMemory.c	(revision 2204)
@@ -8,6 +8,6 @@
 *  @author Robert Lupton, Princeton University
 *
-*  @version $Revision: 1.41 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-09-21 22:30:19 $
+*  @version $Revision: 1.42 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-10-27 00:57:31 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -18,5 +18,4 @@
 #include <stdlib.h>
 #include <stdio.h>
-#include <stdbool.h>
 #include <stdint.h>
 
@@ -28,9 +27,9 @@
 #include "psSysUtilsErrors.h"
 
-#define P_PS_MEMMAGIC (void *)0xdeadbeef   // Magic number in psMemBlock header
+#define P_PS_MEMMAGIC (psPtr )0xdeadbeef   // Magic number in psMemBlock header
 
 #define P_PS_LARGE_BLOCK_SIZE 65536        // size where under, we try to recycle
 
-static int checkMemBlock(const psMemBlock* m, const char *funcName);
+static psS32 checkMemBlock(const psMemBlock* m, const char *funcName);
 static psMemBlock* lastMemBlockAllocated = NULL;
 static pthread_mutex_t memBlockListMutex = PTHREAD_MUTEX_INITIALIZER;
@@ -39,8 +38,8 @@
 static pthread_mutex_t recycleMemBlockListMutex = PTHREAD_MUTEX_INITIALIZER;
 
-static int recycleBins = 13;
-static int recycleBinSize[14] = {
-                                    8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, P_PS_LARGE_BLOCK_SIZE
-                                };
+static psS32 recycleBins = 13;
+static psS32 recycleBinSize[14] = {
+                                      8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, P_PS_LARGE_BLOCK_SIZE
+                                  };
 
 // N.B. recycleBinSize should be terminated by P_PS_LARGE_BLOCK_SIZE (simplifies search loops)
@@ -61,10 +60,10 @@
  *  Default memExhausted callback.
  */
-static void *memExhaustedCallbackDefault(size_t size)
-{
-    void *ptr = NULL;
+static psPtr memExhaustedCallbackDefault(size_t size)
+{
+    psPtr ptr = NULL;
 
     pthread_mutex_lock(&recycleMemBlockListMutex);
-    int level = recycleBins - 1;
+    psS32 level = recycleBins - 1;
 
     while (level >= 0 && ptr == NULL) {
@@ -98,5 +97,5 @@
 }
 
-static void memProblemCallbackDefault(const psMemBlock* ptr, const char *file, int lineno)
+static void memProblemCallbackDefault(const psMemBlock* ptr, const char *file, psS32 lineno)
 {
     if (ptr->refCounter < 1) {
@@ -223,5 +222,5 @@
  */
 
-static int checkMemBlock(const psMemBlock* m, const char *funcName)
+static psS32 checkMemBlock(const psMemBlock* m, const char *funcName)
 {
     // n.b. since this is called by psMemCheckCorruption while the memblock list is mutex locked,
@@ -248,5 +247,5 @@
         return 1;
     }
-    if (*(void **)((int8_t *) (m + 1) + m->userMemorySize) != P_PS_MEMMAGIC) {
+    if (*(psPtr *)((int8_t *) (m + 1) + m->userMemorySize) != P_PS_MEMMAGIC) {
         psErrorMsg(PS_ERRORNAME_DOMAIN "checkMemBlock", true, PS_ERR_MEMORY_CORRUPTION,
                    PS_ERRORTEXT_psMemory_OVERFLOW,
@@ -258,8 +257,8 @@
 }
 
-int psMemCheckCorruption(bool abort_on_error)
-{
-    int nbad = 0;               // number of bad blocks
-    bool failure = false;
+psS32 psMemCheckCorruption(psBool abort_on_error)
+{
+    psS32 nbad = 0;               // number of bad blocks
+    psBool failure = false;
 
     // get exclusive access to the memBlock list to avoid it changing on us while we use it.
@@ -289,5 +288,5 @@
 }
 
-void *p_psAlloc(size_t size, const char *file, int lineno)
+psPtr p_psAlloc(size_t size, const char *file, psS32 lineno)
 {
 
@@ -297,5 +296,5 @@
     if (size < P_PS_LARGE_BLOCK_SIZE) {
         // find the bin we need.
-        int level = 0;
+        psS32 level = 0;
 
         while (size > recycleBinSize[level]) {
@@ -323,5 +322,5 @@
 
     if (ptr == NULL) {
-        ptr = malloc(sizeof(psMemBlock) + size + sizeof(void *));
+        ptr = malloc(sizeof(psMemBlock) + size + sizeof(psPtr ));
 
         if (ptr == NULL) {
@@ -332,6 +331,6 @@
         }
 
-        ptr->startblock = P_PS_MEMMAGIC;
-        ptr->endblock = P_PS_MEMMAGIC;
+        *(psPtr*)&ptr->startblock = P_PS_MEMMAGIC;
+        *(psPtr*)&ptr->endblock = P_PS_MEMMAGIC;
         ptr->userMemorySize = size;
         pthread_mutex_init(&ptr->refCounterMutex, NULL);
@@ -345,6 +344,6 @@
     ptr->freeFcn = NULL;
     ptr->persistent = false;
-    *(unsigned int *)&ptr->lineno = lineno;
-    *(void **)((int8_t *) (ptr + 1) + size) = P_PS_MEMMAGIC;
+    *(psU32 *)&ptr->lineno = lineno;
+    *(psPtr *)((int8_t *) (ptr + 1) + size) = P_PS_MEMMAGIC;
     ptr->previousBlock = NULL;
 
@@ -371,5 +370,5 @@
 }
 
-void *p_psRealloc(void *vptr, size_t size, const char *file, int lineno)
+psPtr p_psRealloc(psPtr vptr, size_t size, const char *file, psS32 lineno)
 {
     if (vptr == NULL) {
@@ -377,5 +376,5 @@
     } else {
         psMemBlock* ptr = ((psMemBlock* ) vptr) - 1;
-        bool isBlockLast = false;
+        psBool isBlockLast = false;
 
         if (checkMemBlock(ptr, __func__) != 0) {
@@ -389,5 +388,5 @@
         isBlockLast = (ptr == lastMemBlockAllocated);
 
-        ptr = (psMemBlock* ) realloc(ptr, sizeof(psMemBlock) + size + sizeof(void *));
+        ptr = (psMemBlock* ) realloc(ptr, sizeof(psMemBlock) + size + sizeof(psPtr ));
 
         if (ptr == NULL) {
@@ -399,5 +398,5 @@
 
         ptr->userMemorySize = size;
-        *(void **)((int8_t *) (ptr + 1) + size) = P_PS_MEMMAGIC;
+        *(psPtr *)((int8_t *) (ptr + 1) + size) = P_PS_MEMMAGIC;
 
         if (isBlockLast) {
@@ -423,5 +422,5 @@
 }
 
-void p_psFree(void *vptr, const char *file, int lineno)
+void p_psFree(psPtr vptr, const char *file, psS32 lineno)
 {
     if (vptr == NULL) {
@@ -444,8 +443,8 @@
  * Check for memory leaks.
  */
-int psMemCheckLeaks(psMemoryId id0, psMemBlock* ** arr, FILE * fd)
-{
-    int nleak = 0;
-    int j = 0;
+psS32 psMemCheckLeaks(psMemoryId id0, psMemBlock* ** arr, FILE * fd)
+{
+    psS32 nleak = 0;
+    psS32 j = 0;
     psMemBlock* topBlock = lastMemBlockAllocated;
 
@@ -499,8 +498,8 @@
  */
 // return refCounter
-psReferenceCount psMemGetRefCounter(void *vptr)
+psReferenceCount psMemGetRefCounter(psPtr vptr)
 {
     psMemBlock* ptr;
-    unsigned int refCount;
+    psU32 refCount;
 
     if (vptr == NULL) {
@@ -522,5 +521,5 @@
 
 // increment and return refCounter
-void *p_psMemIncrRefCounter(void *vptr, const char *file, int lineno)
+psPtr p_psMemIncrRefCounter(psPtr vptr, const char *file, psS32 lineno)
 {
     psMemBlock* ptr;
@@ -544,5 +543,5 @@
 
 // decrement and return refCounter
-void *p_psMemDecrRefCounter(void *vptr, const char *file, int lineno)
+psPtr p_psMemDecrRefCounter(psPtr vptr, const char *file, psS32 lineno)
 {
     if (vptr == NULL) {
@@ -593,5 +592,5 @@
         if (ptr->userMemorySize < P_PS_LARGE_BLOCK_SIZE) {
 
-            int level = 1;
+            psS32 level = 1;
 
             while (ptr->userMemorySize >= recycleBinSize[level]) {
@@ -635,5 +634,5 @@
 }
 
-void p_psMemSetDeallocator(void *vptr, psFreeFcn freeFcn)
+void p_psMemSetDeallocator(psPtr vptr, psFreeFcn freeFcn)
 {
     if (vptr == NULL) {
@@ -650,5 +649,5 @@
 
 }
-psFreeFcn p_psMemGetDeallocator(void *vptr)
+psFreeFcn p_psMemGetDeallocator(psPtr vptr)
 {
     if (vptr == NULL) {
@@ -665,5 +664,5 @@
 }
 
-bool p_psMemGetPersistent(void *vptr)
+psBool p_psMemGetPersistent(psPtr vptr)
 {
     if (vptr == NULL) {
@@ -680,5 +679,5 @@
 }
 
-void p_psMemSetPersistent(void *vptr,bool value)
+void p_psMemSetPersistent(psPtr vptr,psBool value)
 {
     if (vptr == NULL) {
