Index: trunk/psLib/src/imageops/psImageStructManip.c
===================================================================
--- trunk/psLib/src/imageops/psImageStructManip.c	(revision 14921)
+++ trunk/psLib/src/imageops/psImageStructManip.c	(revision 15456)
@@ -8,6 +8,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2007-09-20 23:48:47 $
+ *  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2007-11-05 23:56:33 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -32,5 +32,8 @@
 // note that these are relative to the input col0,row0
 // also note that col0,row0 may not be less than input->col0,row0
-static psImage* imageSubset(psImage* out,
+static psImage* imageSubset(const char *file, // File name of caller
+                            unsigned int lineno, // Line number of caller
+                            const char *func, // Function name of caller
+                            psImage* out,
                             psImage* image,
                             psS32 col0,
@@ -99,24 +102,25 @@
     if (out != NULL) {
         // if a child, need to orphan (disassociate from parent) first
-	psImage *parent = (psImage *) out->parent;
+        psImage *parent = (psImage *) out->parent;
         if (parent != NULL) {
-	    // break the back-pointer first so we don't loop
-	    out->parent = NULL;
-
-	    // drop my entry on my parent's array of children
+            // break the back-pointer first so we don't loop
+            out->parent = NULL;
+
+            // drop my entry on my parent's array of children
             psArrayRemoveDataNoFree (out->parent->children, out);
 
-	    // drop my reference to my old parent
-	    psFree (parent);
+            // drop my reference to my old parent
+            psFree (parent);
         }
 
-	// we recycle out->data.V
+        // we recycle out->data.V
         psFree(out->p_rawDataBuffer); // free the previous data reference
     } else {
-        out = psAlloc(sizeof(psImage));
+        out = p_psAlloc(file, lineno, func, sizeof(psImage));
         out->data.V = NULL;
     }
 
-    out->data.V = psRealloc(out->data.V,sizeof(psPtr)*numRows); // resize row pointer array
+    out->data.V = p_psRealloc(file, lineno, func, out->data.V,
+                              sizeof(psPtr)*numRows); // resize row pointer array
     P_PSIMAGE_SET_TYPE(out, image->type);
     P_PSIMAGE_SET_NUMCOLS(out, numCols);
@@ -141,5 +145,5 @@
 
     // add output image as a child of the input image.
-    image->children = psArrayAdd (image->children, 16, out);
+    image->children = p_psArrayAdd(file, lineno, func, image->children, 16, out);
     psFree (out); // the image->children array is an array of views only
 
@@ -147,9 +151,8 @@
 }
 
-psImage* psImageSubset(psImage* image,
-                       psRegion region)
-{
-    return imageSubset(NULL,image,region.x0, region.y0,
-                       region.x1, region.y1);
+psImage* p_psImageSubset(const char *file, unsigned int lineno, const char *func,
+                       psImage* image, psRegion region)
+{
+    return imageSubset(file, lineno, func, NULL, image, region.x0, region.y0, region.x1, region.y1);
 }
 
@@ -158,7 +161,6 @@
     psRegion region = {0, 0, 0, 0};
     region = psRegionForImage (input, region);
-    psImage *result = imageSubset (output, input,
-                                   region.x0, region.y0,
-                                   region.x1, region.y1);
+    psImage *result = imageSubset (__FILE__, __LINE__, __func__, output, input,
+                                   region.x0, region.y0, region.x1, region.y1);
     return result;
 }
@@ -318,14 +320,11 @@
 
     if ((image->children != NULL) && (image->children->n > 0)) {
-	psAbort ("cannot trim an image with outstanding children");
+        psAbort ("cannot trim an image with outstanding children");
     }
 
     if (image->parent != NULL) {
-        return imageSubset(image,
-                           (psImage*)image->parent,
-                           region.x0+image->col0,
-                           region.y0+image->row0,
-                           region.x1+image->col0,
-                           region.y1+image->row0);
+        return imageSubset(__FILE__, __LINE__, __func__, image, (psImage*)image->parent,
+                           region.x0+image->col0, region.y0+image->row0,
+                           region.x1+image->col0, region.y1+image->row0);
     }
 
