Cleanups in RGUI file_list

This commit is contained in:
twinaphex 2013-03-11 03:40:44 +01:00
parent b348e3f390
commit 05e306b599
3 changed files with 3 additions and 15 deletions

View File

@ -235,8 +235,8 @@ rgui_handle_t *rgui_init(const char *base_path,
rgui->userdata = userdata;
strlcpy(rgui->base_path, base_path, sizeof(rgui->base_path));
rgui->path_stack = rgui_list_new();
rgui->folder_buf = rgui_list_new();
rgui->path_stack = (rgui_list_t*)calloc(1, sizeof(rgui_list_t));
rgui->folder_buf = (rgui_list_t*)calloc(1, sizeof(rgui_list_t));
rgui_list_push(rgui->path_stack, base_path, RGUI_FILE_DIRECTORY, 0);
if (font_bmp_buf)

View File

@ -35,16 +35,6 @@ struct rgui_list
size_t size;
};
rgui_list_t *rgui_list_new(void)
{
return (rgui_list_t*)calloc(1, sizeof(rgui_list_t));
}
bool rgui_list_empty(const rgui_list_t *list)
{
return list->size == 0;
}
void rgui_list_push(rgui_list_t *list,
const char *path, unsigned type, size_t directory_ptr)
{
@ -63,7 +53,7 @@ void rgui_list_push(rgui_list_t *list,
void rgui_list_pop(rgui_list_t *list)
{
if (!rgui_list_empty(list))
if (!(list->size == 0))
free(list->list[--list->size].path);
}

View File

@ -22,7 +22,6 @@ extern "C" {
typedef struct rgui_list rgui_list_t;
rgui_list_t *rgui_list_new(void);
void rgui_list_free(rgui_list_t *list);
void rgui_list_push(rgui_list_t *list,
@ -30,7 +29,6 @@ void rgui_list_push(rgui_list_t *list,
void rgui_list_pop(rgui_list_t *list);
void rgui_list_clear(rgui_list_t *list);
bool rgui_list_empty(const rgui_list_t *list);
void rgui_list_get_last(const rgui_list_t *list,
const char **path, unsigned *type, size_t *directory_ptr);