Skip to content

Commit

Permalink
Add DATABASE_STATUS_ITERATE_NEXT
Browse files Browse the repository at this point in the history
  • Loading branch information
inactive123 committed May 23, 2015
1 parent 7696d55 commit 74bea2c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions database_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ enum database_status
{
DATABASE_STATUS_NONE = 0,
DATABASE_STATUS_ITERATE,
DATABASE_STATUS_ITERATE_NEXT,
DATABASE_STATUS_FREE,
};

Expand Down
15 changes: 14 additions & 1 deletion tasks/task_database.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,14 @@ static int database_info_iterate_playlist(
free(ret_buf);
}

db->status = DATABASE_STATUS_ITERATE_NEXT;

return 0;
}

static int database_info_iterate_next(
database_info_handle_t *db)
{
db->list_ptr++;

if (db->list_ptr < db->list->size)
Expand Down Expand Up @@ -133,7 +141,12 @@ void rarch_main_data_db_iterate(bool is_thread, void *data)
switch (db->status)
{
case DATABASE_STATUS_ITERATE:
if (database_info_iterate(db) != 0)
database_info_iterate(db);
break;
case DATABASE_STATUS_ITERATE_NEXT:
if (database_info_iterate_next(db) == 0)
db->status = DATABASE_STATUS_ITERATE;
else
{
rarch_main_msg_queue_push("Scanning of directory finished.\n", 0, 180, true);
db->status = DATABASE_STATUS_FREE;
Expand Down

0 comments on commit 74bea2c

Please sign in to comment.