test/testgamecontroller.c
changeset 6916 92e978d6dafa
parent 6914 8a9915ab24f0
child 6917 47dc155b774d
     1.1 --- a/test/testgamecontroller.c	Mon Feb 25 00:45:25 2013 -0500
     1.2 +++ b/test/testgamecontroller.c	Mon Feb 25 00:47:47 2013 -0500
     1.3 @@ -88,19 +88,18 @@
     1.4  void
     1.5  WatchGameController(SDL_GameController * gamecontroller)
     1.6  {
     1.7 -    const char *controllername = gamecontroller ? SDL_GameControllerName(gamecontroller) : "???";
     1.8 +    const char *name = SDL_GameControllerName(gamecontroller);
     1.9      const char *basetitle = "Game Controller Test: ";
    1.10 -    const size_t titlelen = SDL_strlen(basetitle) + SDL_strlen(controllername) + 1;
    1.11 +    const size_t titlelen = SDL_strlen(basetitle) + SDL_strlen(name) + 1;
    1.12      char *title = SDL_malloc(titlelen);
    1.13      SDL_Window *window = NULL;
    1.14      SDL_Renderer *screen = NULL;
    1.15 -    const char *name = NULL;
    1.16      int done = 0;
    1.17      SDL_Event event;
    1.18      int i;
    1.19  
    1.20      if (title) {
    1.21 -        SDL_snprintf(title, titlelen, "%s%s", basetitle, controllername);
    1.22 +        SDL_snprintf(title, titlelen, "%s%s", basetitle, name);
    1.23      }
    1.24  
    1.25      /* Create a window to display controller axis position */
    1.26 @@ -125,7 +124,6 @@
    1.27  	SDL_RaiseWindow(window);
    1.28  
    1.29      /* Print info about the controller we are watching */
    1.30 -    name = SDL_GameControllerName(gamecontroller);
    1.31      printf("Watching controller %s\n",  name ? name : "Unknown Controller");
    1.32      
    1.33      /* Loop, getting controller events! */