Skip to content

Commit 72da983

Browse files
peffgitster
authored andcommitted
run-command: mark unused parameters in start_bg_wait callbacks
The start_bg_command() function takes a callback to tell when the background-ed process is "ready". The callback receives the child_process struct as well as an extra void pointer. But curiously, neither of the two users of this interface look at either parameter! This makes some sense. The only non-test user of the API is fsmonitor, which uses fsmonitor_ipc__get_state() to connect to a single global fsmonitor daemon (i.e., the one we just started!). So we could just drop these parameters entirely. But it seems like a pretty reasonable interface for the "wait" callback to have access to the details of the spawned process, and to have room for passing extra data through a void pointer. So let's leave these in place but mark the unused ones so that -Wunused-parameter does not complain. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 1fe4194 commit 72da983

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

builtin/fsmonitor--daemon.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1443,7 +1443,8 @@ static int try_to_run_foreground_daemon(int detach_console MAYBE_UNUSED)
14431443

14441444
static start_bg_wait_cb bg_wait_cb;
14451445

1446-
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)
14471448
{
14481449
enum ipc_active_state s = fsmonitor_ipc__get_state();
14491450

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)