(task_database.c) Cleanup

This commit is contained in:
twinaphex 2016-09-29 11:07:56 +02:00
parent ebfd787aed
commit a304b42f73

View File

@ -480,12 +480,7 @@ static int task_database_iterate_serial_lookup(
static int task_database_iterate(database_state_handle_t *db_state, static int task_database_iterate(database_state_handle_t *db_state,
database_info_handle_t *db) database_info_handle_t *db)
{ {
const char *name = NULL; const char *name = database_info_get_current_element_name(db);
if (!db)
return -1;
name = database_info_get_current_element_name(db);
if (!name) if (!name)
return 0; return 0;
@ -549,12 +544,12 @@ static void task_database_handler(retro_task_t *task)
switch (dbinfo->status) switch (dbinfo->status)
{ {
case DATABASE_STATUS_ITERATE_BEGIN: case DATABASE_STATUS_ITERATE_BEGIN:
if (dbstate && !dbstate->list)
{ {
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
if (dbstate && !dbstate->list) dbstate->list = dir_list_new_special(
dbstate->list = dir_list_new_special( settings->path.content_database,
settings->path.content_database, DIR_LIST_DATABASES, NULL);
DIR_LIST_DATABASES, NULL);
} }
dbinfo->status = DATABASE_STATUS_ITERATE_START; dbinfo->status = DATABASE_STATUS_ITERATE_START;
break; break;
@ -566,7 +561,7 @@ static void task_database_handler(retro_task_t *task)
task_database_iterate_start(dbinfo, name); task_database_iterate_start(dbinfo, name);
break; break;
case DATABASE_STATUS_ITERATE: case DATABASE_STATUS_ITERATE:
if (task_database_iterate(&db->state, dbinfo) == 0) if (dbstate && task_database_iterate(dbstate, dbinfo) == 0)
{ {
dbinfo->status = DATABASE_STATUS_ITERATE_NEXT; dbinfo->status = DATABASE_STATUS_ITERATE_NEXT;
dbinfo->type = DATABASE_TYPE_ITERATE; dbinfo->type = DATABASE_TYPE_ITERATE;