From 57724f884c12a3de1b9d56a121963a78aec6b491 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 25 May 2015 01:56:33 +0200 Subject: [PATCH] Create database_cursor_close --- database_info.c | 9 +++++++-- database_info.h | 2 ++ menu/menu_displaylist.c | 3 +-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/database_info.c b/database_info.c index cce87b5958..f14cf40646 100644 --- a/database_info.c +++ b/database_info.c @@ -231,6 +231,12 @@ int database_cursor_open(libretrodb_t *db, 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 *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; end: - libretrodb_cursor_close(&cur); - libretrodb_close(&db); + database_cursor_close(&db, &cur); return database_info_list; } diff --git a/database_info.h b/database_info.h index 11c7abbfef..ebd08fc99c 100644 --- a/database_info.h +++ b/database_info.h @@ -94,6 +94,8 @@ void database_info_list_free(database_info_list_t *list); int database_cursor_open(libretrodb_t *db, 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); database_info_handle_t *database_info_init(const char *dir, diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 876736f299..eac8492c14 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -1169,8 +1169,7 @@ static int menu_database_parse_query(file_list_t *list, const char *path, } } - libretrodb_cursor_close(&cur); - libretrodb_close(&db); + database_cursor_close(&db, &cur); #endif return 0;