Index: trunk/psLib/test/dataManip/tst_psFunc07.c
===================================================================
--- trunk/psLib/test/dataManip/tst_psFunc07.c	(revision 1902)
+++ trunk/psLib/test/dataManip/tst_psFunc07.c	(revision 1946)
@@ -4,8 +4,4 @@
 values, sets the spline polynomials with psVectorFitSpline1D(), then calls
 psSpline1DEval() on new data values and ensures that the results are correct.
- 
-XXX: figure out the memory deallocator
- 
-XXX: Remove NR code.
  *****************************************************************************/
 #include <stdio.h>
@@ -16,5 +12,5 @@
 #include "psFunctions.h"
 
-#define NUM_SPLINES 200
+#define NUM_SPLINES 5
 #define A 4.0
 #define B -3.0
@@ -30,75 +26,15 @@
 }
 
-/*****************************************************************************
-XXX: This is Numerical Recipes in C code.  Remove from distribution.
- *****************************************************************************/
-void spline(float *x, float *y, int n, float yp1, float ypn, float *y2)
-{
-    int i,k;
-    float p,qn,sig,un,u[NUM_SPLINES+1];
-
-    if (yp1 > 0.99e30) {
-        y2[1]=u[1]=0.0;
-    } else {
-        y2[1] = -0.5;
-        u[1]=(3.0/(x[2]-x[1]))*((y[2]-y[1])/(x[2]-x[1])-yp1);
-    }
-
-    for (i=2;i<=n-1;i++) {
-        sig=(x[i]-x[i-1])/(x[i+1]-x[i-1]);
-        p=sig*y2[i-1]+2.0;
-        y2[i]=(sig-1.0)/p;
-        u[i]=(y[i+1]-y[i])/(x[i+1]-x[i]) - (y[i]-y[i-1])/(x[i]-x[i-1]);
-        u[i]=(6.0*u[i]/(x[i+1]-x[i-1])-sig*u[i-1])/p;
-    }
-
-    if (ypn > 0.99e30) {
-        qn=un=0.0;
-    } else {
-        qn=0.5;
-        un=(3.0/(x[n]-x[n-1]))*(ypn-(y[n]-y[n-1])/(x[n]-x[n-1]));
-    }
-    y2[n]=(un-qn*u[n-1])/(qn*y2[n-1]+1.0);
-
-    for (k=n-1;k>=1;k--) {
-        y2[k]=y2[k]*y2[k+1]+u[k];
-    }
-}
-
-/*****************************************************************************
-XXX: This is Numerical Recipes in C code.  Remove from distribution.
- *****************************************************************************/
-void splint(float xa[], float ya[], float y2a[], int n, float x, float *y)
-{
-    int klo,khi,k;
-    float h,b,a;
-
-    klo=1;
-    khi=n;
-    while (khi-klo > 1) {
-        k=(khi+klo) >> 1;
-        if (xa[k] > x)
-            khi=k;
-        else
-            klo=k;
-    }
-    h=xa[khi]-xa[klo];
-    a=(xa[khi]-x)/h;
-    b=(x-xa[klo])/h;
-    *y=a*ya[klo]+b*ya[khi]+((a*a*a-a)*y2a[klo]+(b*b*b-b)*y2a[khi])*(h*h)/6.0;
-}
-
-
 int main()
 {
     int testStatus = true;
     int memLeaks=0;
+    int  currentId = psMemGetId();
     int i;
-    //    int  currentId = psMemGetId();
-    psSpline1D *tmpSpline;
-    psVector *x;
-    psVector *newX;
-    psVector *y;
-    psVector *newY;
+    psSpline1D *tmpSpline = NULL;
+    psVector *x = NULL;
+    psVector *newX = NULL;
+    psVector *y = NULL;
+    psVector *newY = NULL;
     float NRX[NUM_SPLINES+2];
     float NRY[NUM_SPLINES+2];
@@ -128,38 +64,8 @@
     newX->data.F32[NUM_SPLINES] = x->data.F32[NUM_SPLINES];
     /****************************************************************************/
-    /*   NR Code       */
-    /****************************************************************************/
-    /*
-        printf("========================== NR Code =========================\n");
-        spline(&NRX[0],
-               &NRY[0],
-               NUM_SPLINES+1,
-               0.0,
-               0.0,
-               &derivs[0]);
-        for (i=1;i<=NUM_SPLINES+1;i++) {
-            printf("NR: derivs[%d] is %f\n", i, derivs[i]);
-        }
-     
-        for (i=1;i<=NUM_SPLINES+1;i++) {
-            printf("===================================================\n");
-            splint(&NRX[0],
-                   &NRY[0],
-                   &derivs[0],
-                   NUM_SPLINES+1,
-                   newX->data.F32[i-1],
-                   &tmpY);
-     
-            printf("NR: p_psNRSpline1DEval(%f) is %f.  Should be %f\n",
-                    newX->data.F32[i-1], tmpY, myFunc(newX->data.F32[i-1]));
-        }
-    */
-    /****************************************************************************/
     /*   psLib Code      */
     /****************************************************************************/
+
     psVectorFitSpline1D(tmpSpline, x, y, NULL);
-    for (i=0;i<NUM_SPLINES+1;i++) {
-        //       printf("psLib: derivs[%d] is %f\n", i, tmpSpline->p_psDeriv2[i]);
-    }
     newY = psSpline1DEvalVector(newX, tmpSpline);
 
@@ -174,7 +80,12 @@
     }
 
-    psFree(tmpSpline);
+    psFree(x);
+    psFree(newX);
+    psFree(y);
+    p_psSpline1DFree(tmpSpline);
+    psFree(newY);
+
     psMemCheckCorruption(1);
-    //    memLeaks = psMemCheckLeaks(currentId,NULL,stderr);
+    memLeaks = psMemCheckLeaks(currentId,NULL,stderr);
     if (0 != memLeaks) {
         psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks);
