Index: trunk/psLib/src/sys/psString.c
===================================================================
--- trunk/psLib/src/sys/psString.c	(revision 7905)
+++ trunk/psLib/src/sys/psString.c	(revision 7912)
@@ -13,6 +13,6 @@
  *  @author David Robbins, MHPCC
  *
- *  @version $Revision: 1.38 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2006-07-14 20:06:43 $
+ *  @version $Revision: 1.39 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2006-07-15 02:50:51 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -56,9 +56,10 @@
 {
     // Pass through NULL values!
-
-    // Allocate memory using psAlloc function
+    if (!string) {
+        return NULL;
+    }
+    psString output = psStringAlloc(strlen(string) + 1); // Output string
     // Copy input string to memory just allocated
-    // Return the copy
-    return string ? strcpy(psAlloc(strlen(string) + 1), string) : NULL;
+    return strcpy(output, string);
 }
 
@@ -67,5 +68,9 @@
 {
     PS_ASSERT_PTR_NON_NULL(string, NULL);
-    char *returnValue = NULL;
+
+    // Pass through NULL values
+    if (!string) {
+        return NULL;
+    }
 
     // Check the number of characters to copy is non-negative
@@ -77,17 +82,14 @@
         return NULL;
     }
-    // Allocate memory using psAlloc function - nChar bytes
+
     // Copy input string to memory allocated up to nChar characters
-    // Return the copy
-    // Pass through NULL values
-    returnValue =
-              string ? strncpy(psAlloc((size_t) nChar + 1), string, (size_t) nChar)
-              : NULL;
+    psString output = psStringAlloc((size_t) nChar + 1);
+    output = strncpy(output, string, (size_t) nChar);
 
     // Ensure the last byte is NULL character
-    returnValue[nChar] = '\0';
+    output[nChar] = '\0';
 
     // Return the string pointer
-    return returnValue;
+    return output;
 }
 
@@ -279,5 +281,5 @@
 
         // this is safe since we will subtract strlen(key) elements from input
-        psString output = psAlloc(strlen(input) + replaceLength + 1); // Output string
+        psString output = psStringAlloc(strlen(input) + replaceLength + 1); // Output string
         int Nc = p - input;             // Number of characters to copy
 
