diff options
author | Junio C Hamano <gitster@pobox.com> | 2020-08-17 17:02:44 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-08-17 17:02:44 -0700 |
commit | a01dadb9a94856ba098140417d99c3b7cd4a2cc9 (patch) | |
tree | 9f651f0a9032deecdb466580ba607da7589958ad | |
parent | Merge branch 'pd/mergetool-nvimdiff' (diff) | |
parent | compat-util: type-check parameters of no-op replacement functions (diff) | |
download | tgif-a01dadb9a94856ba098140417d99c3b7cd4a2cc9.tar.xz |
Merge branch 'jc/noop-with-static-inline'
A no-op replacement function implemented as a C preprocessor macro
does not perform as good a job as one implemented as a "static
inline" function in catching errors in parameters; replace the
former with the latter in <git-compat-util.h> header.
* jc/noop-with-static-inline:
compat-util: type-check parameters of no-op replacement functions
-rw-r--r-- | git-compat-util.h | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/git-compat-util.h b/git-compat-util.h index 5637114b8d..7a0fb7a045 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -252,8 +252,10 @@ typedef unsigned long uintptr_t; #ifdef PRECOMPOSE_UNICODE #include "compat/precompose_utf8.h" #else -#define precompose_str(in,i_nfd2nfc) -#define precompose_argv(c,v) +static inline void precompose_argv(int argc, const char **argv) +{ + ; /* nothing */ +} #define probe_utf8_pathname_composition() #endif @@ -270,7 +272,9 @@ struct itimerval { #endif #ifdef NO_SETITIMER -#define setitimer(which,value,ovalue) +static inline int setitimer(int which, const struct itimerval *value, struct itimerval *newvalue) { + ; /* nothing */ +} #endif #ifndef NO_LIBGEN_H @@ -1231,8 +1235,14 @@ int warn_on_fopen_errors(const char *path); #endif #ifndef _POSIX_THREAD_SAFE_FUNCTIONS -#define flockfile(fh) -#define funlockfile(fh) +static inline void flockfile(FILE *fh) +{ + ; /* nothing */ +} +static inline void funlockfile(FILE *fh) +{ + ; /* nothing */ +} #define getc_unlocked(fh) getc(fh) #endif |