Mercurial > sdl-ios-xcode
comparison src/SDL_assert.c @ 3664:8bdc37b1a52a
Handle assert init/quit better.
Don't create a mutex unles we need to, only clean it up if we made it.
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Wed, 13 Jan 2010 16:08:03 +0000 |
parents | 6a0b3048f271 |
children | 46d27a9571fa |
comparison
equal
deleted
inserted
replaced
3663:bc50cd16bb07 | 3664:8bdc37b1a52a |
---|---|
420 #endif /* SDL_ASSERT_LEVEL > 0 */ | 420 #endif /* SDL_ASSERT_LEVEL > 0 */ |
421 | 421 |
422 | 422 |
423 int SDL_AssertionsInit(void) | 423 int SDL_AssertionsInit(void) |
424 { | 424 { |
425 #if (SDL_ASSERT_LEVEL > 0) | 425 /* this is a no-op at the moment. */ |
426 assertion_mutex = SDL_CreateMutex(); | |
427 if (assertion_mutex == NULL) { | |
428 return -1; | |
429 } | |
430 #endif | |
431 return 0; | 426 return 0; |
432 } | 427 } |
433 | 428 |
434 void SDL_AssertionsQuit(void) | 429 void SDL_AssertionsQuit(void) |
435 { | 430 { |
436 #if (SDL_ASSERT_LEVEL > 0) | 431 #if (SDL_ASSERT_LEVEL > 0) |
437 SDL_GenerateAssertionReport(); | 432 SDL_GenerateAssertionReport(); |
438 SDL_DestroyMutex(assertion_mutex); | 433 if (assertion_mutex != NULL) { |
439 assertion_mutex = NULL; | 434 SDL_DestroyMutex(assertion_mutex); |
435 assertion_mutex = NULL; | |
436 } | |
440 #endif | 437 #endif |
441 } | 438 } |
442 | 439 |
443 /* vi: set ts=4 sw=4 expandtab: */ | 440 /* vi: set ts=4 sw=4 expandtab: */ |