Create database_cursor_close

This commit is contained in:
twinaphex 2015-05-25 01:56:33 +02:00
parent 7322b01eb2
commit 57724f884c
3 changed files with 10 additions and 4 deletions

View File

@ -231,6 +231,12 @@ int database_cursor_open(libretrodb_t *db,
return 0; return 0;
} }
int database_cursor_close(libretrodb_t *db, libretrodb_cursor_t *cur)
{
libretrodb_cursor_close(cur);
libretrodb_close(db);
}
database_info_handle_t *database_info_init(const char *dir, enum database_type type) database_info_handle_t *database_info_init(const char *dir, enum database_type type)
{ {
database_info_handle_t *db = (database_info_handle_t*)calloc(1, sizeof(*db)); database_info_handle_t *db = (database_info_handle_t*)calloc(1, sizeof(*db));
@ -316,8 +322,7 @@ database_info_list_t *database_info_list_new(const char *rdb_path, const char *q
database_info_list->count = k; database_info_list->count = k;
end: end:
libretrodb_cursor_close(&cur); database_cursor_close(&db, &cur);
libretrodb_close(&db);
return database_info_list; return database_info_list;
} }

View File

@ -94,6 +94,8 @@ void database_info_list_free(database_info_list_t *list);
int database_cursor_open(libretrodb_t *db, int database_cursor_open(libretrodb_t *db,
libretrodb_cursor_t *cur, const char *query); libretrodb_cursor_t *cur, const char *query);
int database_cursor_close(libretrodb_t *db, libretrodb_cursor_t *cur);
int database_cursor_iterate(libretrodb_cursor_t *cur, database_info_t *db_info); int database_cursor_iterate(libretrodb_cursor_t *cur, database_info_t *db_info);
database_info_handle_t *database_info_init(const char *dir, database_info_handle_t *database_info_init(const char *dir,

View File

@ -1169,8 +1169,7 @@ static int menu_database_parse_query(file_list_t *list, const char *path,
} }
} }
libretrodb_cursor_close(&cur); database_cursor_close(&db, &cur);
libretrodb_close(&db);
#endif #endif
return 0; return 0;