Replaced use of malloc()/free() with SDL_malloc()/SDL_free() in test program.
This commit is contained in:
parent
62c31ff5c3
commit
32e6f653b6
1 changed files with 6 additions and 6 deletions
|
@ -79,7 +79,7 @@ int main(int argc,char** argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
num_pictures = argc - 1;
|
num_pictures = argc - 1;
|
||||||
pictures = (LoadedPicture *)malloc(sizeof(LoadedPicture)*num_pictures);
|
pictures = (LoadedPicture *)SDL_malloc(sizeof(LoadedPicture)*num_pictures);
|
||||||
for(i=0;i<num_pictures;i++)
|
for(i=0;i<num_pictures;i++)
|
||||||
pictures[i].surface = NULL;
|
pictures[i].surface = NULL;
|
||||||
for(i=0;i<num_pictures;i++) {
|
for(i=0;i<num_pictures;i++) {
|
||||||
|
@ -89,7 +89,7 @@ int main(int argc,char** argv)
|
||||||
for(j=0;j<num_pictures;j++)
|
for(j=0;j<num_pictures;j++)
|
||||||
if(pictures[j].surface != NULL)
|
if(pictures[j].surface != NULL)
|
||||||
SDL_FreeSurface(pictures[j].surface);
|
SDL_FreeSurface(pictures[j].surface);
|
||||||
free(pictures);
|
SDL_free(pictures);
|
||||||
SDL_VideoQuit();
|
SDL_VideoQuit();
|
||||||
printf("Could not load surface from named bitmap file.\n");
|
printf("Could not load surface from named bitmap file.\n");
|
||||||
exit(-3);
|
exit(-3);
|
||||||
|
@ -110,7 +110,7 @@ int main(int argc,char** argv)
|
||||||
if(window == NULL) {
|
if(window == NULL) {
|
||||||
for(i=0;i<num_pictures;i++)
|
for(i=0;i<num_pictures;i++)
|
||||||
SDL_FreeSurface(pictures[i].surface);
|
SDL_FreeSurface(pictures[i].surface);
|
||||||
free(pictures);
|
SDL_free(pictures);
|
||||||
SDL_VideoQuit();
|
SDL_VideoQuit();
|
||||||
printf("Could not create shaped window for SDL_Shape.\n");
|
printf("Could not create shaped window for SDL_Shape.\n");
|
||||||
exit(-4);
|
exit(-4);
|
||||||
|
@ -120,7 +120,7 @@ int main(int argc,char** argv)
|
||||||
SDL_DestroyWindow(window);
|
SDL_DestroyWindow(window);
|
||||||
for(i=0;i<num_pictures;i++)
|
for(i=0;i<num_pictures;i++)
|
||||||
SDL_FreeSurface(pictures[i].surface);
|
SDL_FreeSurface(pictures[i].surface);
|
||||||
free(pictures);
|
SDL_free(pictures);
|
||||||
SDL_VideoQuit();
|
SDL_VideoQuit();
|
||||||
printf("Could not create rendering context for SDL_Shape window.\n");
|
printf("Could not create rendering context for SDL_Shape window.\n");
|
||||||
exit(-5);
|
exit(-5);
|
||||||
|
@ -137,7 +137,7 @@ int main(int argc,char** argv)
|
||||||
SDL_DestroyTexture(pictures[i].texture);
|
SDL_DestroyTexture(pictures[i].texture);
|
||||||
for(i=0;i<num_pictures;i++)
|
for(i=0;i<num_pictures;i++)
|
||||||
SDL_FreeSurface(pictures[i].surface);
|
SDL_FreeSurface(pictures[i].surface);
|
||||||
free(pictures);
|
SDL_free(pictures);
|
||||||
SDL_DestroyRenderer(renderer);
|
SDL_DestroyRenderer(renderer);
|
||||||
SDL_DestroyWindow(window);
|
SDL_DestroyWindow(window);
|
||||||
SDL_VideoQuit();
|
SDL_VideoQuit();
|
||||||
|
@ -194,7 +194,7 @@ int main(int argc,char** argv)
|
||||||
//Free the original surfaces backing the textures.
|
//Free the original surfaces backing the textures.
|
||||||
for(i=0;i<num_pictures;i++)
|
for(i=0;i<num_pictures;i++)
|
||||||
SDL_FreeSurface(pictures[i].surface);
|
SDL_FreeSurface(pictures[i].surface);
|
||||||
free(pictures);
|
SDL_free(pictures);
|
||||||
//Call SDL_VideoQuit() before quitting.
|
//Call SDL_VideoQuit() before quitting.
|
||||||
SDL_VideoQuit();
|
SDL_VideoQuit();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue