mirror of
https://github.com/libretro/RetroArch
synced 2025-02-07 12:39:54 +00:00
Add file_list_copy function
This commit is contained in:
parent
99111c2633
commit
6562c2cd95
23
file_list.c
23
file_list.c
@ -100,6 +100,29 @@ void file_list_clear(file_list_t *list)
|
|||||||
list->size = 0;
|
list->size = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void file_list_copy(file_list_t *list, file_list_t *list_old)
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
list_old->size = list->size;
|
||||||
|
list_old->capacity = list->capacity;
|
||||||
|
|
||||||
|
list_old->list = (struct item_file*)realloc(list_old->list,
|
||||||
|
list_old->capacity * sizeof(struct item_file));
|
||||||
|
|
||||||
|
for (i = 0; i < list->size; i++)
|
||||||
|
{
|
||||||
|
list_old->list[i].path = strdup(list->list[i].path);
|
||||||
|
list_old->list[i].label = strdup(list->list[i].label);
|
||||||
|
if (list->list[i].alt)
|
||||||
|
list_old->list[i].alt = strdup(list->list[i].alt);
|
||||||
|
list_old->list[i].type = list->list[i].type;
|
||||||
|
list_old->list[i].directory_ptr = list->list[i].directory_ptr;
|
||||||
|
list_old->list[i].userdata = list->list[i].userdata;
|
||||||
|
list_old->list[i].actiondata = list->list[i].actiondata;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void file_list_set_label_at_offset(file_list_t *list, size_t index,
|
void file_list_set_label_at_offset(file_list_t *list, size_t index,
|
||||||
const char *label)
|
const char *label)
|
||||||
{
|
{
|
||||||
|
@ -55,6 +55,7 @@ void file_list_push(file_list_t *userdata, const char *path,
|
|||||||
const char *label, unsigned type, size_t current_directory_ptr);
|
const char *label, unsigned type, size_t current_directory_ptr);
|
||||||
void file_list_pop(file_list_t *list, size_t *directory_ptr);
|
void file_list_pop(file_list_t *list, size_t *directory_ptr);
|
||||||
void file_list_clear(file_list_t *list);
|
void file_list_clear(file_list_t *list);
|
||||||
|
void file_list_copy(file_list_t *list, file_list_t *list_old);
|
||||||
|
|
||||||
void file_list_get_last(const file_list_t *list,
|
void file_list_get_last(const file_list_t *list,
|
||||||
const char **path, const char **label,
|
const char **path, const char **label,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user