{"thread":{"id":"45242","subject":"[PATCH 1/2] wrapper.c: remove unused git_mkstemp() function","startedAt":"2017-02-28T01:24:52Z","lastAt":"2017-02-28T13:13:02Z","messageCount":2,"participants":["Ramsay Jones","Jeff King"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"312813","messageId":"976c40d1-42dc-1fc5-45d5-05bdcf04d97e@ramsayjones.plus.com","threadId":"45242","inReplyTo":null,"subject":"[PATCH 1/2] wrapper.c: remove unused git_mkstemp() function","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsayjones.plus.com","sentAt":"2017-02-28T01:24:10Z","receivedAt":"2017-02-28T01:24:52Z","isPatch":true,"sender":{"key":"ramsay@ramsayjones.plus.com","avatar":"https://avatars.githubusercontent.com/u/33702710?v=4"},"body":"\nThe last caller of git_mkstemp() was removed in commit 6fec0a89\n(\"verify_signed_buffer: use tempfile object\", 16-06-2016). Since\nthe introduction of the 'tempfile' APIs, along with git_mkstemp_mode,\nit is unlikely that new callers will materialize. Remove the dead\ncode.\n\nSigned-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>\n---\n cache.h   |  3 ---\n wrapper.c | 17 -----------------\n 2 files changed, 20 deletions(-)\n\ndiff --git a/cache.h b/cache.h\nindex 61fc86e6d..a575684a9 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -1045,9 +1045,6 @@ static inline int is_empty_tree_oid(const struct object_id *oid)\n \treturn !hashcmp(oid->hash, EMPTY_TREE_SHA1_BIN);\n }\n \n-\n-int git_mkstemp(char *path, size_t n, const char *template);\n-\n /* set default permissions by passing mode arguments to open(2) */\n int git_mkstemps_mode(char *pattern, int suffix_len, int mode);\n int git_mkstemp_mode(char *pattern, int mode);\ndiff --git a/wrapper.c b/wrapper.c\nindex e7f197996..1a140639f 100644\n--- a/wrapper.c\n+++ b/wrapper.c\n@@ -440,23 +440,6 @@ int xmkstemp(char *template)\n \treturn fd;\n }\n \n-/* git_mkstemp() - create tmp file honoring TMPDIR variable */\n-int git_mkstemp(char *path, size_t len, const char *template)\n-{\n-\tconst char *tmp;\n-\tsize_t n;\n-\n-\ttmp = getenv(\"TMPDIR\");\n-\tif (!tmp)\n-\t\ttmp = \"/tmp\";\n-\tn = snprintf(path, len, \"%s/%s\", tmp, template);\n-\tif (len <= n) {\n-\t\terrno = ENAMETOOLONG;\n-\t\treturn -1;\n-\t}\n-\treturn mkstemp(path);\n-}\n-\n /* Adapted from libiberty's mkstemp.c. */\n \n #undef TMP_MAX\n-- \n2.12.0\n"},{"id":"312840","messageId":"20170228131255.ufpoexm55ovpwka3@sigill.intra.peff.net","threadId":"45242","inReplyTo":"976c40d1-42dc-1fc5-45d5-05bdcf04d97e@ramsayjones.plus.com","subject":"Re: [PATCH 1/2] wrapper.c: remove unused git_mkstemp() function","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2017-02-28T13:12:56Z","receivedAt":"2017-02-28T13:13:02Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Feb 28, 2017 at 01:24:10AM +0000, Ramsay Jones wrote:\n\n> The last caller of git_mkstemp() was removed in commit 6fec0a89\n> (\"verify_signed_buffer: use tempfile object\", 16-06-2016). Since\n> the introduction of the 'tempfile' APIs, along with git_mkstemp_mode,\n> it is unlikely that new callers will materialize. Remove the dead\n> code.\n\nYeah, I think the tempfile API is a better choice for anybody who wants\nto add a new call. Removing the temptation (and the dead code) is a good\nmove.\n\n-Peff\n"}]}