Simplify usage of menu->userdata

This commit is contained in:
twinaphex 2015-12-11 14:55:04 +01:00
parent 9580dc5392
commit 6ae5725373
4 changed files with 12 additions and 13 deletions

View File

@ -961,12 +961,12 @@ static void *mui_init(void)
if (!menu_display_driver_init_first())
goto error;
menu->userdata = (mui_handle_t*)calloc(1, sizeof(mui_handle_t));
mui = (mui_handle_t*)calloc(1, sizeof(mui_handle_t));
if (!menu->userdata)
if (!mui)
goto error;
mui = (mui_handle_t*)menu->userdata;
menu->userdata = mui;
mui_layout(mui);
mui_allocate_white_texture(mui);

View File

@ -638,11 +638,13 @@ static void *rgui_init(void)
if (!menu)
return NULL;
menu->userdata = rgui = (rgui_t*)calloc(1, sizeof(rgui_t));
rgui = (rgui_t*)calloc(1, sizeof(rgui_t));
if (!rgui)
goto error;
menu->userdata = rgui;
/* 4 extra lines to cache the checked background */
fb_data = (uint16_t*)calloc(400 * (240 + 4), sizeof(uint16_t));
@ -682,9 +684,6 @@ error:
free(fb_data);
fb_data = NULL;
menu_display_ctl(MENU_DISPLAY_CTL_SET_FB_DATA, &fb_data);
if (menu->userdata)
free(menu->userdata);
menu->userdata = NULL;
free(menu);
}
return NULL;

View File

@ -1904,12 +1904,12 @@ static void *xmb_init(void)
video_driver_get_size(&width, &height);
menu->userdata = (xmb_handle_t*)calloc(1, sizeof(xmb_handle_t));
xmb = (xmb_handle_t*)calloc(1, sizeof(xmb_handle_t));
if (!menu->userdata)
if (!xmb)
goto error;
xmb = (xmb_handle_t*)menu->userdata;
menu->userdata = xmb;
xmb->menu_stack_old = (file_list_t*)calloc(1, sizeof(file_list_t));

View File

@ -1059,12 +1059,12 @@ static void *zarch_init(void)
if (!menu_display_driver_init_first())
goto error;
menu->userdata = (zui_t*)calloc(1, sizeof(zui_t));
zui = (zui_t*)calloc(1, sizeof(zui_t));
if (!menu->userdata)
if (!zui)
goto error;
zui = (zui_t*)menu->userdata;
menu->userdata = zui;
if (settings->menu.mouse.enable)
{