Skip to content

Commit 2affeb3

Browse files
committed
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()
2 parents 2b04c3c + 72da983 commit 2affeb3

File tree

10 files changed

+37
-36
lines changed

10 files changed

+37
-36
lines changed

builtin/fsmonitor--daemon.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,9 @@ struct fsmonitor_cookie_item {
129129
enum fsmonitor_cookie_item_result result;
130130
};
131131

132-
static int cookies_cmp(const void *data, const struct hashmap_entry *he1,
133-
const struct hashmap_entry *he2, const void *keydata)
132+
static int cookies_cmp(const void *data UNUSED,
133+
const struct hashmap_entry *he1,
134+
const struct hashmap_entry *he2, const void *keydata)
134135
{
135136
const struct fsmonitor_cookie_item *a =
136137
container_of(he1, const struct fsmonitor_cookie_item, entry);
@@ -1412,7 +1413,7 @@ static int fsmonitor_run_daemon(void)
14121413
return err;
14131414
}
14141415

1415-
static int try_to_run_foreground_daemon(int detach_console)
1416+
static int try_to_run_foreground_daemon(int detach_console MAYBE_UNUSED)
14161417
{
14171418
/*
14181419
* 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)
14421443

14431444
static start_bg_wait_cb bg_wait_cb;
14441445

1445-
static int bg_wait_cb(const struct child_process *cp, void *cb_data)
1446+
static int bg_wait_cb(const struct child_process *cp UNUSED,
1447+
void *cb_data UNUSED)
14461448
{
14471449
enum ipc_active_state s = fsmonitor_ipc__get_state();
14481450

compat/fsmonitor/fsm-health-darwin.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@
44
#include "fsm-health.h"
55
#include "fsmonitor--daemon.h"
66

7-
int fsm_health__ctor(struct fsmonitor_daemon_state *state)
7+
int fsm_health__ctor(struct fsmonitor_daemon_state *state UNUSED)
88
{
99
return 0;
1010
}
1111

12-
void fsm_health__dtor(struct fsmonitor_daemon_state *state)
12+
void fsm_health__dtor(struct fsmonitor_daemon_state *state UNUSED)
1313
{
1414
return;
1515
}
1616

17-
void fsm_health__loop(struct fsmonitor_daemon_state *state)
17+
void fsm_health__loop(struct fsmonitor_daemon_state *state UNUSED)
1818
{
1919
return;
2020
}
2121

22-
void fsm_health__stop_async(struct fsmonitor_daemon_state *state)
22+
void fsm_health__stop_async(struct fsmonitor_daemon_state *state UNUSED)
2323
{
2424
}

compat/fsmonitor/fsm-ipc-win32.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
const char *fsmonitor_ipc__get_path(struct repository *r) {
77
static char *ret;
88
if (!ret)
9-
ret = git_pathdup("fsmonitor--daemon.ipc");
9+
ret = repo_git_path(r, "fsmonitor--daemon.ipc");
1010
return ret;
1111
}

compat/fsmonitor/fsm-listen-darwin.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,12 +191,12 @@ static void my_add_path(struct fsmonitor_batch *batch, const char *path)
191191
}
192192

193193

194-
static void fsevent_callback(ConstFSEventStreamRef streamRef,
194+
static void fsevent_callback(ConstFSEventStreamRef streamRef UNUSED,
195195
void *ctx,
196196
size_t num_of_events,
197197
void *event_paths,
198198
const FSEventStreamEventFlags event_flags[],
199-
const FSEventStreamEventId event_ids[])
199+
const FSEventStreamEventId event_ids[] UNUSED)
200200
{
201201
struct fsmonitor_daemon_state *state = ctx;
202202
struct fsm_listen_data *data = state->listen_data;

compat/fsmonitor/fsm-listen-win32.c

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -289,8 +289,7 @@ void fsm_listen__stop_async(struct fsmonitor_daemon_state *state)
289289
SetEvent(state->listen_data->hListener[LISTENER_SHUTDOWN]);
290290
}
291291

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)
294293
{
295294
struct one_watch *watch = NULL;
296295
DWORD desired_access = FILE_LIST_DIRECTORY;
@@ -361,8 +360,7 @@ static void destroy_watch(struct one_watch *watch)
361360
free(watch);
362361
}
363362

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)
366364
{
367365
DWORD dwNotifyFilter =
368366
FILE_NOTIFY_CHANGE_FILE_NAME |
@@ -735,11 +733,11 @@ void fsm_listen__loop(struct fsmonitor_daemon_state *state)
735733

736734
state->listen_error_code = 0;
737735

738-
if (start_rdcw_watch(data, data->watch_worktree) == -1)
736+
if (start_rdcw_watch(data->watch_worktree) == -1)
739737
goto force_error_stop;
740738

741739
if (data->watch_gitdir &&
742-
start_rdcw_watch(data, data->watch_gitdir) == -1)
740+
start_rdcw_watch(data->watch_gitdir) == -1)
743741
goto force_error_stop;
744742

745743
for (;;) {
@@ -755,15 +753,15 @@ void fsm_listen__loop(struct fsmonitor_daemon_state *state)
755753
}
756754
if (result == -2) {
757755
/* retryable error */
758-
if (start_rdcw_watch(data, data->watch_worktree) == -1)
756+
if (start_rdcw_watch(data->watch_worktree) == -1)
759757
goto force_error_stop;
760758
continue;
761759
}
762760

763761
/* have data */
764762
if (process_worktree_events(state) == LISTENER_SHUTDOWN)
765763
goto force_shutdown;
766-
if (start_rdcw_watch(data, data->watch_worktree) == -1)
764+
if (start_rdcw_watch(data->watch_worktree) == -1)
767765
goto force_error_stop;
768766
continue;
769767
}
@@ -776,15 +774,15 @@ void fsm_listen__loop(struct fsmonitor_daemon_state *state)
776774
}
777775
if (result == -2) {
778776
/* retryable error */
779-
if (start_rdcw_watch(data, data->watch_gitdir) == -1)
777+
if (start_rdcw_watch(data->watch_gitdir) == -1)
780778
goto force_error_stop;
781779
continue;
782780
}
783781

784782
/* have data */
785783
if (process_gitdir_events(state) == LISTENER_SHUTDOWN)
786784
goto force_shutdown;
787-
if (start_rdcw_watch(data, data->watch_gitdir) == -1)
785+
if (start_rdcw_watch(data->watch_gitdir) == -1)
788786
goto force_error_stop;
789787
continue;
790788
}
@@ -821,16 +819,14 @@ int fsm_listen__ctor(struct fsmonitor_daemon_state *state)
821819

822820
data->hEventShutdown = CreateEvent(NULL, TRUE, FALSE, NULL);
823821

824-
data->watch_worktree = create_watch(state,
825-
state->path_worktree_watch.buf);
822+
data->watch_worktree = create_watch(state->path_worktree_watch.buf);
826823
if (!data->watch_worktree)
827824
goto failed;
828825

829826
check_for_shortnames(data->watch_worktree);
830827

831828
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);
834830
if (!data->watch_gitdir)
835831
goto failed;
836832
}

compat/fsmonitor/fsm-path-utils-win32.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,16 +132,17 @@ int fsmonitor__is_fs_remote(const char *path)
132132
/*
133133
* No-op for now.
134134
*/
135-
int fsmonitor__get_alias(const char *path, struct alias_info *info)
135+
int fsmonitor__get_alias(const char *path UNUSED,
136+
struct alias_info *info UNUSED)
136137
{
137138
return 0;
138139
}
139140

140141
/*
141142
* No-op for now.
142143
*/
143-
char *fsmonitor__resolve_alias(const char *path,
144-
const struct alias_info *info)
144+
char *fsmonitor__resolve_alias(const char *path UNUSED,
145+
const struct alias_info *info UNUSED)
145146
{
146147
return NULL;
147148
}

compat/fsmonitor/fsm-settings-win32.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ static enum fsmonitor_reason check_vfs4git(struct repository *r)
2525
return FSMONITOR_REASON_OK;
2626
}
2727

28-
enum fsmonitor_reason fsm_os__incompatible(struct repository *r, int ipc)
28+
enum fsmonitor_reason fsm_os__incompatible(struct repository *r, int ipc UNUSED)
2929
{
3030
enum fsmonitor_reason reason;
3131

fsmonitor-ipc.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ int fsmonitor_ipc__is_supported(void)
2020
return 0;
2121
}
2222

23-
const char *fsmonitor_ipc__get_path(struct repository *r)
23+
const char *fsmonitor_ipc__get_path(struct repository *r UNUSED)
2424
{
2525
return NULL;
2626
}
@@ -30,14 +30,14 @@ enum ipc_active_state fsmonitor_ipc__get_state(void)
3030
return IPC_STATE__OTHER_ERROR;
3131
}
3232

33-
int fsmonitor_ipc__send_query(const char *since_token,
34-
struct strbuf *answer)
33+
int fsmonitor_ipc__send_query(const char *since_token UNUSED,
34+
struct strbuf *answer UNUSED)
3535
{
3636
return -1;
3737
}
3838

39-
int fsmonitor_ipc__send_command(const char *command,
40-
struct strbuf *answer)
39+
int fsmonitor_ipc__send_command(const char *command UNUSED,
40+
struct strbuf *answer UNUSED)
4141
{
4242
return -1;
4343
}

fsmonitor-settings.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ static enum fsmonitor_reason check_remote(struct repository *r)
6262
}
6363
#endif
6464

65-
static enum fsmonitor_reason check_for_incompatible(struct repository *r, int ipc)
65+
static enum fsmonitor_reason check_for_incompatible(struct repository *r,
66+
int ipc MAYBE_UNUSED)
6667
{
6768
if (!r->worktree) {
6869
/*

t/helper/test-simple-ipc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,8 @@ static int daemon__run_server(void)
278278

279279
static start_bg_wait_cb bg_wait_cb;
280280

281-
static int bg_wait_cb(const struct child_process *cp, void *cb_data)
281+
static int bg_wait_cb(const struct child_process *cp UNUSED,
282+
void *cb_data UNUSED)
282283
{
283284
int s = ipc_get_active_state(cl_args.path);
284285

0 commit comments

Comments
 (0)