Index: /trunk/psLib/src/math/psStats.c
===================================================================
--- /trunk/psLib/src/math/psStats.c	(revision 13493)
+++ /trunk/psLib/src/math/psStats.c	(revision 13494)
@@ -13,6 +13,6 @@
  * use ->min and ->max (PS_STAT_USE_RANGE)
  *
- *  @version $Revision: 1.210 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2007-05-18 13:19:55 $
+ *  @version $Revision: 1.211 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2007-05-24 02:06:51 $
  *
  *  Copyright 2006 IfA, University of Hawaii
@@ -259,10 +259,10 @@
     for (long i = 0; i < num; i++) {
         // Check if the data is with the specified range
-	if (!isfinite(vector[i])) {
-	    stats->max = stats->min = NAN;
-	    psError(PS_ERR_IEEE, true, "Element %ld of vector is Inf/NaN", i);
-	    return 0;
-	}
-	
+        if (!isfinite(vector[i])) {
+            stats->max = stats->min = NAN;
+            psError(PS_ERR_IEEE, true, "Element %ld of vector is Inf/NaN", i);
+            return 0;
+        }
+
         if (useRange && (vector[i] < stats->min))
             continue;
@@ -688,5 +688,5 @@
         }
         psTrace(TRACE, 6, "Data min/max is (%.2f, %.2f)\n", min, max);
-	assert (iterate < 20);
+        assert (iterate < 20);
         // fprintf (stderr, "%d @ %d : %f - %f\n", iterate, numValid, min, max);
 
@@ -1661,7 +1661,8 @@
 
 // We keep statsFree so that we can identify statistics pointers from the memblock
-static void statsFree(psStats *newStruct)
+static void statsFree(psStats *stats)
 {
     // There are non dynamic allocated items
+    return;
 }
 
@@ -1669,37 +1670,36 @@
     psStatsAlloc(): This routine must create a new psStats data structure.
 *****************************************************************************/
-psStats* psStatsAlloc(psStatsOptions options)
+psStats* p_psStatsAlloc(const char *file, unsigned int lineno, const char *func, psStatsOptions options)
 {
     psTrace(TRACE, 3,"---- %s() begin  ----\n", __func__);
-    psStats* newStruct = NULL;
-
-    newStruct = (psStats* ) psAlloc(sizeof(psStats));
-    psMemSetDeallocator(newStruct, (psFreeFunc)statsFree);
-    newStruct->sampleMean = NAN;
-    newStruct->sampleMedian = NAN;
-    newStruct->sampleStdev = NAN;
-    newStruct->sampleUQ = NAN;
-    newStruct->sampleLQ = NAN;
-    newStruct->robustMedian = NAN;
-    newStruct->robustStdev = NAN;
-    newStruct->robustUQ = NAN;
-    newStruct->robustLQ = NAN;
-    newStruct->robustN50 = -1;
-    newStruct->fittedMean = NAN;
-    newStruct->fittedStdev = NAN;
-    newStruct->fittedNfit = -1;
-    newStruct->clippedMean = NAN;
-    newStruct->clippedStdev = NAN;
-    newStruct->clippedNvalues = -1;     // XXX: This is never used
-    newStruct->clipSigma = 3.0;
-    newStruct->clipIter = 3;
-    newStruct->min = NAN;
-    newStruct->max = NAN;
-    newStruct->binsize = NAN;
-    newStruct->nSubsample = 100000;
-    newStruct->options = options;
+
+    psStats *stats = p_psAlloc(file, lineno, func, sizeof(psStats));
+    psMemSetDeallocator(stats, (psFreeFunc)statsFree);
+    stats->sampleMean = NAN;
+    stats->sampleMedian = NAN;
+    stats->sampleStdev = NAN;
+    stats->sampleUQ = NAN;
+    stats->sampleLQ = NAN;
+    stats->robustMedian = NAN;
+    stats->robustStdev = NAN;
+    stats->robustUQ = NAN;
+    stats->robustLQ = NAN;
+    stats->robustN50 = -1;
+    stats->fittedMean = NAN;
+    stats->fittedStdev = NAN;
+    stats->fittedNfit = -1;
+    stats->clippedMean = NAN;
+    stats->clippedStdev = NAN;
+    stats->clippedNvalues = -1;     // XXX: This is never used
+    stats->clipSigma = 3.0;
+    stats->clipIter = 3;
+    stats->min = NAN;
+    stats->max = NAN;
+    stats->binsize = NAN;
+    stats->nSubsample = 100000;
+    stats->options = options;
 
     psTrace(TRACE, 3, "---- %s() end  ----\n", __func__);
-    return (newStruct);
+    return stats;
 }
 
Index: /trunk/psLib/src/math/psStats.h
===================================================================
--- /trunk/psLib/src/math/psStats.h	(revision 13493)
+++ /trunk/psLib/src/math/psStats.h	(revision 13494)
@@ -8,6 +8,6 @@
  * @author GLG, MHPCC
  *
- * @version $Revision: 1.59 $ $Name: not supported by cvs2svn $
- * @date $Date: 2007-01-23 22:47:23 $
+ * @version $Revision: 1.60 $ $Name: not supported by cvs2svn $
+ * @date $Date: 2007-05-24 02:06:51 $
  * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
  */
@@ -99,8 +99,18 @@
  *                      value given.
  */
+#ifdef DOXYGEN
 psStats* psStatsAlloc(
-    psStatsOptions options             ///< Statistics to calculate
+    psStatsOptions options              ///< Statistics to calculate
 );
-
+#else // ifdef DOXYGEN
+psStats* p_psStatsAlloc(
+    const char *file,                   ///< File of caller
+    unsigned int lineno,                ///< Line number of caller
+    const char *func,                   ///< Function name of caller
+    psStatsOptions options              ///< Statistics to calculate
+);
+#define psStatsAlloc(options) \
+      p_psStatsAlloc(__FILE__, __LINE__, __func__, options)
+#endif // ifdef DOXYGEN
 
 /** Checks the type of a particular pointer.
@@ -138,5 +148,5 @@
    (none)
  * vectorSampleMedian (also yields SAMPLE_QUARTILE)
-   (none) 
+   (none)
  * vectorSampleStdev
    (vectorSampleMean)
@@ -149,11 +159,11 @@
  * vectorFittedStats
    (vectorRobustStats)
- 
+
  * private stats functions called by other private stats functions are automatically called by
  * those functions.  since they set the stats->results flags, they are not called multiple
  * times.
- 
+
  * the private stats functions do not test for their corresponding stats flags: it is not
  * necessary to request them if they are called within this function.
- 
+
 */
