Skip to content

Commit 776515e

Browse files
peffgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e5e056b commit 776515e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

git-compat-util.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,8 @@ static inline void extract_id_from_env(const char *env, uid_t *id)
498498
}
499499
}
500500

501-
static inline int is_path_owned_by_current_uid(const char *path, struct strbuf *report)
501+
static inline int is_path_owned_by_current_uid(const char *path,
502+
struct strbuf *UNUSED(report))
502503
{
503504
struct stat st;
504505
uid_t euid;

0 commit comments

Comments
 (0)