aboutsummaryrefslogtreecommitdiff
path: root/include/list_management.h
diff options
context:
space:
mode:
authorThorsten Töpper <atsutane@freethoughts.de>2025-06-15 23:55:47 +0200
committerThorsten Töpper <atsutane@freethoughts.de>2025-06-15 23:55:47 +0200
commit62e45906f1ffcaa2e3039a4306c01465c3eadfd8 (patch)
tree4e388adaa1893807829c3714ea88ac8beb2dfcf7 /include/list_management.h
parent633e1ea568b5f9608319bbbe32c8fcdbf195c47d (diff)
downloaddir_monitor-62e45906f1ffcaa2e3039a4306c01465c3eadfd8.tar.gz
dir_monitor-62e45906f1ffcaa2e3039a4306c01465c3eadfd8.tar.bz2
Spread code into multiple files.
Diffstat (limited to 'include/list_management.h')
-rw-r--r--include/list_management.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/include/list_management.h b/include/list_management.h
new file mode 100644
index 0000000..0a887c7
--- /dev/null
+++ b/include/list_management.h
@@ -0,0 +1,35 @@
+/* SPDX-License-Identifier: Apache-2.0 */
+
+/* Copyright 2025 Thorsten Töpper
+ *
+ * list_management - data handling related code
+ *
+ * vim:ts=4:sw=4:expandtab
+ */
+
+#ifndef LIST_MANAGEMENT_H
+#define LIST_MANAGEMENT_H
+
+#include <time.h>
+
+/* === DEFINITIONS === */
+struct list_node {
+ struct list_node *next;
+ size_t fsize;
+ char fname[256];
+ time_t ftime; /* can be creation, access or modification */
+};
+
+struct list_head {
+ struct list_node *first;
+};
+
+struct list_node *create_node(char *fname, size_t fsize, time_t ftime);
+struct list_head *create_list_sort_reversed(struct list_head *list);
+void destroy_list(struct list_head *list);
+int insert_sorted_by_size(struct list_head *list, struct list_node *node);
+int insert_sorted_by_time(struct list_head *list, struct list_node *node);
+
+
+#endif
+