path: remove mksnpath()

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>

René Scharfe committed Apr 5, 2024 at 12:56 UTC 708f7e05907ba7d4acd08bf87f51474471a16f43
3 files changed -24
contrib/vscode/init.sh
-1
@@ -92,7 +92,6 @@ cat >.vscode/settings.json.new <<\EOF ||
92 "isexe",
93 "iskeychar",
94 "kompare",
95 - "mksnpath",
95 "mktag",
96 "mktree",
97 "mmblob",
path.c
-17
@@ -28,8 +28,6 @@ static int get_st_mode_bits(const char *path, int *mode)
28 return 0;
29 }
30
31 -static char bad_path[] = "/bad-path/";
32 -
31 static struct strbuf *get_pathname(void)
32 {
33 static struct strbuf pathname_array[4] = {
@@ -59,21 +57,6 @@ static void strbuf_cleanup_path(struct strbuf *sb)
57 strbuf_remove(sb, 0, path - sb->buf);
58 }
59
62 -char *mksnpath(char *buf, size_t n, const char *fmt, ...)
63 -{
64 - va_list args;
65 - unsigned len;
66 -
67 - va_start(args, fmt);
68 - len = vsnprintf(buf, n, fmt, args);
69 - va_end(args);
70 - if (len >= n) {
71 - strlcpy(buf, bad_path, n);
72 - return buf;
73 - }
74 - return (char *)cleanup_path(buf);
75 -}
76 -
60 static int dir_prefix(const char *buf, const char *dir)
61 {
62 int len = strlen(dir);
path.h
-6
@@ -23,12 +23,6 @@ const char *mkpath(const char *fmt, ...)
23 char *mkpathdup(const char *fmt, ...)
24 __attribute__((format (printf, 1, 2)));
25
26 -/*
27 - * Construct a path and place the result in the provided buffer `buf`.
28 - */
29 -char *mksnpath(char *buf, size_t n, const char *fmt, ...)
30 - __attribute__((format (printf, 3, 4)));
31 -
26 /*
27 * The `git_common_path` family of functions will construct a path into a
28 * repository's common git directory, which is shared by all worktrees.