comparison src/SDL_assert.c @ 3655:1cc7f0143c12

Moved SDL_FUNCTION out so it's always available, and added SDL_FILE and SDL_LINE
author Sam Lantinga <slouken@libsdl.org>
date Wed, 13 Jan 2010 08:25:16 +0000
parents cb5b1aedb5a7
children f17ea6f49745
comparison
equal deleted inserted replaced
3654:336f3df1578d 3655:1cc7f0143c12
263 "\n", 263 "\n",
264 data->function, data->filename, data->linenum, 264 data->function, data->filename, data->linenum,
265 data->trigger_count, (data->trigger_count == 1) ? "" : "s", 265 data->trigger_count, (data->trigger_count == 1) ? "" : "s",
266 data->condition); 266 data->condition);
267 267
268 /* let env. variable override, so unit tests won't block in a GUI. */ 268 /* let env. variable override, so unit tests won't block in a GUI. */
269 envr = SDL_getenv("SDL_ASSERT"); 269 envr = SDL_getenv("SDL_ASSERT");
270 if (envr != NULL) { 270 if (envr != NULL) {
271 if (SDL_strcmp(envr, "abort") == 0) { 271 if (SDL_strcmp(envr, "abort") == 0) {
272 return SDL_ASSERTION_ABORT; 272 return SDL_ASSERTION_ABORT;
273 } else if (SDL_strcmp(envr, "break") == 0) { 273 } else if (SDL_strcmp(envr, "break") == 0) {
325 325
326 326
327 static SDL_mutex *assertion_mutex = NULL; 327 static SDL_mutex *assertion_mutex = NULL;
328 328
329 SDL_assert_state 329 SDL_assert_state
330 SDL_ReportAssertion(SDL_assert_data *data, const char *func, int line) 330 SDL_ReportAssertion(SDL_assert_data *data, const char *func, const char *file,
331 int line)
331 { 332 {
332 SDL_assert_state state; 333 SDL_assert_state state;
333 334
334 if (SDL_LockMutex(assertion_mutex) < 0) { 335 if (SDL_LockMutex(assertion_mutex) < 0) {
335 return SDL_ASSERTION_IGNORE; /* oh well, I guess. */ 336 return SDL_ASSERTION_IGNORE; /* oh well, I guess. */
336 } 337 }
337 338
338 /* doing this because Visual C is upset over assigning in the macro. */ 339 /* doing this because Visual C is upset over assigning in the macro. */
339 if (data->trigger_count == 0) { 340 if (data->trigger_count == 0) {
340 data->function = func; 341 data->function = func;
341 data->linenum = line; 342 data->filename = file;
343 data->linenum = line;
342 } 344 }
343 345
344 SDL_AddAssertionToReport(data); 346 SDL_AddAssertionToReport(data);
345 347
346 data->trigger_count++; 348 data->trigger_count++;