test/testtimer.c
changeset 1151 be9c9c8f6d53
parent 766 ed57c876700d
child 1484 b2b476a4a73c
     1.1 --- a/test/testtimer.c	Wed Sep 28 06:38:22 2005 +0000
     1.2 +++ b/test/testtimer.c	Wed Sep 28 11:36:20 2005 +0000
     1.3 @@ -12,6 +12,13 @@
     1.4  
     1.5  static int ticks = 0;
     1.6  
     1.7 +/* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */
     1.8 +static void quit(int rc)
     1.9 +{
    1.10 +	SDL_Quit();
    1.11 +	exit(rc);
    1.12 +}
    1.13 +
    1.14  static Uint32 ticktock(Uint32 interval)
    1.15  {
    1.16  	++ticks;
    1.17 @@ -31,9 +38,8 @@
    1.18  
    1.19  	if ( SDL_Init(SDL_INIT_TIMER) < 0 ) {
    1.20  		fprintf(stderr, "Couldn't load SDL: %s\n", SDL_GetError());
    1.21 -		exit(1);
    1.22 +		return(1);
    1.23  	}
    1.24 -	atexit(SDL_Quit);
    1.25  
    1.26  	/* Start the timer */
    1.27  	desired = 0;
    1.28 @@ -83,5 +89,6 @@
    1.29  	SDL_RemoveTimer(t2);
    1.30  	SDL_RemoveTimer(t3);
    1.31  
    1.32 +	SDL_Quit();
    1.33  	return(0);
    1.34  }