path-util: drop the now unused dirname_malloc()
This commit is contained in:
@@ -7,12 +7,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
/* 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 <libgen.h>
|
||||
#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 == '/')
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user