From e08c10a42476357239b437689b01d984a16084d3 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 22 Aug 2022 12:39:46 +0200 Subject: path-util: drop the now unused dirname_malloc() --- src/basic/path-util.c | 27 --------------------------- src/basic/path-util.h | 1 - 2 files changed, 28 deletions(-) diff --git a/src/basic/path-util.c b/src/basic/path-util.c index 88657d5775..c5f30b5be4 100644 --- a/src/basic/path-util.c +++ b/src/basic/path-util.c @@ -7,12 +7,6 @@ #include #include -/* When we include libgen.h because we need dirname() we immediately - * undefine basename() since libgen.h defines it as a macro to the - * POSIX version which is really broken. We prefer GNU basename(). */ -#include -#undef basename - #include "alloc-util.h" #include "chase-symlinks.h" #include "extract-word.h" @@ -774,27 +768,6 @@ int fsck_exists(const char *fstype) { return executable_is_good(checker); } -char* dirname_malloc(const char *path) { - char *d, *dir, *dir2; - - assert(path); - - d = strdup(path); - if (!d) - return NULL; - - dir = dirname(d); - assert(dir); - - if (dir == d) - return d; - - dir2 = strdup(dir); - free(d); - - return dir2; -} - static const char *skip_slash_or_dot(const char *p) { for (; !isempty(p); p++) { if (*p == '/') diff --git a/src/basic/path-util.h b/src/basic/path-util.h index 757ed722d5..41bbc7bb86 100644 --- a/src/basic/path-util.h +++ b/src/basic/path-util.h @@ -151,7 +151,6 @@ int fsck_exists(const char *fstype); _ret; \ }) -char* dirname_malloc(const char *path); int path_find_first_component(const char **p, bool accept_dot_dot, const char **ret); int path_find_last_component(const char *path, bool accept_dot_dot, const char **next, const char **ret); const char *last_path_component(const char *path); -- cgit v1.2.1