From f2c1beb5c3139238a3570d8f5052635519367d26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yaroslav=20de=20la=20Pe=C3=B1a=20Smirnov?= Date: Thu, 13 Oct 2022 01:13:12 +0300 Subject: Switch to vector + qsort instead of bst Doesn't improve perfomance that much (sorting is far from the hotspot), but I realized that I didn't really need a BST for this use-case and I felt dumb for using one :/ --- include/components.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'include/components.h') diff --git a/include/components.h b/include/components.h index f08d79a..4317187 100644 --- a/include/components.h +++ b/include/components.h @@ -68,11 +68,11 @@ struct album { char year[8]; /* The date of the album is the date of the earliest image */ time_t tstamp; - /* - * Binary search tree with the images of this album sorted by date from + /* + * List/vector with the images of this album to be sorted by from * older to newer. */ - struct bstree *images; + struct vector *images; /* Files/dirs that belong to images and which shouldn't be deleted */ struct hmap *preserved; /* Reference counted hashmap with values to be passed to the template */ @@ -92,7 +92,7 @@ struct image *image_old(struct stat *istat); int image_cmp(const void *a, const void *b); -void image_destroy(void *data); +void image_destroy(struct image *); struct album *album_new(struct album_config *, struct site *, const char *src, const char *rsrc, const struct stat *); @@ -103,6 +103,6 @@ void album_add_image(struct album *, struct image *); void album_set_year(struct album *); -void album_destroy(void *data); +void album_destroy(struct album *); #endif -- cgit v1.2.3