Index: trunk/psModules/src/objects/pmSourceFitSet.c
===================================================================
--- trunk/psModules/src/objects/pmSourceFitSet.c	(revision 15055)
+++ trunk/psModules/src/objects/pmSourceFitSet.c	(revision 15562)
@@ -6,6 +6,6 @@
  *  @author GLG, MHPCC
  *
- *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2007-09-28 00:39:41 $
+ *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2007-11-10 01:09:20 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -79,8 +79,16 @@
 }
 
+bool psMemCheckSourceFitSetData(psPtr ptr)
+{
+    PS_ASSERT_PTR(ptr, false);
+    return ( psMemGetDeallocator(ptr) == (psFreeFunc) pmSourceFitSetDataFree);
+}
+
+
 // this function is called with the full set of parameters and the beta values in a single vector
-bool pmSourceFitSetCheckLimits (psMinConstraintMode mode, int nParam, float *params, float *betas)
-{
-    assert (thisSet);
+bool pmSourceFitSetCheckLimits (psMinConstraintMode mode, int nParam, float *params,
+                                float *betas)
+{
+    PS_ASSERT_PTR_NON_NULL(thisSet, false);
 
     // nParam is the parameter in the full sequence.  determine which single model this comes from
@@ -109,7 +117,9 @@
 
 // merge parameters from FitSet models into single param and deriv vectors
-bool pmSourceFitSetJoin (psVector *deriv, psVector *param, pmSourceFitSetData *set) {
-
-    assert (set);
+bool pmSourceFitSetJoin (psVector *deriv, psVector *param, pmSourceFitSetData *set)
+{
+    PS_ASSERT_PTR_NON_NULL(set, false);
+    PS_ASSERT_PTR_NON_NULL(param, false);
+
     assert (set->paramSet->n == set->derivSet->n);
 
@@ -138,6 +148,7 @@
 // distribute parameters from single param and deriv vectors into FitSet models
 bool pmSourceFitSetSplit (pmSourceFitSetData *set, const psVector *deriv, const psVector *param) {
-
-    assert (set);
+    PS_ASSERT_PTR_NON_NULL(set, false);
+    PS_ASSERT_PTR_NON_NULL(param, false);
+
     assert (set->paramSet->n == set->derivSet->n);
 
@@ -159,9 +170,10 @@
 }
 
-bool pmSourceFitSetValues (pmSourceFitSetData *set, const psVector *dparam, const psVector *param, pmSource *source, psMinimization *myMin, int nPix, bool fitStatus) {
-
+bool pmSourceFitSetValues (pmSourceFitSetData *set, const psVector *dparam, 
+                           const psVector *param, pmSource *source,
+                           psMinimization *myMin, int nPix, bool fitStatus)
+{
+    PS_ASSERT_PTR_NON_NULL(set, false);
     bool onPic = true;
-
-    assert (set);
 
     int n = 0;
@@ -203,8 +215,7 @@
 psF32 pmSourceFitSetFunction(psVector *deriv, const psVector *param, const psVector *x)
 {
+    PS_ASSERT_PTR_NON_NULL(thisSet, NAN);
     float chisqSum = 0.0;
     float chisqOne = 0.0;
-
-    assert (thisSet);
     pmSourceFitSetSplit (thisSet, deriv, param);
 
@@ -225,5 +236,9 @@
 
 // XXX allow the mode to be a function of the object (eg, S/N)
-bool pmSourceFitSetMasks (psMinConstraint *constraint, pmSourceFitSetData *set, pmSourceFitMode mode) {
+bool pmSourceFitSetMasks (psMinConstraint *constraint, pmSourceFitSetData *set,
+                          pmSourceFitMode mode)
+{
+    PS_ASSERT_PTR_NON_NULL(set, false);
+    PS_ASSERT_PTR_NON_NULL(constraint, false);
 
     // unmask everyone
