Index: trunk/psLib/src/sys/psError.c
===================================================================
--- trunk/psLib/src/sys/psError.c	(revision 14506)
+++ trunk/psLib/src/sys/psError.c	(revision 19034)
@@ -11,6 +11,6 @@
  *  @author Eric Van Alst, MHPCC
  *
- *  @version $Revision: 1.47 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2007-08-15 20:23:34 $
+ *  @version $Revision: 1.48 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2008-08-12 22:53:34 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -145,4 +145,45 @@
 }
 
+psErrorCode p_psErrorV(const char* filename,
+		       unsigned int lineno,
+		       const char* func,
+		       psErrorCode code,
+		       bool new,
+		       const char* format,
+		       va_list ap)
+{
+  char errMsg[MAX_STRING_LENGTH];
+    char msgName[MAX_STRING_LENGTH];
+
+    // if this the origin of a new error reset the error stack
+    if (new) {
+        psErrorClear();
+    }
+
+    snprintf(msgName, MAX_STRING_LENGTH, "%s (%s:%d)", func, filename, lineno);
+    vsnprintf(errMsg, MAX_STRING_LENGTH, format, ap);
+
+    // Remove a single trailing \n from message -- it interferes with
+    // psErrorStackPrint
+    size_t len = strlen(errMsg);
+    if (len > 0 && errMsg[len - 1] == '\n') {
+        errMsg[len - 1] = '\0';
+    }
+
+    psErr *err = psErrAlloc(msgName, code, errMsg);
+    psErrorStackPush(err);
+
+    #ifndef PS_NO_TRACE
+    // Call tracing function with PS_LOG_ERROR level
+    // p_psTrace() automatically appends the the function name to the facility
+    // for us
+    p_psTrace(__FILE__, __LINE__, func, "err", PS_LOG_ERROR, "%s : %s", err->name, err->msg);
+    #endif
+
+    psFree(err);
+
+    return code;
+}
+
 psErrorCode p_psError(const char* filename,
                       unsigned int lineno,
@@ -153,40 +194,8 @@
                       ...)
 {
-    char errMsg[MAX_STRING_LENGTH];
-    char msgName[MAX_STRING_LENGTH];
-
-    // if this the origin of a new error reset the error stack
-    if (new) {
-        psErrorClear();
-    }
-
-    snprintf(msgName, MAX_STRING_LENGTH, "%s (%s:%d)", func, filename, lineno);
-
     va_list ap;
     va_start(ap, format);
-
-    vsnprintf(errMsg, MAX_STRING_LENGTH, format, ap);
-
+    p_psErrorV(filename, lineno, func, code, new, format, ap);
     va_end(ap);
-
-    // Remove a single trailing \n from message -- it interferes with
-    // psErrorStackPrint
-    size_t len = strlen(errMsg);
-    if (len > 0 && errMsg[len - 1] == '\n') {
-        errMsg[len - 1] = '\0';
-    }
-
-    psErr *err = psErrAlloc(msgName, code, errMsg);
-    psErrorStackPush(err);
-
-    #ifndef PS_NO_TRACE
-    // Call tracing function with PS_LOG_ERROR level
-    // p_psTrace() automatically appends the the function name to the facility
-    // for us
-    p_psTrace(__FILE__, __LINE__, func, "err", PS_LOG_ERROR, "%s : %s", err->name, err->msg);
-    #endif
-
-    psFree(err);
-
     return code;
 }
