mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-16 15:27:41 +00:00
(Settings_data.c) Get rid of list_tmp/list_temp
This commit is contained in:
parent
cd2acaaec6
commit
067df38262
@ -2127,17 +2127,15 @@ static void general_write_handler(void *data)
|
|||||||
#define APPEND(VALUE) \
|
#define APPEND(VALUE) \
|
||||||
if (index == list_size) \
|
if (index == list_size) \
|
||||||
{ \
|
{ \
|
||||||
rarch_setting_t* list_temp = NULL; \
|
|
||||||
list_size *= 2; \
|
list_size *= 2; \
|
||||||
\
|
\
|
||||||
if (!(list_temp = (rarch_setting_t*)realloc(list, sizeof(rarch_setting_t) * list_size))) \
|
if (!(list = (rarch_setting_t*)realloc(list, sizeof(rarch_setting_t) * list_size))) \
|
||||||
{ \
|
{ \
|
||||||
RARCH_ERR("Settings list reallocation failed.\n"); \
|
RARCH_ERR("Settings list reallocation failed.\n"); \
|
||||||
free(list); \
|
free(list); \
|
||||||
list = NULL; \
|
list = NULL; \
|
||||||
return NULL; \
|
return NULL; \
|
||||||
} \
|
} \
|
||||||
list = list_temp; \
|
|
||||||
} \
|
} \
|
||||||
(list[index++]) = VALUE
|
(list[index++]) = VALUE
|
||||||
|
|
||||||
@ -2181,7 +2179,6 @@ rarch_setting_t *setting_data_get_mainmenu(bool regenerate)
|
|||||||
{
|
{
|
||||||
int index = 0;
|
int index = 0;
|
||||||
static rarch_setting_t* list = NULL;
|
static rarch_setting_t* list = NULL;
|
||||||
rarch_setting_t* list_tmp = NULL;
|
|
||||||
int list_size = 32;
|
int list_size = 32;
|
||||||
static bool lists[32];
|
static bool lists[32];
|
||||||
|
|
||||||
@ -2250,12 +2247,7 @@ rarch_setting_t *setting_data_get_mainmenu(bool regenerate)
|
|||||||
APPEND(terminator);
|
APPEND(terminator);
|
||||||
|
|
||||||
/* flatten this array to save ourselves some kilobytes */
|
/* flatten this array to save ourselves some kilobytes */
|
||||||
list_tmp = (rarch_setting_t*)realloc(list, sizeof(rarch_setting_t) * index);
|
if (!(list = (rarch_setting_t*)realloc(list, index * sizeof(rarch_setting_t))))
|
||||||
if (list_tmp)
|
|
||||||
{
|
|
||||||
list = list_tmp;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
RARCH_ERR("setting_data_get_mainmenu list flattening failed.\n");
|
RARCH_ERR("setting_data_get_mainmenu list flattening failed.\n");
|
||||||
free(list);
|
free(list);
|
||||||
@ -2272,7 +2264,6 @@ rarch_setting_t *setting_data_get_list(void)
|
|||||||
{
|
{
|
||||||
int i, player, index = 0;
|
int i, player, index = 0;
|
||||||
static rarch_setting_t* list = NULL;
|
static rarch_setting_t* list = NULL;
|
||||||
rarch_setting_t* list_tmp = NULL;
|
|
||||||
int list_size = 512;
|
int list_size = 512;
|
||||||
|
|
||||||
if (list)
|
if (list)
|
||||||
@ -2622,13 +2613,7 @@ rarch_setting_t *setting_data_get_list(void)
|
|||||||
APPEND(terminator);
|
APPEND(terminator);
|
||||||
|
|
||||||
/* flatten this array to save ourselves some kilobytes. */
|
/* flatten this array to save ourselves some kilobytes. */
|
||||||
list_tmp = (rarch_setting_t*)
|
if (!(list = (rarch_setting_t*)realloc(list, index * sizeof(rarch_setting_t))))
|
||||||
realloc(list, sizeof(rarch_setting_t) * index);
|
|
||||||
if (list_tmp)
|
|
||||||
{
|
|
||||||
list = list_tmp;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
RARCH_ERR("setting_data_get_list list flattening failed.\n");
|
RARCH_ERR("setting_data_get_list list flattening failed.\n");
|
||||||
free(list);
|
free(list);
|
||||||
|
Loading…
Reference in New Issue
Block a user