Skip to content

Commit 34de5e4

Browse files
ramsay-jonesgitster
authored andcommitted
wrapper.c: remove unused git_mkstemp() function
The last caller of git_mkstemp() was removed in commit 6fec0a8 ("verify_signed_buffer: use tempfile object", 16-06-2016). Since the introduction of the 'tempfile' APIs, along with git_mkstemp_mode, it is unlikely that new callers will materialize. Remove the dead code. Signed-off-by: Ramsay Jones <[email protected]> Reviewed-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e7e07d5 commit 34de5e4

File tree

2 files changed

+0
-20
lines changed

2 files changed

+0
-20
lines changed

cache.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,9 +1045,6 @@ static inline int is_empty_tree_oid(const struct object_id *oid)
10451045
return !hashcmp(oid->hash, EMPTY_TREE_SHA1_BIN);
10461046
}
10471047

1048-
1049-
int git_mkstemp(char *path, size_t n, const char *template);
1050-
10511048
/* set default permissions by passing mode arguments to open(2) */
10521049
int git_mkstemps_mode(char *pattern, int suffix_len, int mode);
10531050
int git_mkstemp_mode(char *pattern, int mode);

wrapper.c

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -440,23 +440,6 @@ int xmkstemp(char *template)
440440
return fd;
441441
}
442442

443-
/* git_mkstemp() - create tmp file honoring TMPDIR variable */
444-
int git_mkstemp(char *path, size_t len, const char *template)
445-
{
446-
const char *tmp;
447-
size_t n;
448-
449-
tmp = getenv("TMPDIR");
450-
if (!tmp)
451-
tmp = "/tmp";
452-
n = snprintf(path, len, "%s/%s", tmp, template);
453-
if (len <= n) {
454-
errno = ENAMETOOLONG;
455-
return -1;
456-
}
457-
return mkstemp(path);
458-
}
459-
460443
/* Adapted from libiberty's mkstemp.c. */
461444

462445
#undef TMP_MAX

0 commit comments

Comments
 (0)