diff options
author | Yaroslav de la Peña Smirnov <yps@yaroslavps.com> | 2023-01-26 22:43:29 +0300 |
---|---|---|
committer | Yaroslav de la Peña Smirnov <yps@yaroslavps.com> | 2023-01-26 22:43:29 +0300 |
commit | 43d153c00bb067276d3cda141ad62de27cb4971d (patch) | |
tree | bc878c5a9a306d1ce9aba8adc5a8eb000d2afa23 /include | |
parent | efd8f03262f5cfeedbf2bef0f05636088b39d679 (diff) | |
download | revela-0.1.3.tar.gz revela-0.1.3.zip |
Cleanup & fix new album images not being renderedv0.1.3
* Cleaned up some code and formatted with clang-format
* Fix the result of what can only be explained as me having a
brain-fart^1 leading me to write returns where they shouldn't be hence
the image-walk loop returning early when new images were added to an
album.
* Also cleaned up and fixed a bug in roscha; more in roscha's own repo.
1: https://www.youtube.com/watch?v=UN7SBXJj2pc
Diffstat (limited to 'include')
-rw-r--r-- | include/components.h | 4 | ||||
-rw-r--r-- | include/config.h | 16 | ||||
-rw-r--r-- | include/fs.h | 14 | ||||
-rw-r--r-- | include/log.h | 12 | ||||
-rw-r--r-- | include/render.h | 8 | ||||
-rw-r--r-- | include/site.h | 2 |
6 files changed, 28 insertions, 28 deletions
diff --git a/include/components.h b/include/components.h index 88023cb..293ff17 100644 --- a/include/components.h +++ b/include/components.h @@ -45,7 +45,7 @@ struct image { struct roscha_object *map; /* hashmap with values to be passed to the thumbs vector */ struct roscha_object *thumb; - /* + /* * Whether this image was modified since the last time the gallery was * generated. */ @@ -100,7 +100,7 @@ int image_cmp(const void *a, const void *b); void image_destroy(struct image *); struct album *album_new(struct album_config *, struct site *, - const char *src, const char *rsrc, const struct stat *); + const char *src, const char *rsrc, const struct stat *); int album_cmp(const void *a, const void *b); diff --git a/include/config.h b/include/config.h index 085eb5e..3ba1cf7 100644 --- a/include/config.h +++ b/include/config.h @@ -4,21 +4,21 @@ #include <stdint.h> #include <sys/types.h> -#define SITE_CONF "site.ini" +#define SITE_CONF "site.ini" #define ALBUM_CONF "album.ini" struct image_config { - bool strip; + bool strip; uint8_t quality; - size_t max_width; - size_t max_height; - bool smart_resize; - double blur; + size_t max_width; + size_t max_height; + bool smart_resize; + double blur; }; struct site_config { - char *title; - char *base_url; + char *title; + char *base_url; struct image_config images; struct image_config thumbnails; }; diff --git a/include/fs.h b/include/fs.h index 71c566b..6d405a4 100644 --- a/include/fs.h +++ b/include/fs.h @@ -14,12 +14,12 @@ enum nmkdir_res { NMKDIR_CREATED, }; -/* +/* * Returns a pointer to where the basename of the file is inside path. */ const char *rbasename(const char *path); -/* +/* * Makes a new directory if it doesn't exist. If there were errors returns * false, otherwise returns true. */ @@ -49,23 +49,23 @@ const char *delext(const char *restrict basename, char *restrict dest, size_t n) */ int file_is_uptodate(const char *path, const struct timespec *srcmtim); -/* +/* * Sets access and modification times to the time passed. */ void setdatetime(const char *path, const struct timespec *mtim); bool rmentry(const char *path, bool dry); -/* +/* * Recursively deletes extaneous files from directory, keeping files in the * preserved hmap. Returns -1 on error, number of deleted entries on success. * The number is not the total number of files on all subdirectories, but only * the number of files/dirs deleted from the directory pointed by path. */ ssize_t rmextra(const char *path, struct hmap *preserved, preremove_fn, - void *data, bool dry); + void *data, bool dry); -/* +/* * Copies file(s) truncating and overwritting the file(s) in the destination * path if they exist and are not a directory, or creating them if they don't * exist. If srcpath is a directory, copies all files within that directory @@ -73,6 +73,6 @@ ssize_t rmextra(const char *path, struct hmap *preserved, preremove_fn, * timestamps do not match. */ bool filesync(const char *restrict srcpath, const char *restrict dstpath, - struct hmap *preserved, bool dry); + struct hmap *preserved, bool dry); #endif diff --git a/include/log.h b/include/log.h index 2be35ee..c4a2430 100644 --- a/include/log.h +++ b/include/log.h @@ -29,27 +29,27 @@ void log_set_verbosity(enum log_level); void log_printf(enum log_level, const char *restrict fmt, ...); #ifdef DEBUG -#define log_print(v, fmt, ...) \ +#define log_print(v, fmt, ...) \ log_printf(v, "[%s] %s:%d " fmt, log_level_names[v], \ - __FILE__, __LINE__, ##__VA_ARGS__) + __FILE__, __LINE__, ##__VA_ARGS__) #else #define log_print(v, fmt, ...) \ log_printf(v, fmt, ##__VA_ARGS__) #endif #ifdef DEBUG -#define log_printl(v, fmt, ...) \ +#define log_printl(v, fmt, ...) \ log_printf(v, "[%s] %s:%d " fmt "\n", log_level_names[v], \ - __FILE__, __LINE__, ##__VA_ARGS__) + __FILE__, __LINE__, ##__VA_ARGS__) #else #define log_printl(v, fmt, ...) \ log_printf(v, fmt "\n", ##__VA_ARGS__) #endif #ifdef DEBUG -#define log_printl_errno(v, fmt, ...) \ +#define log_printl_errno(v, fmt, ...) \ log_printf(v, "[%s] %s:%d " fmt ": %s\n", log_level_names[v], \ - __FILE__, __LINE__, ##__VA_ARGS__, strerror(errno)) + __FILE__, __LINE__, ##__VA_ARGS__, strerror(errno)) #else #define log_printl_errno(v, fmt, ...) \ log_printf(v, fmt ": %s\n", ##__VA_ARGS__, strerror(errno)) diff --git a/include/render.h b/include/render.h index 24c931a..72c3cd2 100644 --- a/include/render.h +++ b/include/render.h @@ -24,7 +24,7 @@ struct index_template { struct roscha_object *years; }; -/* +/* * Variables for the album template and album elements in the albums vector of * the index template. */ @@ -77,15 +77,15 @@ struct render { bool render_make_index(struct render *, const char *path); bool render_make_album(struct render *r, const char *path, - const struct album *album); + const struct album *album); bool render_make_image(struct render *r, const char *path, - const struct image *image); + const struct image *image); bool render_set_album_vars(struct render *, struct album *); bool render_init(struct render *, const char *path, struct site_config *, - struct vector *albums); + struct vector *albums); void render_deinit(struct render *); diff --git a/include/site.h b/include/site.h index 0f45667..3980ea0 100644 --- a/include/site.h +++ b/include/site.h @@ -22,7 +22,7 @@ struct site { char *root_dir; char *output_dir; char *content_dir; - /* + /* * Indicates how many characters after the full root dir path of the input * directory the relative path of the albums + the content dir start. See * site_init() |