Avoid calling make_unique<...>({})

The compiler may or may not recognize that the temporary T{} passed to
make_unique can be omitted.  Help it by passing nothing, then explicitly
clearing the returned data as a separate step.
This commit is contained in:
Kp 2016-08-06 19:55:24 +00:00
parent cbeb42e48c
commit a1ab71f5ad
3 changed files with 6 additions and 3 deletions

View file

@ -776,7 +776,8 @@ int gr_init()
ogl_init_texture_list_internal();
grd_curscreen = make_unique<grs_screen, grs_screen>({});
grd_curscreen = make_unique<grs_screen>();
*grd_curscreen = {};
grd_curscreen->sc_canvas.cv_bitmap.bm_data = NULL;
// Set the mode.

View file

@ -174,7 +174,8 @@ int gr_init()
Error("SDL library video initialisation failed: %s.",SDL_GetError());
}
grd_curscreen = make_unique<grs_screen, grs_screen>({});
grd_curscreen = make_unique<grs_screen>();
*grd_curscreen = {};
if (!CGameCfg.WindowMode && !CGameArg.SysWindow)
sdl_video_flags|=SDL_FULLSCREEN;

View file

@ -223,7 +223,8 @@ void credits_show(const char *credits_filename)
const char *filename = CREDITS_FILE;
palette_array_t backdrop_palette;
auto cr = make_unique<credits, credits>({});
auto cr = make_unique<credits>();
*cr = {};
if (credits_filename) {
filename = credits_filename;
cr->have_bin_file = 1;