fsmonitor/win32: drop unused parameters
A few helper functions (centered around file-watch events) take extra fsmonitor state parameters that they don't use. These are static helpers local to the win32 implementation, and don't need to conform to any particular interface. We can just drop the extra parameters, which simplifies the code and silences -Wunused-parameter. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King committed
Sep 18, 2023 at 18:30 UTC
42e862c0b3127736040790a11a4f44a0dee69888
1 file changed
+10
-14
compat/fsmonitor/fsm-listen-win32.c
+10
-14
@@ -289,8 +289,7 @@ void fsm_listen__stop_async(struct fsmonitor_daemon_state *state)
289
SetEvent(state->listen_data->hListener[LISTENER_SHUTDOWN]);
290
}
291
292
-static struct one_watch *create_watch(struct fsmonitor_daemon_state *state,
293
- const char *path)
292
+static struct one_watch *create_watch(const char *path)
293
{
294
struct one_watch *watch = NULL;
295
DWORD desired_access = FILE_LIST_DIRECTORY;
@@ -361,8 +360,7 @@ static void destroy_watch(struct one_watch *watch)
360
free(watch);
361
}
362
364
-static int start_rdcw_watch(struct fsm_listen_data *data,
365
- struct one_watch *watch)
363
+static int start_rdcw_watch(struct one_watch *watch)
364
{
365
DWORD dwNotifyFilter =
366
FILE_NOTIFY_CHANGE_FILE_NAME |
@@ -735,11 +733,11 @@ void fsm_listen__loop(struct fsmonitor_daemon_state *state)
733
734
state->listen_error_code = 0;
735
738
- if (start_rdcw_watch(data, data->watch_worktree) == -1)
736
+ if (start_rdcw_watch(data->watch_worktree) == -1)
737
goto force_error_stop;
738
739
if (data->watch_gitdir &&
742
- start_rdcw_watch(data, data->watch_gitdir) == -1)
740
+ start_rdcw_watch(data->watch_gitdir) == -1)
741
goto force_error_stop;
742
743
for (;;) {
@@ -755,7 +753,7 @@ void fsm_listen__loop(struct fsmonitor_daemon_state *state)
753
}
754
if (result == -2) {
755
/* retryable error */
758
- if (start_rdcw_watch(data, data->watch_worktree) == -1)
756
+ if (start_rdcw_watch(data->watch_worktree) == -1)
757
goto force_error_stop;
758
continue;
759
}
@@ -763,7 +761,7 @@ void fsm_listen__loop(struct fsmonitor_daemon_state *state)
761
/* have data */
762
if (process_worktree_events(state) == LISTENER_SHUTDOWN)
763
goto force_shutdown;
766
- if (start_rdcw_watch(data, data->watch_worktree) == -1)
764
+ if (start_rdcw_watch(data->watch_worktree) == -1)
765
goto force_error_stop;
766
continue;
767
}
@@ -776,7 +774,7 @@ void fsm_listen__loop(struct fsmonitor_daemon_state *state)
774
}
775
if (result == -2) {
776
/* retryable error */
779
- if (start_rdcw_watch(data, data->watch_gitdir) == -1)
777
+ if (start_rdcw_watch(data->watch_gitdir) == -1)
778
goto force_error_stop;
779
continue;
780
}
@@ -784,7 +782,7 @@ void fsm_listen__loop(struct fsmonitor_daemon_state *state)
782
/* have data */
783
if (process_gitdir_events(state) == LISTENER_SHUTDOWN)
784
goto force_shutdown;
787
- if (start_rdcw_watch(data, data->watch_gitdir) == -1)
785
+ if (start_rdcw_watch(data->watch_gitdir) == -1)
786
goto force_error_stop;
787
continue;
788
}
@@ -821,16 +819,14 @@ int fsm_listen__ctor(struct fsmonitor_daemon_state *state)
819
820
data->hEventShutdown = CreateEvent(NULL, TRUE, FALSE, NULL);
821
824
- data->watch_worktree = create_watch(state,
825
- state->path_worktree_watch.buf);
822
+ data->watch_worktree = create_watch(state->path_worktree_watch.buf);
823
if (!data->watch_worktree)
824
goto failed;
825
826
check_for_shortnames(data->watch_worktree);
827
828
if (state->nr_paths_watching > 1) {
832
- data->watch_gitdir = create_watch(state,
833
- state->path_gitdir_watch.buf);
829
+ data->watch_gitdir = create_watch(state->path_gitdir_watch.buf);
830
if (!data->watch_gitdir)
831
goto failed;
832
}