summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-12-18 16:11:09 +0100
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-12-18 16:11:36 +0100
commit2262af9f82d8a07751acea042844906649053a9f (patch)
treec104323ccec9610f60e9d56535366d9ddbbfeb69
parentf4604f8d0bb66ad7a777877dd01b069a82e1b18d (diff)
Cleanup: internalize some fstree functions
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
-rw-r--r--include/fstree.h10
-rw-r--r--lib/fstree/Makemodule.am2
-rw-r--r--lib/fstree/fstree.c4
-rw-r--r--lib/fstree/fstree_sort.c4
-rw-r--r--lib/fstree/internal.h23
-rw-r--r--lib/fstree/post_process.c4
-rw-r--r--lib/fstree/source_date_epoch.c5
-rw-r--r--tests/Makemodule.am2
-rw-r--r--tests/fstree_init.c1
-rw-r--r--tests/fstree_sort.c1
10 files changed, 33 insertions, 23 deletions
diff --git a/include/fstree.h b/include/fstree.h
index c06efa7..7bc92fd 100644
--- a/include/fstree.h
+++ b/include/fstree.h
@@ -172,16 +172,6 @@ void fstree_post_process(fstree_t *fs);
*/
char *fstree_get_path(tree_node_t *node);
-/* ASCIIbetically sort a linked list of tree nodes */
-tree_node_t *tree_node_list_sort(tree_node_t *head);
-
-/*
- If the environment variable SOURCE_DATE_EPOCH is set to a parsable number
- that fits into an unsigned 32 bit value, return its value. Otherwise,
- default to 0.
- */
-sqfs_u32 get_source_date_epoch(void);
-
/*
Convert back to forward slashed, remove all preceeding and trailing slashes,
collapse all sequences of slashes, remove all path components that are '.'
diff --git a/lib/fstree/Makemodule.am b/lib/fstree/Makemodule.am
index 64c2650..33b508c 100644
--- a/lib/fstree/Makemodule.am
+++ b/lib/fstree/Makemodule.am
@@ -3,7 +3,7 @@ libfstree_a_SOURCES += lib/fstree/fstree_sort.c
libfstree_a_SOURCES += lib/fstree/post_process.c lib/fstree/get_path.c
libfstree_a_SOURCES += lib/fstree/mknode.c
libfstree_a_SOURCES += lib/fstree/add_by_path.c
-libfstree_a_SOURCES += include/fstree.h
+libfstree_a_SOURCES += include/fstree.h lib/fstree/internal.h
libfstree_a_SOURCES += lib/fstree/source_date_epoch.c
libfstree_a_SOURCES += lib/fstree/canonicalize_name.c
libfstree_a_CFLAGS = $(AM_CFLAGS)
diff --git a/lib/fstree/fstree.c b/lib/fstree/fstree.c
index 90e14ce..ce35b84 100644
--- a/lib/fstree/fstree.c
+++ b/lib/fstree/fstree.c
@@ -4,9 +4,7 @@
*
* Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at>
*/
-#include "config.h"
-
-#include "fstree.h"
+#include "internal.h"
#include <string.h>
#include <stdlib.h>
diff --git a/lib/fstree/fstree_sort.c b/lib/fstree/fstree_sort.c
index 124106e..58ffadf 100644
--- a/lib/fstree/fstree_sort.c
+++ b/lib/fstree/fstree_sort.c
@@ -5,9 +5,7 @@
* Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at>
* Copyright (C) 2019 Zachary Dremann <dremann@gmail.com>
*/
-#include "config.h"
-
-#include "fstree.h"
+#include "internal.h"
#include <string.h>
diff --git a/lib/fstree/internal.h b/lib/fstree/internal.h
new file mode 100644
index 0000000..e8e5eef
--- /dev/null
+++ b/lib/fstree/internal.h
@@ -0,0 +1,23 @@
+/* SPDX-License-Identifier: GPL-3.0-or-later */
+/*
+ * internal.h
+ *
+ * Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at>
+ */
+#ifndef FSTREE_INTERNAL_H
+#define FSTREE_INTERNAL_H
+
+#include "config.h"
+#include "fstree.h"
+
+/* ASCIIbetically sort a linked list of tree nodes */
+tree_node_t *tree_node_list_sort(tree_node_t *head);
+
+/*
+ If the environment variable SOURCE_DATE_EPOCH is set to a parsable number
+ that fits into an unsigned 32 bit value, return its value. Otherwise,
+ default to 0.
+ */
+sqfs_u32 get_source_date_epoch(void);
+
+#endif /* FSTREE_INTERNAL_H */
diff --git a/lib/fstree/post_process.c b/lib/fstree/post_process.c
index 5e7f152..ea52e4f 100644
--- a/lib/fstree/post_process.c
+++ b/lib/fstree/post_process.c
@@ -4,9 +4,7 @@
*
* Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at>
*/
-#include "config.h"
-
-#include "fstree.h"
+#include "internal.h"
#include <stdlib.h>
#include <stdio.h>
diff --git a/lib/fstree/source_date_epoch.c b/lib/fstree/source_date_epoch.c
index 9b47d56..1efa688 100644
--- a/lib/fstree/source_date_epoch.c
+++ b/lib/fstree/source_date_epoch.c
@@ -1,11 +1,10 @@
/* SPDX-License-Identifier: GPL-3.0-or-later */
/*
- * source_date_epoch.h
+ * source_date_epoch.c
*
* Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at>
*/
-#include "config.h"
-#include "fstree.h"
+#include "internal.h"
#include <stdlib.h>
#include <stdio.h>
diff --git a/tests/Makemodule.am b/tests/Makemodule.am
index 2fb7654..ec4e4c5 100644
--- a/tests/Makemodule.am
+++ b/tests/Makemodule.am
@@ -37,6 +37,7 @@ test_get_path_SOURCES = tests/get_path.c
test_get_path_LDADD = libfstree.a libcompat.a
test_fstree_sort_SOURCES = tests/fstree_sort.c
+test_fstree_sort_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/lib/fstree
test_fstree_sort_LDADD = libfstree.a libcompat.a
test_fstree_from_file_SOURCES = tests/fstree_from_file.c
@@ -44,6 +45,7 @@ test_fstree_from_file_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(top_srcdir)/tests/f
test_fstree_from_file_LDADD = libfstree.a libcompat.a
test_fstree_init_SOURCES = tests/fstree_init.c
+test_fstree_init_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/lib/fstree
test_fstree_init_LDADD = libfstree.a libcompat.a
test_tar_gnu_SOURCES = tests/tar_gnu.c
diff --git a/tests/fstree_init.c b/tests/fstree_init.c
index 5958d49..3a526d1 100644
--- a/tests/fstree_init.c
+++ b/tests/fstree_init.c
@@ -7,6 +7,7 @@
#include "config.h"
#include "fstree.h"
+#include "internal.h"
#include <stdlib.h>
#include <string.h>
diff --git a/tests/fstree_sort.c b/tests/fstree_sort.c
index 86ef4e5..5557678 100644
--- a/tests/fstree_sort.c
+++ b/tests/fstree_sort.c
@@ -7,6 +7,7 @@
#include "config.h"
#include "fstree.h"
+#include "internal.h"
#include <stdlib.h>
#include <string.h>