Replaced use of malloc()/free() with SDL_malloc()/SDL_free() in test program.
authorPhilipp Wiesemann <philipp.wiesemann@arcor.de>
Sat, 20 Jul 2013 21:51:53 +0200
changeset 7479ef5b0ca53305
parent 7478 0d02f6a323f5
child 7480 d0bfce3937e0
Replaced use of malloc()/free() with SDL_malloc()/SDL_free() in test program.
test/testshape.c
     1.1 --- a/test/testshape.c	Sat Jul 20 21:47:16 2013 +0200
     1.2 +++ b/test/testshape.c	Sat Jul 20 21:51:53 2013 +0200
     1.3 @@ -79,7 +79,7 @@
     1.4      }
     1.5  
     1.6      num_pictures = argc - 1;
     1.7 -    pictures = (LoadedPicture *)malloc(sizeof(LoadedPicture)*num_pictures);
     1.8 +    pictures = (LoadedPicture *)SDL_malloc(sizeof(LoadedPicture)*num_pictures);
     1.9      for(i=0;i<num_pictures;i++)
    1.10          pictures[i].surface = NULL;
    1.11      for(i=0;i<num_pictures;i++) {
    1.12 @@ -89,7 +89,7 @@
    1.13              for(j=0;j<num_pictures;j++)
    1.14                  if(pictures[j].surface != NULL)
    1.15                      SDL_FreeSurface(pictures[j].surface);
    1.16 -            free(pictures);
    1.17 +            SDL_free(pictures);
    1.18              SDL_VideoQuit();
    1.19              printf("Could not load surface from named bitmap file.\n");
    1.20              exit(-3);
    1.21 @@ -110,7 +110,7 @@
    1.22      if(window == NULL) {
    1.23          for(i=0;i<num_pictures;i++)
    1.24              SDL_FreeSurface(pictures[i].surface);
    1.25 -        free(pictures);
    1.26 +        SDL_free(pictures);
    1.27          SDL_VideoQuit();
    1.28          printf("Could not create shaped window for SDL_Shape.\n");
    1.29          exit(-4);
    1.30 @@ -120,7 +120,7 @@
    1.31          SDL_DestroyWindow(window);
    1.32          for(i=0;i<num_pictures;i++)
    1.33              SDL_FreeSurface(pictures[i].surface);
    1.34 -        free(pictures);
    1.35 +        SDL_free(pictures);
    1.36          SDL_VideoQuit();
    1.37          printf("Could not create rendering context for SDL_Shape window.\n");
    1.38          exit(-5);
    1.39 @@ -137,7 +137,7 @@
    1.40                      SDL_DestroyTexture(pictures[i].texture);
    1.41              for(i=0;i<num_pictures;i++)
    1.42                  SDL_FreeSurface(pictures[i].surface);
    1.43 -            free(pictures);
    1.44 +            SDL_free(pictures);
    1.45              SDL_DestroyRenderer(renderer);
    1.46              SDL_DestroyWindow(window);
    1.47              SDL_VideoQuit();
    1.48 @@ -194,7 +194,7 @@
    1.49      //Free the original surfaces backing the textures.
    1.50      for(i=0;i<num_pictures;i++)
    1.51          SDL_FreeSurface(pictures[i].surface);
    1.52 -    free(pictures);
    1.53 +    SDL_free(pictures);
    1.54      //Call SDL_VideoQuit() before quitting.
    1.55      SDL_VideoQuit();
    1.56