changeset 4073:0dd0ca51d941 SDL-1.2

Merged r3295:3296 from trunk/SDL: testjoystick reusing "joystick" variable.
author Ryan C. Gordon <icculus@icculus.org>
date Sun, 15 Jul 2007 17:26:50 +0000
parents 6930cd5ab933
children fd1cbe7a706c
files test/testjoystick.c
diffstat 1 files changed, 7 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/test/testjoystick.c	Sun Jul 15 17:22:39 2007 +0000
+++ b/test/testjoystick.c	Sun Jul 15 17:26:50 2007 +0000
@@ -158,18 +158,17 @@
 	/* Print information about the joysticks */
 	printf("There are %d joysticks attached\n", SDL_NumJoysticks());
 	for ( i=0; i<SDL_NumJoysticks(); ++i ) {
-		SDL_Joystick *stick = NULL;
 		name = SDL_JoystickName(i);
 		printf("Joystick %d: %s\n",i,name ? name : "Unknown Joystick");
-		stick = SDL_JoystickOpen(i);
-		if (stick == NULL) {
+		joystick = SDL_JoystickOpen(i);
+		if (joystick == NULL) {
 			fprintf(stderr, "SDL_JoystickOpen(%d) failed: %s\n", i, SDL_GetError());
 		} else {
-			printf("       axes: %d\n", SDL_JoystickNumAxes(stick));
-			printf("      balls: %d\n", SDL_JoystickNumBalls(stick));
-			printf("       hats: %d\n", SDL_JoystickNumHats(stick));
-			printf("    buttons: %d\n", SDL_JoystickNumButtons(stick));
-			SDL_JoystickClose(stick);
+			printf("       axes: %d\n", SDL_JoystickNumAxes(joystick));
+			printf("      balls: %d\n", SDL_JoystickNumBalls(joystick));
+			printf("       hats: %d\n", SDL_JoystickNumHats(joystick));
+			printf("    buttons: %d\n", SDL_JoystickNumButtons(joystick));
+			SDL_JoystickClose(joystick);
 		}
 	}