Refactor away rarch_main_clear_state

This commit is contained in:
twinaphex 2015-09-26 13:35:04 +02:00
parent dd9aa6dae2
commit 54c3b60603
4 changed files with 9 additions and 14 deletions

View File

@ -1073,7 +1073,7 @@ void rarch_main_alloc(void)
event_command(EVENT_CMD_HISTORY_DEINIT); event_command(EVENT_CMD_HISTORY_DEINIT);
rarch_main_clear_state(); rarch_main_ctl(RARCH_MAIN_CTL_CLEAR_STATE, NULL);
rarch_main_data_clear_state(); rarch_main_data_clear_state();
} }

View File

@ -855,21 +855,17 @@ FILE *rarch_main_log_file(void)
return global->log_file; return global->log_file;
} }
void rarch_main_clear_state(void)
{
driver_clear_state();
rarch_main_state_free();
rarch_main_global_free();
}
bool rarch_main_ctl(enum rarch_main_ctl_state state, void *data) bool rarch_main_ctl(enum rarch_main_ctl_state state, void *data)
{ {
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
switch (state) switch (state)
{ {
case RARCH_MAIN_CTL_CLEAR_STATE:
driver_clear_state();
rarch_main_state_free();
rarch_main_global_free();
return true;
case RARCH_MAIN_CTL_SET_MAX_FRAMES: case RARCH_MAIN_CTL_SET_MAX_FRAMES:
{ {
unsigned *ptr = (unsigned*)data; unsigned *ptr = (unsigned*)data;

View File

@ -42,7 +42,8 @@ enum rarch_main_ctl_state
RARCH_MAIN_CTL_IS_PAUSED, RARCH_MAIN_CTL_IS_PAUSED,
RARCH_MAIN_CTL_SET_PAUSED, RARCH_MAIN_CTL_SET_PAUSED,
RARCH_MAIN_CTL_SET_MAX_FRAMES, RARCH_MAIN_CTL_SET_MAX_FRAMES,
RARCH_MAIN_CTL_SET_FRAME_LIMIT_LAST_TIME RARCH_MAIN_CTL_SET_FRAME_LIMIT_LAST_TIME,
RARCH_MAIN_CTL_CLEAR_STATE
}; };
typedef struct rarch_resolution typedef struct rarch_resolution
@ -333,8 +334,6 @@ void rarch_main_msg_queue_free(void);
void rarch_main_msg_queue_init(void); void rarch_main_msg_queue_init(void);
void rarch_main_clear_state(void);
bool rarch_main_verbosity(void); bool rarch_main_verbosity(void);
FILE *rarch_main_log_file(void); FILE *rarch_main_log_file(void);

View File

@ -36,7 +36,7 @@ int main(int argc, char *argv[])
(argc - optind - 1) * sizeof(char*)); (argc - optind - 1) * sizeof(char*));
argc--; argc--;
rarch_main_clear_state(); rarch_main_ctl(RARCH_MAIN_CTL_CLEAR_STATE);
} }
} }