aboutsummaryrefslogtreecommitdiffstats
path: root/git-compat-util.h
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2022-08-19 06:08:54 -0400
committerJunio C Hamano <gitster@pobox.com>2022-08-19 12:18:56 -0700
commit776515ef8b381d49caeccfe2e8da98cb666e257a (patch)
tree38b39abaa4242240ff41b66c7f64fef2a25e6244 /git-compat-util.h
parente5e056b21dc5c128b5349ac336c6315943e88dee (diff)
downloadgit-776515ef8b381d49caeccfe2e8da98cb666e257a.tar.gz
is_path_owned_by_current_uid(): mark "report" parameter as unused
In the non-Windows version of this function, we never have any errors to report, and thus the "report" parameter is unused. But we can't drop it, because we have to maintain function call compatibility with the version in compat/mingw.h, which does use this parameter. Note that there's an extra level of indirection here; the common function is actually is_path_owned_by_current_user, which is a macro pointing to "by_current_uid" or "by_current_sid", depending on the platform. So an alternative here is to eat the unused parameter in the macro, since -Wunused-parameter doesn't complain about macros. But I think the UNUSED() annotation is less obfuscated for somebody reading the code later. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-compat-util.h')
-rw-r--r--git-compat-util.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/git-compat-util.h b/git-compat-util.h
index 12239fedf7..a9690126bb 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -498,7 +498,8 @@ static inline void extract_id_from_env(const char *env, uid_t *id)
}
}
-static inline int is_path_owned_by_current_uid(const char *path, struct strbuf *report)
+static inline int is_path_owned_by_current_uid(const char *path,
+ struct strbuf *UNUSED(report))
{
struct stat st;
uid_t euid;