Commit 41ad2652808e8c045a2a82b97bb309e35fde2887

Stefan Sperling 2020-12-04T20:27:43

remove unused function got_path_get_absolute(); realpath(3) is usually better

diff --git a/include/got_path.h b/include/got_path.h
index 0219d3d..f2d6ba2 100644
--- a/include/got_path.h
+++ b/include/got_path.h
@@ -27,12 +27,6 @@ struct dirent;
 int got_path_is_absolute(const char *);
 
 /*
- * Return an absolute version of a relative path.
- * The result is allocated with malloc(3).
- */
-char *got_path_get_absolute(const char *);
-
-/*
  * Canonicalize absolute paths by removing redundant path separators
  * and resolving references to parent directories ("/../").
  * Relative paths are copied from input to buf as-is.
diff --git a/lib/path.c b/lib/path.c
index 54f8f6f..d94d085 100644
--- a/lib/path.c
+++ b/lib/path.c
@@ -43,21 +43,6 @@ got_path_is_absolute(const char *path)
 	return path[0] == '/';
 }
 
-char *
-got_path_get_absolute(const char *relpath) 
-{
-	char cwd[PATH_MAX];
-	char *abspath;
-
-	if (getcwd(cwd, sizeof(cwd)) == NULL)
-		return NULL;
-
-	if (asprintf(&abspath, "%s/%s/", cwd, relpath) == -1)
-		return NULL;
-
-	return abspath;
-}
-
 /* based on canonpath() from kern_pledge.c */
 const struct got_error *
 got_canonpath(const char *input, char *buf, size_t bufsize)