From 2bcc2d08d74d8904b3538bf83837d195481ae85d Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 19 May 2015 23:10:53 +0200 Subject: [PATCH] Move remaining menu_common_list functiosn to menu_list.c --- Makefile.common | 1 - griffin/griffin.c | 1 - menu/menu_common_list.c | 64 ----------------------------------------- menu/menu_common_list.h | 37 ------------------------ menu/menu_list.c | 44 +++++++++++++++++++++++++++- 5 files changed, 43 insertions(+), 104 deletions(-) delete mode 100644 menu/menu_common_list.c delete mode 100644 menu/menu_common_list.h diff --git a/Makefile.common b/Makefile.common index 44c0fa795f..b3c78737a1 100644 --- a/Makefile.common +++ b/Makefile.common @@ -337,7 +337,6 @@ ifeq ($(HAVE_MENU_COMMON), 1) OBJ += menu/menu_input.o \ menu/menu.o \ menu/menu_entry.o \ - menu/menu_common_list.o \ menu/menu_navigation.o \ menu/menu_setting.o \ menu/menu_database.o \ diff --git a/griffin/griffin.c b/griffin/griffin.c index 495f63c3a7..f4b7021741 100644 --- a/griffin/griffin.c +++ b/griffin/griffin.c @@ -713,7 +713,6 @@ MENU #include "../menu/menu_input.c" #include "../menu/menu.c" #include "../menu/menu_entry.c" -#include "../menu/menu_common_list.c" #include "../menu/menu_setting.c" #include "../menu/menu_list.c" #include "../menu/menu_entries_cbs_ok.c" diff --git a/menu/menu_common_list.c b/menu/menu_common_list.c deleted file mode 100644 index 7204b3ba37..0000000000 --- a/menu/menu_common_list.c +++ /dev/null @@ -1,64 +0,0 @@ -/* RetroArch - A frontend for libretro. - * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2015 - Daniel De Matteis - * - * RetroArch is free software: you can redistribute it and/or modify it under the terms - * of the GNU General Public License as published by the Free Software Found- - * ation, either version 3 of the License, or (at your option) any later version. - * - * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with RetroArch. - * If not, see . - */ - -#include "menu_common_list.h" -#include "menu.h" -#include "menu_entries_cbs.h" - -void menu_common_list_insert(void *data, - const char *path, const char *label, - unsigned type, size_t idx) -{ - file_list_t *list = (file_list_t*)data; - - if (!list) - return; - - list->list[idx].actiondata = (menu_file_list_cbs_t*) - calloc(1, sizeof(menu_file_list_cbs_t)); - - if (!list->list[idx].actiondata) - { - RARCH_ERR("Action data could not be allocated.\n"); - return; - } - - menu_entries_cbs_init(list, path, label, type, idx); -} - -void menu_common_list_delete(void *data, size_t idx, - size_t list_size) -{ - menu_file_list_cbs_t *cbs = NULL; - file_list_t *list = (file_list_t*)data; - - if (!list) - return; - - cbs = (menu_file_list_cbs_t*)list->list[idx].actiondata; - - if (cbs) - { - cbs->action_start = NULL; - cbs->action_ok = NULL; - cbs->action_cancel = NULL; - cbs->action_left = NULL; - cbs->action_right = NULL; - cbs->action_deferred_push = NULL; - free(list->list[idx].actiondata); - } - list->list[idx].actiondata = NULL; -} diff --git a/menu/menu_common_list.h b/menu/menu_common_list.h deleted file mode 100644 index 4604245255..0000000000 --- a/menu/menu_common_list.h +++ /dev/null @@ -1,37 +0,0 @@ -/* RetroArch - A frontend for libretro. - * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2015 - Daniel De Matteis - * - * RetroArch is free software: you can redistribute it and/or modify it under the terms - * of the GNU General Public License as published by the Free Software Found- - * ation, either version 3 of the License, or (at your option) any later version. - * - * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with RetroArch. - * If not, see . - */ - -#ifndef MENU_COMMON_LIST_H__ -#define MENU_COMMON_LIST_H__ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -void menu_common_list_insert(void *data, - const char *path, const char *label, - unsigned type, size_t idx); - -void menu_common_list_delete(void *data, size_t idx, - size_t list_size); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/menu/menu_list.c b/menu/menu_list.c index 62538fbc8e..0f9796e90b 100644 --- a/menu/menu_list.c +++ b/menu/menu_list.c @@ -20,8 +20,8 @@ #include "../driver.h" #include "menu.h" -#include "menu_common_list.h" #include "menu_list.h" +#include "menu_entries_cbs.h" #include "menu_navigation.h" menu_list_t *menu_list_get_ptr(void) @@ -143,6 +143,29 @@ void menu_list_refresh(file_list_t *list) menu_navigation_clear(nav, true); } +static void menu_common_list_delete(file_list_t *list, size_t idx, + size_t list_size) +{ + menu_file_list_cbs_t *cbs = NULL; + + if (!list) + return; + + cbs = (menu_file_list_cbs_t*)list->list[idx].actiondata; + + if (cbs) + { + cbs->action_start = NULL; + cbs->action_ok = NULL; + cbs->action_cancel = NULL; + cbs->action_left = NULL; + cbs->action_right = NULL; + cbs->action_deferred_push = NULL; + free(list->list[idx].actiondata); + } + list->list[idx].actiondata = NULL; +} + static void menu_list_destroy(file_list_t *list) { unsigned i; @@ -345,6 +368,25 @@ end: file_list_clear(list); } +static void menu_common_list_insert(file_list_t *list, + const char *path, const char *label, + unsigned type, size_t idx) +{ + if (!list) + return; + + list->list[idx].actiondata = (menu_file_list_cbs_t*) + calloc(1, sizeof(menu_file_list_cbs_t)); + + if (!list->list[idx].actiondata) + { + RARCH_ERR("Action data could not be allocated.\n"); + return; + } + + menu_entries_cbs_init(list, path, label, type, idx); +} + void menu_list_push(file_list_t *list, const char *path, const char *label, unsigned type, size_t directory_ptr)