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; enum fsmonitor_cookie_item_result result;
}; };
static int cookies_cmp(const void *data, const struct hashmap_entry *he1, static int cookies_cmp(const void *data UNUSED,
const struct hashmap_entry *he2, const void *keydata) const struct hashmap_entry *he1,
const struct hashmap_entry *he2, const void *keydata)
{ {
const struct fsmonitor_cookie_item *a = const struct fsmonitor_cookie_item *a =
container_of(he1, const struct fsmonitor_cookie_item, entry); container_of(he1, const struct fsmonitor_cookie_item, entry);
@ -1412,7 +1413,7 @@ done:
return err; 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 * 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 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(); enum ipc_active_state s = fsmonitor_ipc__get_state();

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

@ -4,21 +4,21 @@
#include "fsm-health.h" #include "fsm-health.h"
#include "fsmonitor--daemon.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; return 0;
} }
void fsm_health__dtor(struct fsmonitor_daemon_state *state) void fsm_health__dtor(struct fsmonitor_daemon_state *state UNUSED)
{ {
return; return;
} }
void fsm_health__loop(struct fsmonitor_daemon_state *state) void fsm_health__loop(struct fsmonitor_daemon_state *state UNUSED)
{ {
return; 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) { const char *fsmonitor_ipc__get_path(struct repository *r) {
static char *ret; static char *ret;
if (!ret) if (!ret)
ret = git_pathdup("fsmonitor--daemon.ipc"); ret = repo_git_path(r, "fsmonitor--daemon.ipc");
return ret; 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, void *ctx,
size_t num_of_events, size_t num_of_events,
void *event_paths, void *event_paths,
const FSEventStreamEventFlags event_flags[], const FSEventStreamEventFlags event_flags[],
const FSEventStreamEventId event_ids[]) const FSEventStreamEventId event_ids[] UNUSED)
{ {
struct fsmonitor_daemon_state *state = ctx; struct fsmonitor_daemon_state *state = ctx;
struct fsm_listen_data *data = state->listen_data; 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]); SetEvent(state->listen_data->hListener[LISTENER_SHUTDOWN]);
} }
static struct one_watch *create_watch(struct fsmonitor_daemon_state *state, static struct one_watch *create_watch(const char *path)
const char *path)
{ {
struct one_watch *watch = NULL; struct one_watch *watch = NULL;
DWORD desired_access = FILE_LIST_DIRECTORY; DWORD desired_access = FILE_LIST_DIRECTORY;
@ -361,8 +360,7 @@ static void destroy_watch(struct one_watch *watch)
free(watch); free(watch);
} }
static int start_rdcw_watch(struct fsm_listen_data *data, static int start_rdcw_watch(struct one_watch *watch)
struct one_watch *watch)
{ {
DWORD dwNotifyFilter = DWORD dwNotifyFilter =
FILE_NOTIFY_CHANGE_FILE_NAME | FILE_NOTIFY_CHANGE_FILE_NAME |
@ -735,11 +733,11 @@ void fsm_listen__loop(struct fsmonitor_daemon_state *state)
state->listen_error_code = 0; 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; goto force_error_stop;
if (data->watch_gitdir && if (data->watch_gitdir &&
start_rdcw_watch(data, data->watch_gitdir) == -1) start_rdcw_watch(data->watch_gitdir) == -1)
goto force_error_stop; goto force_error_stop;
for (;;) { for (;;) {
@ -755,7 +753,7 @@ void fsm_listen__loop(struct fsmonitor_daemon_state *state)
} }
if (result == -2) { if (result == -2) {
/* retryable error */ /* retryable error */
if (start_rdcw_watch(data, data->watch_worktree) == -1) if (start_rdcw_watch(data->watch_worktree) == -1)
goto force_error_stop; goto force_error_stop;
continue; continue;
} }
@ -763,7 +761,7 @@ void fsm_listen__loop(struct fsmonitor_daemon_state *state)
/* have data */ /* have data */
if (process_worktree_events(state) == LISTENER_SHUTDOWN) if (process_worktree_events(state) == LISTENER_SHUTDOWN)
goto force_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; goto force_error_stop;
continue; continue;
} }
@ -776,7 +774,7 @@ void fsm_listen__loop(struct fsmonitor_daemon_state *state)
} }
if (result == -2) { if (result == -2) {
/* retryable error */ /* retryable error */
if (start_rdcw_watch(data, data->watch_gitdir) == -1) if (start_rdcw_watch(data->watch_gitdir) == -1)
goto force_error_stop; goto force_error_stop;
continue; continue;
} }
@ -784,7 +782,7 @@ void fsm_listen__loop(struct fsmonitor_daemon_state *state)
/* have data */ /* have data */
if (process_gitdir_events(state) == LISTENER_SHUTDOWN) if (process_gitdir_events(state) == LISTENER_SHUTDOWN)
goto force_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; goto force_error_stop;
continue; continue;
} }
@ -821,16 +819,14 @@ int fsm_listen__ctor(struct fsmonitor_daemon_state *state)
data->hEventShutdown = CreateEvent(NULL, TRUE, FALSE, NULL); data->hEventShutdown = CreateEvent(NULL, TRUE, FALSE, NULL);
data->watch_worktree = create_watch(state, data->watch_worktree = create_watch(state->path_worktree_watch.buf);
state->path_worktree_watch.buf);
if (!data->watch_worktree) if (!data->watch_worktree)
goto failed; goto failed;
check_for_shortnames(data->watch_worktree); check_for_shortnames(data->watch_worktree);
if (state->nr_paths_watching > 1) { if (state->nr_paths_watching > 1) {
data->watch_gitdir = create_watch(state, data->watch_gitdir = create_watch(state->path_gitdir_watch.buf);
state->path_gitdir_watch.buf);
if (!data->watch_gitdir) if (!data->watch_gitdir)
goto failed; goto failed;
} }

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

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

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

@ -25,7 +25,7 @@ static enum fsmonitor_reason check_vfs4git(struct repository *r)
return FSMONITOR_REASON_OK; 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; enum fsmonitor_reason reason;

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

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

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

@ -62,7 +62,8 @@ static enum fsmonitor_reason check_remote(struct repository *r)
} }
#endif #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) { if (!r->worktree) {
/* /*

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

@ -278,7 +278,8 @@ static int daemon__run_server(void)
static start_bg_wait_cb bg_wait_cb; 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); int s = ipc_get_active_state(cl_args.path);