Skip to content

Commit efcc48e

Browse files
committed
Merge branch 'jk/avoid-redef-system-functions-2.30'
Redefining system functions for a few functions did not follow our usual "implement git_foo() and #define foo(args) git_foo(args)" pattern, which has broken build for some folks. * jk/avoid-redef-system-functions-2.30: git-compat-util: undefine system names before redeclaring them git-compat-util: avoid redefining system function names
2 parents 3c0a988 + e1a95b7 commit efcc48e

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

git-compat-util.h

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -341,11 +341,13 @@ struct itimerval {
341341
#endif
342342

343343
#ifdef NO_SETITIMER
344-
static inline int setitimer(int which UNUSED,
345-
const struct itimerval *value UNUSED,
346-
struct itimerval *newvalue UNUSED) {
344+
static inline int git_setitimer(int which UNUSED,
345+
const struct itimerval *value UNUSED,
346+
struct itimerval *newvalue UNUSED) {
347347
return 0; /* pretend success */
348348
}
349+
#undef setitimer
350+
#define setitimer(which,value,ovalue) git_setitimer(which,value,ovalue)
349351
#endif
350352

351353
#ifndef NO_LIBGEN_H
@@ -1471,14 +1473,19 @@ int open_nofollow(const char *path, int flags);
14711473
#endif
14721474

14731475
#ifndef _POSIX_THREAD_SAFE_FUNCTIONS
1474-
static inline void flockfile(FILE *fh UNUSED)
1476+
static inline void git_flockfile(FILE *fh UNUSED)
14751477
{
14761478
; /* nothing */
14771479
}
1478-
static inline void funlockfile(FILE *fh UNUSED)
1480+
static inline void git_funlockfile(FILE *fh UNUSED)
14791481
{
14801482
; /* nothing */
14811483
}
1484+
#undef flockfile
1485+
#undef funlockfile
1486+
#undef getc_unlocked
1487+
#define flockfile(fh) git_flockfile(fh)
1488+
#define funlockfile(fh) git_funlockfile(fh)
14821489
#define getc_unlocked(fh) getc(fh)
14831490
#endif
14841491

0 commit comments

Comments
 (0)