diff options
Diffstat (limited to 'src/json.c')
-rw-r--r-- | src/json.c | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -241,11 +241,16 @@ int og_json_parse_procedure(json_t *element, struct og_procedure *proc) return err; } -void og_cache_image_free(struct list_head *cache_list) +void og_cache_data_init(struct og_cache_data *cache_data) +{ + INIT_LIST_HEAD(&cache_data->image_list); +} + +void og_cache_data_free(struct og_cache_data *cache_data) { struct og_cache_image *cache_item, *tmp; - list_for_each_entry_safe(cache_item, tmp, cache_list, list) { + list_for_each_entry_safe(cache_item, tmp, &cache_data->image_list, list) { list_del(&cache_item->list); free(cache_item); } @@ -308,7 +313,7 @@ static int og_json_parse_cache_images(json_t *element, struct list_head *cache_l return err; } -int og_json_parse_cache(json_t *element, struct og_cache_data *cache_data, struct list_head *cache_list) +int og_json_parse_cache(json_t *element, struct og_cache_data *cache_data) { uint64_t required_flags = OG_PARAM_CACHE_FREE_SIZE | OG_PARAM_CACHE_USED_SIZE | OG_PARAM_CACHE_IMAGES; uint64_t flags = 0UL; @@ -330,7 +335,7 @@ int og_json_parse_cache(json_t *element, struct og_cache_data *cache_data, struc err = og_json_parse_uint64(value, &cache_data->free_size); flags |= OG_PARAM_CACHE_FREE_SIZE; } else if (!strcmp(key, "images")) { - err = og_json_parse_cache_images(value, cache_list); + err = og_json_parse_cache_images(value, &cache_data->image_list); flags |= OG_PARAM_CACHE_IMAGES; } else err = -1; |