Move playlist variable to menu_driver_ctl as static local

variable
This commit is contained in:
twinaphex 2015-12-11 13:08:30 +01:00
parent 22b06f2d38
commit 01ca22587a
2 changed files with 13 additions and 16 deletions

View File

@ -645,11 +645,12 @@ error:
bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data) bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
{ {
static struct retro_system_info menu_driver_system; static struct retro_system_info menu_driver_system;
static bool menu_driver_prevent_populate = false; static content_playlist_t *menu_driver_playlist = NULL;
static bool menu_driver_load_no_content = false; static bool menu_driver_prevent_populate = false;
static bool menu_driver_alive = false; static bool menu_driver_load_no_content = false;
static bool menu_driver_data_own = false; static bool menu_driver_alive = false;
const menu_ctx_driver_t *driver = menu_ctx_driver_get_ptr(); static bool menu_driver_data_own = false;
const menu_ctx_driver_t *driver = menu_ctx_driver_get_ptr();
switch (state) switch (state)
{ {
@ -661,27 +662,25 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
menu_driver_ctx = NULL; menu_driver_ctx = NULL;
break; break;
case RARCH_MENU_CTL_PLAYLIST_FREE: case RARCH_MENU_CTL_PLAYLIST_FREE:
if (!menu_driver_data) if (menu_driver_playlist)
return false; content_playlist_free(menu_driver_playlist);
if (menu_driver_data->playlist) menu_driver_playlist = NULL;
content_playlist_free(menu_driver_data->playlist);
menu_driver_data->playlist = NULL;
break; break;
case RARCH_MENU_CTL_PLAYLIST_INIT: case RARCH_MENU_CTL_PLAYLIST_INIT:
{ {
const char *path = (const char*)data; const char *path = (const char*)data;
if (!path || path[0] == '\0' || !menu_driver_data) if (!path || path[0] == '\0')
return false; return false;
menu_driver_data->playlist = content_playlist_init(path, menu_driver_playlist = content_playlist_init(path,
COLLECTION_SIZE); COLLECTION_SIZE);
} }
return true; return true;
case RARCH_MENU_CTL_PLAYLIST_GET: case RARCH_MENU_CTL_PLAYLIST_GET:
{ {
content_playlist_t **playlist = (content_playlist_t**)data; content_playlist_t **playlist = (content_playlist_t**)data;
if (!playlist || !menu_driver_data) if (!playlist)
return false; return false;
*playlist = menu_driver_data->playlist; *playlist = menu_driver_playlist;
} }
return true; return true;
case RARCH_MENU_CTL_SYSTEM_INFO_GET: case RARCH_MENU_CTL_SYSTEM_INFO_GET:

View File

@ -33,7 +33,6 @@
#include "../driver.h" #include "../driver.h"
#include "../libretro.h" #include "../libretro.h"
#include "../playlist.h"
#include "../dynamic.h" #include "../dynamic.h"
#ifdef __cplusplus #ifdef __cplusplus
@ -248,7 +247,6 @@ typedef struct
char default_glslp[PATH_MAX_LENGTH]; char default_glslp[PATH_MAX_LENGTH];
char default_cgp[PATH_MAX_LENGTH]; char default_cgp[PATH_MAX_LENGTH];
content_playlist_t *playlist;
char db_playlist_file[PATH_MAX_LENGTH]; char db_playlist_file[PATH_MAX_LENGTH];
} menu_handle_t; } menu_handle_t;