summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorHiltjo Posthuma <hiltjo@codemadness.org>2016-04-10 14:36:16 +0200
committerHiltjo Posthuma <hiltjo@codemadness.org>2016-04-10 14:36:16 +0200
commit8a3177f96dd4c3694242d0686762c455a9d010fd (patch)
treedc33f65dbb40abd8b9fae22833d52998b985bfad /util.c
parentfe6bc99b1ed59c428ffe5da44eafcf3712d3d80d (diff)
remove basename, just use last part of the path...
... as a bonus it also saves an allocation.
Diffstat (limited to 'util.c')
-rw-r--r--util.c21
1 files changed, 0 insertions, 21 deletions
diff --git a/util.c b/util.c
index c525def..27422a3 100644
--- a/util.c
+++ b/util.c
@@ -3,7 +3,6 @@
#include <ctype.h>
#include <err.h>
#include <errno.h>
-#include <libgen.h>
#include <limits.h>
#include <stdarg.h>
#include <stdio.h>
@@ -249,26 +248,6 @@ xmlencode(const char *s, FILE *fp)
}
}
-/* Some implementations of basename(3) return a pointer to a static
- * internal buffer (OpenBSD). Others modify the contents of `path` (POSIX).
- * This is a wrapper function that is compatible with both versions.
- * The program will error out if basename(3) failed, this can only happen
- * with the OpenBSD version. */
-char *
-xbasename(const char *path)
-{
- char *p, *b;
-
- if (!(p = strdup(path)))
- err(1, "strdup");
- if (!(b = basename(p)))
- err(1, "basename");
- if (!(b = strdup(b)))
- err(1, "strdup");
- free(p);
- return b;
-}
-
/* print `len' columns of characters. If string is shorter pad the rest
* with characters `pad`. */
void