Simplify SDL deleter logic
This commit is contained in:
@@ -20,7 +20,7 @@ struct SDL_Deleter {
|
|||||||
*/
|
*/
|
||||||
struct SDL_Texture_Deleter {
|
struct SDL_Texture_Deleter {
|
||||||
void operator()(SDL_Texture *p) const {
|
void operator()(SDL_Texture *p) const {
|
||||||
if (p == nullptr) SDL_DestroyTexture(p);
|
SDL_DestroyTexture(p);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -29,8 +29,7 @@ struct SDL_Texture_Deleter {
|
|||||||
*/
|
*/
|
||||||
struct SDL_Surface_Deleter {
|
struct SDL_Surface_Deleter {
|
||||||
void operator()(SDL_Surface *p) const {
|
void operator()(SDL_Surface *p) const {
|
||||||
// Check if the surface is not null
|
SDL_FreeSurface(p);
|
||||||
if (p == nullptr) SDL_FreeSurface(p);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -38,4 +37,4 @@ struct SDL_Surface_Deleter {
|
|||||||
} // namespace app
|
} // namespace app
|
||||||
} // namespace yaze
|
} // namespace yaze
|
||||||
|
|
||||||
#endif // YAZE_APP_CORE_UTILS_SDL_DELETER_H_
|
#endif // YAZE_APP_CORE_UTILS_SDL_DELETER_H_
|
||||||
|
|||||||
Reference in New Issue
Block a user