diff options
Diffstat (limited to 'lib/common')
-rw-r--r-- | lib/common/Makemodule.am | 2 | ||||
-rw-r--r-- | lib/common/get_path.c | 45 | ||||
-rw-r--r-- | lib/common/hardlink.c | 2 |
3 files changed, 2 insertions, 47 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/get_path.c b/lib/common/get_path.c deleted file mode 100644 index 72ed1bd..0000000 --- a/lib/common/get_path.c +++ /dev/null @@ -1,45 +0,0 @@ -/* SPDX-License-Identifier: GPL-3.0-or-later */ -/* - * get_path.c - * - * Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at> - */ -#include "common.h" - -#include <string.h> -#include <stdlib.h> - -char *sqfs_tree_node_get_path(const sqfs_tree_node_t *node) -{ - const sqfs_tree_node_t *it; - char *str, *ptr; - size_t len = 0; - - if (node->parent == NULL) { - if (node->name[0] != '\0') - return strdup((const char *)node->name); - - return strdup("/"); - } - - for (it = node; it != NULL && it->parent != NULL; it = it->parent) { - len += strlen((const char *)it->name) + 1; - } - - str = malloc(len + 1); - if (str == NULL) - return NULL; - - ptr = str + len; - *ptr = '\0'; - - for (it = node; it != NULL && it->parent != NULL; it = it->parent) { - len = strlen((const char *)it->name); - ptr -= len; - - memcpy(ptr, (const char *)it->name, len); - *(--ptr) = '/'; - } - - return str; -} 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; |