msResetErrorList() ** ** Clear the list of error objects. */
| 221 | ** Clear the list of error objects. |
| 222 | */ |
| 223 | void msResetErrorList() |
| 224 | { |
| 225 | errorObj *ms_error, *this_error; |
| 226 | ms_error = msGetErrorObj(); |
| 227 | |
| 228 | this_error = ms_error->next; |
| 229 | while( this_error != NULL) |
| 230 | { |
| 231 | errorObj *next_error; |
| 232 | |
| 233 | next_error = this_error->next; |
| 234 | msFree(this_error); |
| 235 | this_error = next_error; |
| 236 | } |
| 237 | |
| 238 | ms_error->next = NULL; |
| 239 | ms_error->code = MS_NOERR; |
| 240 | ms_error->routine[0] = '\0'; |
| 241 | ms_error->message[0] = '\0'; |
| 242 | |
| 243 | /* -------------------------------------------------------------------- */ |
| 244 | /* Cleanup our entry in the thread list. This is mainly */ |
| 245 | /* imprortant when msCleanup() calls msResetErrorList(). */ |
| 246 | /* -------------------------------------------------------------------- */ |
| 247 | #ifdef USE_THREAD |
| 248 | { |
| 249 | int thread_id = msGetThreadId(); |
| 250 | te_info_t *link; |
| 251 | |
| 252 | msAcquireLock( TLOCK_ERROROBJ ); |
| 253 | |
| 254 | /* find link for this thread */ |
| 255 | |
| 256 | for( link = error_list; |
| 257 | link != NULL && link->thread_id != thread_id |
| 258 | && link->next != NULL && link->next->thread_id != thread_id; |
| 259 | link = link->next ) {} |
| 260 | |
| 261 | if( link->thread_id == thread_id ) |
| 262 | { |
| 263 | /* presumably link is at head of list. */ |
| 264 | if( error_list == link ) |
| 265 | error_list = link->next; |
| 266 | |
| 267 | free( link ); |
| 268 | } |
| 269 | else if( link->next != NULL && link->next->thread_id == thread_id ) |
| 270 | { |
| 271 | te_info_t *next_link = link->next; |
| 272 | link->next = link->next->next; |
| 273 | free( next_link ); |
| 274 | } |
| 275 | msReleaseLock( TLOCK_ERROROBJ ); |
| 276 | } |
| 277 | #endif |
| 278 | } |
| 279 | |
| 280 | char *msGetErrorCodeString(int code) { |