aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2022-07-04 20:01:59 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2022-07-08 19:17:35 +0200
commit3946cf086183f8dd4d5d115f52ba1b87560b7ce4 (patch)
tree2659b940b757d1bd177d00562bf8e41a333ef12e /lib
parent8c0aa2504199036eaaa09673ea93dcdcd79606ef (diff)
Move sqfs_tree_node_get_path to libsquashfs
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib')
-rw-r--r--lib/common/Makemodule.am2
-rw-r--r--lib/common/hardlink.c2
-rw-r--r--lib/sqfs/Makemodule.am1
-rw-r--r--lib/sqfs/dir_reader/get_path.c (renamed from lib/common/get_path.c)11
4 files changed, 7 insertions, 9 deletions
diff --git a/lib/common/Makemodule.am b/lib/common/Makemodule.am
index f0616fc..b19ecd6 100644
--- a/lib/common/Makemodule.am
+++ b/lib/common/Makemodule.am
@@ -2,7 +2,7 @@ libcommon_a_SOURCES = lib/common/hardlink.c
libcommon_a_SOURCES += lib/common/print_version.c lib/common/data_reader_dump.c
libcommon_a_SOURCES += lib/common/compress.c lib/common/comp_opt.c
libcommon_a_SOURCES += lib/common/data_writer.c include/common.h
-libcommon_a_SOURCES += lib/common/get_path.c lib/common/data_writer_ostream.c
+libcommon_a_SOURCES += lib/common/data_writer_ostream.c
libcommon_a_SOURCES += lib/common/perror.c lib/common/parse_size.c
libcommon_a_SOURCES += lib/common/print_size.c include/simple_writer.h
libcommon_a_SOURCES += include/compress_cli.h
diff --git a/lib/common/hardlink.c b/lib/common/hardlink.c
index c64ec4a..031724b 100644
--- a/lib/common/hardlink.c
+++ b/lib/common/hardlink.c
@@ -57,7 +57,7 @@ static int map_nodes(rbtree_t *inumtree, sqfs_hard_link_t **out,
lnk->next = (*out);
(*out) = lnk;
} else {
- free(lnk->target);
+ sqfs_free(lnk->target);
free(lnk);
}
return 0;
diff --git a/lib/sqfs/Makemodule.am b/lib/sqfs/Makemodule.am
index d49482e..ad3d42d 100644
--- a/lib/sqfs/Makemodule.am
+++ b/lib/sqfs/Makemodule.am
@@ -20,6 +20,7 @@ libsquashfs_la_SOURCES += lib/sqfs/read_table.c lib/sqfs/comp/compressor.c
libsquashfs_la_SOURCES += lib/sqfs/comp/internal.h
libsquashfs_la_SOURCES += lib/sqfs/dir_reader/dir_reader.c
libsquashfs_la_SOURCES += lib/sqfs/dir_reader/read_tree.c
+libsquashfs_la_SOURCES += lib/sqfs/dir_reader/get_path.c
libsquashfs_la_SOURCES += lib/sqfs/dir_reader/internal.h
libsquashfs_la_SOURCES += lib/sqfs/inode.c lib/sqfs/xattr/xattr_writer.c
libsquashfs_la_SOURCES += lib/sqfs/xattr/xattr_writer_flush.c
diff --git a/lib/common/get_path.c b/lib/sqfs/dir_reader/get_path.c
index 72ed1bd..bdd8317 100644
--- a/lib/common/get_path.c
+++ b/lib/sqfs/dir_reader/get_path.c
@@ -1,10 +1,11 @@
-/* SPDX-License-Identifier: GPL-3.0-or-later */
+/* SPDX-License-Identifier: LGPL-3.0-or-later */
/*
* get_path.c
*
* Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at>
*/
-#include "common.h"
+#define SQFS_BUILDING_DLL
+#include "internal.h"
#include <string.h>
#include <stdlib.h>
@@ -15,12 +16,8 @@ char *sqfs_tree_node_get_path(const sqfs_tree_node_t *node)
char *str, *ptr;
size_t len = 0;
- if (node->parent == NULL) {
- if (node->name[0] != '\0')
- return strdup((const char *)node->name);
-
+ if (node->parent == NULL)
return strdup("/");
- }
for (it = node; it != NULL && it->parent != NULL; it = it->parent) {
len += strlen((const char *)it->name) + 1;