Skip to contentSkip to conversation

Un-static gitmkstemps

PATCH In review Brian Gernhardt 2 participants 2 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Un-static gitmkstemps

It may not be used in most builds, but it's used via a #ifdef in git-compat-util.h Also, making it static makes a -Wall compile fail since it's not used in the file without NO_MKSTEMPS.

---

Either this, or it should be removed from git-compat-util and wrapped in an #ifdef. (The only current user is git_mkstemps), but since it's referenced in a header file, I figured it shouldn't be static.

 wrapper.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
wrapper.c +1 -1
index 390a7ae..1c41488 100644
@@ -310,7 +310,7 @@ int git_mkstemp_mode(char *pattern, int mode)
 	return git_mkstemps_mode(pattern, 0, mode);
 }
 
-static int gitmkstemps(char *pattern, int suffix_len)
+int gitmkstemps(char *pattern, int suffix_len)
 {
 	return git_mkstemps_mode(pattern, suffix_len, 0600);
 }
Signature · 1 line
1.7.7.rc0.309.g13ed2.dirty
#1 lore raw
Quoted 2 lines · Brian Gernhardt

It may not be used in most builds, but it's used via a #ifdef in git-compat-util.h ...

Hmm, do you mean "#define", not "#ifdef", specifically, this:

maint:git-compat-util.h:#define mkstemps gitmkstemps

Quoted 2 lines

... Also, making it static makes a -Wall compile fail since it's not used in the file without NO_MKSTEMPS.

Your alternative of not defining on builds without NO_MKSTEMPS is better, and probably even better yet, it would make sense to move the definition of git_mkstemps() out of wrapper.c and have it somewhere in compat/, just like the way in which compat/qsort.c defines git_qsort() that is used as a replacement for qsort() via #define on systems that lack it.