]> git.ipfire.org Git - thirdparty/git.git/commitdiff
path: remove mksnpath()
authorRené Scharfe <l.s.r@web.de>
Fri, 5 Apr 2024 10:56:48 +0000 (12:56 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 5 Apr 2024 16:49:38 +0000 (09:49 -0700)
Remove the function mksnpath(), which has become unused.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/vscode/init.sh
path.c
path.h

index 521d303722595719c79d0ed6a11612327c2d0972..f2d61bb0e6a7b70e7c1d9f13ab77681c3ffff639 100755 (executable)
@@ -92,7 +92,6 @@ cat >.vscode/settings.json.new <<\EOF ||
         "isexe",
         "iskeychar",
         "kompare",
-        "mksnpath",
         "mktag",
         "mktree",
         "mmblob",
diff --git a/path.c b/path.c
index 0fb527918b77652dbba2e6b0bee651fcc0fddfe9..9a62b6faaee935606f3a97c2bfb6dcd8c274de12 100644 (file)
--- a/path.c
+++ b/path.c
@@ -28,8 +28,6 @@ static int get_st_mode_bits(const char *path, int *mode)
        return 0;
 }
 
-static char bad_path[] = "/bad-path/";
-
 static struct strbuf *get_pathname(void)
 {
        static struct strbuf pathname_array[4] = {
@@ -59,21 +57,6 @@ static void strbuf_cleanup_path(struct strbuf *sb)
                strbuf_remove(sb, 0, path - sb->buf);
 }
 
-char *mksnpath(char *buf, size_t n, const char *fmt, ...)
-{
-       va_list args;
-       unsigned len;
-
-       va_start(args, fmt);
-       len = vsnprintf(buf, n, fmt, args);
-       va_end(args);
-       if (len >= n) {
-               strlcpy(buf, bad_path, n);
-               return buf;
-       }
-       return (char *)cleanup_path(buf);
-}
-
 static int dir_prefix(const char *buf, const char *dir)
 {
        int len = strlen(dir);
diff --git a/path.h b/path.h
index b3233c51fa0f1acdf87368db4a7d9c3f0955c964..54d39c770f9f764cc0792fb99d23f02a3bfe3693 100644 (file)
--- a/path.h
+++ b/path.h
@@ -23,12 +23,6 @@ const char *mkpath(const char *fmt, ...)
 char *mkpathdup(const char *fmt, ...)
        __attribute__((format (printf, 1, 2)));
 
-/*
- * Construct a path and place the result in the provided buffer `buf`.
- */
-char *mksnpath(char *buf, size_t n, const char *fmt, ...)
-       __attribute__((format (printf, 3, 4)));
-
 /*
  * The `git_common_path` family of functions will construct a path into a
  * repository's common git directory, which is shared by all worktrees.