commit 045ce43755cb86538a781931764b6136c8cb6905
parent 15643f8f148616b3145c901fdf1ce307cbafb87f
Author: Paco Esteban <paco@e1e0.net>
Date: Mon, 29 Jun 2020 16:34:04 +0200
change SLIST to LIST so I can use INSERT_BEFORE.
This is for future sorting.
Diffstat:
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/ssnail.c b/ssnail.c
@@ -48,10 +48,10 @@ struct article {
long long src_mtime;
long long dst_mtime;
- SLIST_ENTRY(article) entries;
+ LIST_ENTRY(article) entries;
};
-SLIST_HEAD(listhead, article) head;
+LIST_HEAD(listhead, article) head;
__dead static void usage(void);
static void articleq_free(struct listhead *);
@@ -122,7 +122,7 @@ main(int argc, char *argv[])
argc -= optind;
argv += optind;
- SLIST_INIT(&head); /* init the linked list */
+ LIST_INIT(&head); /* init the linked list */
/* src and dst dir are mandatory. */
if (argc < 2)
usage();
@@ -142,7 +142,7 @@ main(int argc, char *argv[])
goto done;
printf("Generate html files ... \n");
- SLIST_FOREACH(ap, &head, entries) {
+ LIST_FOREACH(ap, &head, entries) {
if ((ap->src_mtime > ap->dst_mtime) || force) {
printf("... %s\n", ap->dst_path);
error = write_html(ap, header_tpl, footer_tpl);
@@ -170,9 +170,9 @@ articleq_free(struct listhead *h)
{
struct article *a;
- while (!SLIST_EMPTY(h)) {
- a = SLIST_FIRST(h);
- SLIST_REMOVE_HEAD(h, entries);
+ while (!LIST_EMPTY(h)) {
+ a = LIST_FIRST(h);
+ LIST_REMOVE(a, entries);
free(a->src_path);
free(a->dst_path);
free(a->orig_content);
@@ -417,7 +417,7 @@ process_dir(char *src, char *dst, int force)
error = ssnail_error_from_errno("populate");
goto out;
}
- SLIST_INSERT_HEAD(&head, a, entries);
+ LIST_INSERT_HEAD(&head, a, entries);
} else {
error = copy_file(src_path, dst_path, force);
if (error)