Skip to content

Commit fb90717

Browse files
committed
Merge branch 'rj/remove-unused-mktemp'
Code cleanup. * rj/remove-unused-mktemp: wrapper.c: remove unused gitmkstemps() function wrapper.c: remove unused git_mkstemp() function
2 parents 5886e75 + b2d593a commit fb90717

File tree

6 files changed

+0
-60
lines changed

6 files changed

+0
-60
lines changed

Makefile

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,6 @@ all::
102102
#
103103
# Define MKDIR_WO_TRAILING_SLASH if your mkdir() can't deal with trailing slash.
104104
#
105-
# Define NO_MKSTEMPS if you don't have mkstemps in the C library.
106-
#
107105
# Define NO_GECOS_IN_PWENT if you don't have pw_gecos in struct passwd
108106
# in the C library.
109107
#
@@ -1282,9 +1280,6 @@ ifdef MKDIR_WO_TRAILING_SLASH
12821280
COMPAT_CFLAGS += -DMKDIR_WO_TRAILING_SLASH
12831281
COMPAT_OBJS += compat/mkdir.o
12841282
endif
1285-
ifdef NO_MKSTEMPS
1286-
COMPAT_CFLAGS += -DNO_MKSTEMPS
1287-
endif
12881283
ifdef NO_UNSETENV
12891284
COMPAT_CFLAGS += -DNO_UNSETENV
12901285
COMPAT_OBJS += compat/unsetenv.o

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);

config.mak.uname

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ endif
2727
ifeq ($(uname_S),Linux)
2828
HAVE_ALLOCA_H = YesPlease
2929
NO_STRLCPY = YesPlease
30-
NO_MKSTEMPS = YesPlease
3130
HAVE_PATHS_H = YesPlease
3231
LIBC_CONTAINS_LIBINTL = YesPlease
3332
HAVE_DEV_TTY = YesPlease
@@ -41,7 +40,6 @@ endif
4140
ifeq ($(uname_S),GNU/kFreeBSD)
4241
HAVE_ALLOCA_H = YesPlease
4342
NO_STRLCPY = YesPlease
44-
NO_MKSTEMPS = YesPlease
4543
HAVE_PATHS_H = YesPlease
4644
DIR_HAS_BSD_GROUP_SEMANTICS = YesPlease
4745
LIBC_CONTAINS_LIBINTL = YesPlease
@@ -55,7 +53,6 @@ ifeq ($(uname_S),UnixWare)
5553
SHELL_PATH = /usr/local/bin/bash
5654
NO_IPV6 = YesPlease
5755
NO_HSTRERROR = YesPlease
58-
NO_MKSTEMPS = YesPlease
5956
BASIC_CFLAGS += -Kthread
6057
BASIC_CFLAGS += -I/usr/local/include
6158
BASIC_LDFLAGS += -L/usr/local/lib
@@ -79,7 +76,6 @@ ifeq ($(uname_S),SCO_SV)
7976
SHELL_PATH = /usr/bin/bash
8077
NO_IPV6 = YesPlease
8178
NO_HSTRERROR = YesPlease
82-
NO_MKSTEMPS = YesPlease
8379
BASIC_CFLAGS += -I/usr/local/include
8480
BASIC_LDFLAGS += -L/usr/local/lib
8581
NO_STRCASESTR = YesPlease
@@ -122,7 +118,6 @@ ifeq ($(uname_S),SunOS)
122118
NO_STRCASESTR = YesPlease
123119
NO_MEMMEM = YesPlease
124120
NO_MKDTEMP = YesPlease
125-
NO_MKSTEMPS = YesPlease
126121
NO_REGEX = YesPlease
127122
NO_MSGFMT_EXTENDED_OPTIONS = YesPlease
128123
HAVE_DEV_TTY = YesPlease
@@ -168,7 +163,6 @@ ifeq ($(uname_O),Cygwin)
168163
NO_D_TYPE_IN_DIRENT = YesPlease
169164
NO_STRCASESTR = YesPlease
170165
NO_MEMMEM = YesPlease
171-
NO_MKSTEMPS = YesPlease
172166
NO_SYMLINK_HEAD = YesPlease
173167
NO_IPV6 = YesPlease
174168
OLD_ICONV = UnfortunatelyYes
@@ -233,7 +227,6 @@ ifeq ($(uname_S),NetBSD)
233227
BASIC_CFLAGS += -I/usr/pkg/include
234228
BASIC_LDFLAGS += -L/usr/pkg/lib $(CC_LD_DYNPATH)/usr/pkg/lib
235229
USE_ST_TIMESPEC = YesPlease
236-
NO_MKSTEMPS = YesPlease
237230
HAVE_PATHS_H = YesPlease
238231
HAVE_BSD_SYSCTL = YesPlease
239232
endif
@@ -242,7 +235,6 @@ ifeq ($(uname_S),AIX)
242235
NO_STRCASESTR = YesPlease
243236
NO_MEMMEM = YesPlease
244237
NO_MKDTEMP = YesPlease
245-
NO_MKSTEMPS = YesPlease
246238
NO_STRLCPY = YesPlease
247239
NO_NSEC = YesPlease
248240
FREAD_READS_DIRECTORIES = UnfortunatelyYes
@@ -263,7 +255,6 @@ ifeq ($(uname_S),GNU)
263255
# GNU/Hurd
264256
HAVE_ALLOCA_H = YesPlease
265257
NO_STRLCPY = YesPlease
266-
NO_MKSTEMPS = YesPlease
267258
HAVE_PATHS_H = YesPlease
268259
LIBC_CONTAINS_LIBINTL = YesPlease
269260
endif
@@ -272,7 +263,6 @@ ifeq ($(uname_S),IRIX)
272263
NO_UNSETENV = YesPlease
273264
NO_STRCASESTR = YesPlease
274265
NO_MEMMEM = YesPlease
275-
NO_MKSTEMPS = YesPlease
276266
NO_MKDTEMP = YesPlease
277267
# When compiled with the MIPSpro 7.4.4m compiler, and without pthreads
278268
# (i.e. NO_PTHREADS is set), and _with_ MMAP (i.e. NO_MMAP is not set),
@@ -291,7 +281,6 @@ ifeq ($(uname_S),IRIX64)
291281
NO_UNSETENV = YesPlease
292282
NO_STRCASESTR = YesPlease
293283
NO_MEMMEM = YesPlease
294-
NO_MKSTEMPS = YesPlease
295284
NO_MKDTEMP = YesPlease
296285
# When compiled with the MIPSpro 7.4.4m compiler, and without pthreads
297286
# (i.e. NO_PTHREADS is set), and _with_ MMAP (i.e. NO_MMAP is not set),
@@ -311,7 +300,6 @@ ifeq ($(uname_S),HP-UX)
311300
NO_SETENV = YesPlease
312301
NO_STRCASESTR = YesPlease
313302
NO_MEMMEM = YesPlease
314-
NO_MKSTEMPS = YesPlease
315303
NO_STRLCPY = YesPlease
316304
NO_MKDTEMP = YesPlease
317305
NO_UNSETENV = YesPlease
@@ -352,7 +340,6 @@ ifeq ($(uname_S),Windows)
352340
NO_ICONV = YesPlease
353341
NO_STRTOUMAX = YesPlease
354342
NO_MKDTEMP = YesPlease
355-
NO_MKSTEMPS = YesPlease
356343
SNPRINTF_RETURNS_BOGUS = YesPlease
357344
NO_SVN_TESTS = YesPlease
358345
RUNTIME_PREFIX = YesPlease
@@ -402,7 +389,6 @@ ifeq ($(uname_S),Interix)
402389
NO_MKDTEMP = YesPlease
403390
NO_STRTOUMAX = YesPlease
404391
NO_NSEC = YesPlease
405-
NO_MKSTEMPS = YesPlease
406392
ifeq ($(uname_R),3.5)
407393
NO_INET_NTOP = YesPlease
408394
NO_INET_PTON = YesPlease
@@ -461,7 +447,6 @@ ifeq ($(uname_S),NONSTOP_KERNEL)
461447
NO_SETENV = YesPlease
462448
NO_UNSETENV = YesPlease
463449
NO_MKDTEMP = YesPlease
464-
NO_MKSTEMPS = YesPlease
465450
# Currently libiconv-1.9.1.
466451
OLD_ICONV = UnfortunatelyYes
467452
NO_REGEX = YesPlease
@@ -503,7 +488,6 @@ ifneq (,$(findstring MINGW,$(uname_S)))
503488
NEEDS_LIBICONV = YesPlease
504489
NO_STRTOUMAX = YesPlease
505490
NO_MKDTEMP = YesPlease
506-
NO_MKSTEMPS = YesPlease
507491
NO_SVN_TESTS = YesPlease
508492
NO_PERL_MAKEMAKER = YesPlease
509493
RUNTIME_PREFIX = YesPlease
@@ -584,7 +568,6 @@ ifeq ($(uname_S),QNX)
584568
NO_ICONV = YesPlease
585569
NO_MEMMEM = YesPlease
586570
NO_MKDTEMP = YesPlease
587-
NO_MKSTEMPS = YesPlease
588571
NO_NSEC = YesPlease
589572
NO_PTHREADS = YesPlease
590573
NO_R_TO_GCC_LINKER = YesPlease

configure.ac

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,12 +1050,6 @@ GIT_CHECK_FUNC(mkdtemp,
10501050
[NO_MKDTEMP=YesPlease])
10511051
GIT_CONF_SUBST([NO_MKDTEMP])
10521052
#
1053-
# Define NO_MKSTEMPS if you don't have mkstemps in the C library.
1054-
GIT_CHECK_FUNC(mkstemps,
1055-
[NO_MKSTEMPS=],
1056-
[NO_MKSTEMPS=YesPlease])
1057-
GIT_CONF_SUBST([NO_MKSTEMPS])
1058-
#
10591053
# Define NO_INITGROUPS if you don't have initgroups in the C library.
10601054
GIT_CHECK_FUNC(initgroups,
10611055
[NO_INITGROUPS=],

git-compat-util.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -639,11 +639,6 @@ extern int gitsetenv(const char *, const char *, int);
639639
extern char *gitmkdtemp(char *);
640640
#endif
641641

642-
#ifdef NO_MKSTEMPS
643-
#define mkstemps gitmkstemps
644-
extern int gitmkstemps(char *, int);
645-
#endif
646-
647642
#ifdef NO_UNSETENV
648643
#define unsetenv gitunsetenv
649644
extern void gitunsetenv(const char *);

wrapper.c

Lines changed: 0 additions & 24 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
@@ -531,13 +514,6 @@ int git_mkstemp_mode(char *pattern, int mode)
531514
return git_mkstemps_mode(pattern, 0, mode);
532515
}
533516

534-
#ifdef NO_MKSTEMPS
535-
int gitmkstemps(char *pattern, int suffix_len)
536-
{
537-
return git_mkstemps_mode(pattern, suffix_len, 0600);
538-
}
539-
#endif
540-
541517
int xmkstemp_mode(char *template, int mode)
542518
{
543519
int fd;

0 commit comments

Comments
 (0)