Merge branch 'jk/fsmonitor-unused-parameter'

Unused parameters in fsmonitor related code paths have been marked
as such.

* jk/fsmonitor-unused-parameter:
  run-command: mark unused parameters in start_bg_wait callbacks
  fsmonitor: mark unused hashmap callback parameters
  fsmonitor/darwin: mark unused parameters in system callback
  fsmonitor: mark unused parameters in stub functions
  fsmonitor/win32: mark unused parameter in fsm_os__incompatible()
  fsmonitor: mark some maybe-unused parameters
  fsmonitor/win32: drop unused parameters
  fsmonitor: prefer repo_git_path() to git_pathdup()
This commit is contained in:
Junio C Hamano 2023-09-29 09:04:14 -07:00
Родитель 2b04c3ce59 72da9832c2
Коммит 2affeb3cb5
10 изменённых файлов: 37 добавлений и 36 удалений

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

@ -129,8 +129,9 @@ struct fsmonitor_cookie_item {
enum fsmonitor_cookie_item_result result;
};
static int cookies_cmp(const void *data, const struct hashmap_entry *he1,
const struct hashmap_entry *he2, const void *keydata)
static int cookies_cmp(const void *data UNUSED,
const struct hashmap_entry *he1,
const struct hashmap_entry *he2, const void *keydata)
{
const struct fsmonitor_cookie_item *a =
container_of(he1, const struct fsmonitor_cookie_item, entry);
@ -1412,7 +1413,7 @@ done:
return err;
}
static int try_to_run_foreground_daemon(int detach_console)
static int try_to_run_foreground_daemon(int detach_console MAYBE_UNUSED)
{
/*
* Technically, we don't need to probe for an existing daemon
@ -1442,7 +1443,8 @@ static int try_to_run_foreground_daemon(int detach_console)
static start_bg_wait_cb bg_wait_cb;
static int bg_wait_cb(const struct child_process *cp, void *cb_data)
static int bg_wait_cb(const struct child_process *cp UNUSED,
void *cb_data UNUSED)
{
enum ipc_active_state s = fsmonitor_ipc__get_state();

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

@ -4,21 +4,21 @@
#include "fsm-health.h"
#include "fsmonitor--daemon.h"
int fsm_health__ctor(struct fsmonitor_daemon_state *state)
int fsm_health__ctor(struct fsmonitor_daemon_state *state UNUSED)
{
return 0;
}
void fsm_health__dtor(struct fsmonitor_daemon_state *state)
void fsm_health__dtor(struct fsmonitor_daemon_state *state UNUSED)
{
return;
}
void fsm_health__loop(struct fsmonitor_daemon_state *state)
void fsm_health__loop(struct fsmonitor_daemon_state *state UNUSED)
{
return;
}
void fsm_health__stop_async(struct fsmonitor_daemon_state *state)
void fsm_health__stop_async(struct fsmonitor_daemon_state *state UNUSED)
{
}

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

@ -6,6 +6,6 @@
const char *fsmonitor_ipc__get_path(struct repository *r) {
static char *ret;
if (!ret)
ret = git_pathdup("fsmonitor--daemon.ipc");
ret = repo_git_path(r, "fsmonitor--daemon.ipc");
return ret;
}

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

@ -191,12 +191,12 @@ static void my_add_path(struct fsmonitor_batch *batch, const char *path)
}
static void fsevent_callback(ConstFSEventStreamRef streamRef,
static void fsevent_callback(ConstFSEventStreamRef streamRef UNUSED,
void *ctx,
size_t num_of_events,
void *event_paths,
const FSEventStreamEventFlags event_flags[],
const FSEventStreamEventId event_ids[])
const FSEventStreamEventId event_ids[] UNUSED)
{
struct fsmonitor_daemon_state *state = ctx;
struct fsm_listen_data *data = state->listen_data;

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

@ -289,8 +289,7 @@ void fsm_listen__stop_async(struct fsmonitor_daemon_state *state)
SetEvent(state->listen_data->hListener[LISTENER_SHUTDOWN]);
}
static struct one_watch *create_watch(struct fsmonitor_daemon_state *state,
const char *path)
static struct one_watch *create_watch(const char *path)
{
struct one_watch *watch = NULL;
DWORD desired_access = FILE_LIST_DIRECTORY;
@ -361,8 +360,7 @@ static void destroy_watch(struct one_watch *watch)
free(watch);
}
static int start_rdcw_watch(struct fsm_listen_data *data,
struct one_watch *watch)
static int start_rdcw_watch(struct one_watch *watch)
{
DWORD dwNotifyFilter =
FILE_NOTIFY_CHANGE_FILE_NAME |
@ -735,11 +733,11 @@ void fsm_listen__loop(struct fsmonitor_daemon_state *state)
state->listen_error_code = 0;
if (start_rdcw_watch(data, data->watch_worktree) == -1)
if (start_rdcw_watch(data->watch_worktree) == -1)
goto force_error_stop;
if (data->watch_gitdir &&
start_rdcw_watch(data, data->watch_gitdir) == -1)
start_rdcw_watch(data->watch_gitdir) == -1)
goto force_error_stop;
for (;;) {
@ -755,7 +753,7 @@ void fsm_listen__loop(struct fsmonitor_daemon_state *state)
}
if (result == -2) {
/* retryable error */
if (start_rdcw_watch(data, data->watch_worktree) == -1)
if (start_rdcw_watch(data->watch_worktree) == -1)
goto force_error_stop;
continue;
}
@ -763,7 +761,7 @@ void fsm_listen__loop(struct fsmonitor_daemon_state *state)
/* have data */
if (process_worktree_events(state) == LISTENER_SHUTDOWN)
goto force_shutdown;
if (start_rdcw_watch(data, data->watch_worktree) == -1)
if (start_rdcw_watch(data->watch_worktree) == -1)
goto force_error_stop;
continue;
}
@ -776,7 +774,7 @@ void fsm_listen__loop(struct fsmonitor_daemon_state *state)
}
if (result == -2) {
/* retryable error */
if (start_rdcw_watch(data, data->watch_gitdir) == -1)
if (start_rdcw_watch(data->watch_gitdir) == -1)
goto force_error_stop;
continue;
}
@ -784,7 +782,7 @@ void fsm_listen__loop(struct fsmonitor_daemon_state *state)
/* have data */
if (process_gitdir_events(state) == LISTENER_SHUTDOWN)
goto force_shutdown;
if (start_rdcw_watch(data, data->watch_gitdir) == -1)
if (start_rdcw_watch(data->watch_gitdir) == -1)
goto force_error_stop;
continue;
}
@ -821,16 +819,14 @@ int fsm_listen__ctor(struct fsmonitor_daemon_state *state)
data->hEventShutdown = CreateEvent(NULL, TRUE, FALSE, NULL);
data->watch_worktree = create_watch(state,
state->path_worktree_watch.buf);
data->watch_worktree = create_watch(state->path_worktree_watch.buf);
if (!data->watch_worktree)
goto failed;
check_for_shortnames(data->watch_worktree);
if (state->nr_paths_watching > 1) {
data->watch_gitdir = create_watch(state,
state->path_gitdir_watch.buf);
data->watch_gitdir = create_watch(state->path_gitdir_watch.buf);
if (!data->watch_gitdir)
goto failed;
}

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

@ -132,7 +132,8 @@ int fsmonitor__is_fs_remote(const char *path)
/*
* No-op for now.
*/
int fsmonitor__get_alias(const char *path, struct alias_info *info)
int fsmonitor__get_alias(const char *path UNUSED,
struct alias_info *info UNUSED)
{
return 0;
}
@ -140,8 +141,8 @@ int fsmonitor__get_alias(const char *path, struct alias_info *info)
/*
* No-op for now.
*/
char *fsmonitor__resolve_alias(const char *path,
const struct alias_info *info)
char *fsmonitor__resolve_alias(const char *path UNUSED,
const struct alias_info *info UNUSED)
{
return NULL;
}

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

@ -25,7 +25,7 @@ static enum fsmonitor_reason check_vfs4git(struct repository *r)
return FSMONITOR_REASON_OK;
}
enum fsmonitor_reason fsm_os__incompatible(struct repository *r, int ipc)
enum fsmonitor_reason fsm_os__incompatible(struct repository *r, int ipc UNUSED)
{
enum fsmonitor_reason reason;

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

@ -20,7 +20,7 @@ int fsmonitor_ipc__is_supported(void)
return 0;
}
const char *fsmonitor_ipc__get_path(struct repository *r)
const char *fsmonitor_ipc__get_path(struct repository *r UNUSED)
{
return NULL;
}
@ -30,14 +30,14 @@ enum ipc_active_state fsmonitor_ipc__get_state(void)
return IPC_STATE__OTHER_ERROR;
}
int fsmonitor_ipc__send_query(const char *since_token,
struct strbuf *answer)
int fsmonitor_ipc__send_query(const char *since_token UNUSED,
struct strbuf *answer UNUSED)
{
return -1;
}
int fsmonitor_ipc__send_command(const char *command,
struct strbuf *answer)
int fsmonitor_ipc__send_command(const char *command UNUSED,
struct strbuf *answer UNUSED)
{
return -1;
}

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

@ -62,7 +62,8 @@ static enum fsmonitor_reason check_remote(struct repository *r)
}
#endif
static enum fsmonitor_reason check_for_incompatible(struct repository *r, int ipc)
static enum fsmonitor_reason check_for_incompatible(struct repository *r,
int ipc MAYBE_UNUSED)
{
if (!r->worktree) {
/*

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

@ -278,7 +278,8 @@ static int daemon__run_server(void)
static start_bg_wait_cb bg_wait_cb;
static int bg_wait_cb(const struct child_process *cp, void *cb_data)
static int bg_wait_cb(const struct child_process *cp UNUSED,
void *cb_data UNUSED)
{
int s = ipc_get_active_state(cl_args.path);