Changeset 1868 for trunk/psLib/src/sysUtils/psError.c
- Timestamp:
- Sep 23, 2004, 12:02:06 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/sysUtils/psError.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/sysUtils/psError.c
r1810 r1868 10 10 * @author Eric Van Alst, MHPCC 11 11 * 12 * @version $Revision: 1.1 4$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-09- 14 23:48:25$12 * @version $Revision: 1.15 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-09-23 22:02:06 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 95 95 } 96 96 97 voidpsErrorMsg(const char *name, psErrorCode code, bool new, const char* fmt, ...)97 psErrorCode psErrorMsg(const char *name, psErrorCode code, bool new, const char* fmt, ...) 98 98 { 99 99 char errMsg[1024]; 100 100 psErr* err; 101 char* msgName; 102 103 // Check for null pointer and if found set to empty string; 104 if ( name == NULL ) { 105 msgName = ""; 106 } else { 107 msgName = (char*)name; 108 } 101 109 102 110 va_list argPtr; // variable list arguement pointer … … 110 118 111 119 vsnprintf(errMsg,1024,fmt,argPtr); 112 err = psErrAlloc( name,code,errMsg);120 err = psErrAlloc(msgName,code,errMsg); 113 121 pushErrorStack(err); 114 122 115 123 // Call logging function with PS_LOG_ERROR level 116 psLogMsg( name, PS_LOG_ERROR, errMsg);124 psLogMsg(msgName, PS_LOG_ERROR, errMsg); 117 125 118 126 // Clean up stack after variable argument has been used … … 120 128 121 129 psFree(err); 130 131 return code; 122 132 } 123 133 … … 128 138 pthread_mutex_lock(&lockErrorStack); 129 139 130 which = errorStackSize-1-which; // the which input is from the end of errorStack131 if (which < 0 || which >= errorStackSize) {132 result = psErrAlloc("", PS_ERR_NONE,""); // no error at the given location140 // Check for negative reference and if found return PS_ERR_NONE 141 if (which < 0 ) { 142 result = psErrAlloc("", PS_ERR_NONE, ""); 133 143 } else { 134 result = psMemIncrRefCounter(errorStack[which]); // a new reference passed back 144 145 which = errorStackSize-1-which; // the which input is from the end of errorStack 146 if (which < 0 || which >= errorStackSize) { 147 result = psErrAlloc("",PS_ERR_NONE,""); // no error at the given location 148 } else { 149 result = psMemIncrRefCounter(errorStack[which]); // a new reference passed back 150 } 135 151 } 136 152
Note:
See TracChangeset
for help on using the changeset viewer.
