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>
This commit is contained in:
Jeff King 2022-08-19 06:08:54 -04:00 коммит произвёл Junio C Hamano
Родитель e5e056b21d
Коммит 776515ef8b
1 изменённых файлов: 2 добавлений и 1 удалений

Просмотреть файл

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