test/testerror.c
changeset 1895 c121d94672cb
parent 1769 290b5baf2fca
child 3578 0d1b16ee0bca
     1.1 --- a/test/testerror.c	Thu Jul 06 18:01:37 2006 +0000
     1.2 +++ b/test/testerror.c	Mon Jul 10 21:04:37 2006 +0000
     1.3 @@ -11,51 +11,54 @@
     1.4  static int alive = 0;
     1.5  
     1.6  /* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */
     1.7 -static void quit(int rc)
     1.8 +static void
     1.9 +quit(int rc)
    1.10  {
    1.11 -	SDL_Quit();
    1.12 -	exit(rc);
    1.13 +    SDL_Quit();
    1.14 +    exit(rc);
    1.15  }
    1.16  
    1.17 -int SDLCALL ThreadFunc(void *data)
    1.18 +int SDLCALL
    1.19 +ThreadFunc(void *data)
    1.20  {
    1.21 -	/* Set the child thread error string */
    1.22 -	SDL_SetError("Thread %s (%d) had a problem: %s",
    1.23 -			(char *)data, SDL_ThreadID(), "nevermind");
    1.24 -	while ( alive ) {
    1.25 -		printf("Thread '%s' is alive!\n", (char *)data);
    1.26 -		SDL_Delay(1*1000);
    1.27 -	}
    1.28 -	printf("Child thread error string: %s\n", SDL_GetError());
    1.29 -	return(0);
    1.30 +    /* Set the child thread error string */
    1.31 +    SDL_SetError("Thread %s (%d) had a problem: %s",
    1.32 +                 (char *) data, SDL_ThreadID(), "nevermind");
    1.33 +    while (alive) {
    1.34 +        printf("Thread '%s' is alive!\n", (char *) data);
    1.35 +        SDL_Delay(1 * 1000);
    1.36 +    }
    1.37 +    printf("Child thread error string: %s\n", SDL_GetError());
    1.38 +    return (0);
    1.39  }
    1.40  
    1.41 -int main(int argc, char *argv[])
    1.42 +int
    1.43 +main(int argc, char *argv[])
    1.44  {
    1.45 -	SDL_Thread *thread;
    1.46 +    SDL_Thread *thread;
    1.47  
    1.48 -	/* Load the SDL library */
    1.49 -	if ( SDL_Init(0) < 0 ) {
    1.50 -		fprintf(stderr, "Couldn't initialize SDL: %s\n",SDL_GetError());
    1.51 -		return(1);
    1.52 -	}
    1.53 +    /* Load the SDL library */
    1.54 +    if (SDL_Init(0) < 0) {
    1.55 +        fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError());
    1.56 +        return (1);
    1.57 +    }
    1.58  
    1.59 -	/* Set the error value for the main thread */
    1.60 -	SDL_SetError("No worries");
    1.61 +    /* Set the error value for the main thread */
    1.62 +    SDL_SetError("No worries");
    1.63  
    1.64 -	alive = 1;
    1.65 -	thread = SDL_CreateThread(ThreadFunc, "#1");
    1.66 -	if ( thread == NULL ) {
    1.67 -		fprintf(stderr, "Couldn't create thread: %s\n", SDL_GetError());
    1.68 -		quit(1);
    1.69 -	}
    1.70 -	SDL_Delay(5*1000);
    1.71 -	printf("Waiting for thread #1\n");
    1.72 -	alive = 0;
    1.73 -	SDL_WaitThread(thread, NULL);
    1.74 +    alive = 1;
    1.75 +    thread = SDL_CreateThread(ThreadFunc, "#1");
    1.76 +    if (thread == NULL) {
    1.77 +        fprintf(stderr, "Couldn't create thread: %s\n", SDL_GetError());
    1.78 +        quit(1);
    1.79 +    }
    1.80 +    SDL_Delay(5 * 1000);
    1.81 +    printf("Waiting for thread #1\n");
    1.82 +    alive = 0;
    1.83 +    SDL_WaitThread(thread, NULL);
    1.84  
    1.85 -	printf("Main thread error string: %s\n", SDL_GetError());
    1.86 +    printf("Main thread error string: %s\n", SDL_GetError());
    1.87  
    1.88 -	SDL_Quit();
    1.89 -	return(0);
    1.90 +    SDL_Quit();
    1.91 +    return (0);
    1.92  }