From 1fad07ce86fc2a506c59501d7fb7c7d7481525f6 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Mon, 7 Oct 2019 13:54:24 +0200 Subject: Rename libsqfshelper to libcommon That is IMO less confusing and express what it is (i.e. what it has become) more clearly, i.e. common code shared by the utilities. Signed-off-by: David Oberhollenzer --- lib/sqfshelper/get_path.c | 41 ----------------------------------------- 1 file changed, 41 deletions(-) delete mode 100644 lib/sqfshelper/get_path.c (limited to 'lib/sqfshelper/get_path.c') diff --git a/lib/sqfshelper/get_path.c b/lib/sqfshelper/get_path.c deleted file mode 100644 index bdc6c3f..0000000 --- a/lib/sqfshelper/get_path.c +++ /dev/null @@ -1,41 +0,0 @@ -/* SPDX-License-Identifier: GPL-3.0-or-later */ -/* - * get_path.c - * - * Copyright (C) 2019 David Oberhollenzer - */ -#include "common.h" - -#include -#include - -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) - 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; -} -- cgit v1.2.3