Skip to content

Commit

Permalink
lib/ipc: set but unused 'kr' variables
Browse files Browse the repository at this point in the history
mach_complete_async() and mach_complete_sync() are void functions.
Nothing uses the 'kr' value after being set which results in

  error: variable 'kr' set but not used [-Werror,-Wunused-but-set-variable]

Remove the variables.
  • Loading branch information
jaltman committed Nov 16, 2022
1 parent 4cd3926 commit 6fa4d05
Showing 1 changed file with 11 additions and 17 deletions.
28 changes: 11 additions & 17 deletions lib/ipc/server.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009 Kungliga Tekniska Högskolan
* Copyright (c) 2009 Kungliga Tekniska H�gskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
Expand Down Expand Up @@ -125,23 +125,21 @@ mach_complete_sync(heim_sipc_call ctx, int returnvalue, heim_idata *reply)
mach_msg_type_number_t replyinCnt;
heim_ipc_message_outband_t replyout;
mach_msg_type_number_t replyoutCnt;
kern_return_t kr;


if (returnvalue) {
/* on error, no reply */
replyinCnt = 0;
replyout = 0; replyoutCnt = 0;
kr = KERN_SUCCESS;
} else if (reply->length < 2048) {
replyinCnt = reply->length;
memcpy(replyin, reply->data, replyinCnt);
replyout = 0; replyoutCnt = 0;
kr = KERN_SUCCESS;
} else {
replyinCnt = 0;
kr = vm_read(mach_task_self(),
(vm_address_t)reply->data, reply->length,
(vm_address_t *)&replyout, &replyoutCnt);
vm_read(mach_task_self(),
(vm_address_t)reply->data, reply->length,
(vm_address_t *)&replyout, &replyoutCnt);
}

mheim_ripc_call_reply(s->reply_port, returnvalue,
Expand All @@ -162,28 +160,25 @@ mach_complete_async(heim_sipc_call ctx, int returnvalue, heim_idata *reply)
mach_msg_type_number_t replyinCnt;
heim_ipc_message_outband_t replyout;
mach_msg_type_number_t replyoutCnt;
kern_return_t kr;

if (returnvalue) {
/* on error, no reply */
replyinCnt = 0;
replyout = 0; replyoutCnt = 0;
kr = KERN_SUCCESS;
} else if (reply->length < 2048) {
replyinCnt = reply->length;
memcpy(replyin, reply->data, replyinCnt);
replyout = 0; replyoutCnt = 0;
kr = KERN_SUCCESS;
} else {
replyinCnt = 0;
kr = vm_read(mach_task_self(),
(vm_address_t)reply->data, reply->length,
(vm_address_t *)&replyout, &replyoutCnt);
vm_read(mach_task_self(),
(vm_address_t)reply->data, reply->length,
(vm_address_t *)&replyout, &replyoutCnt);
}

kr = mheim_aipc_acall_reply(s->reply_port, returnvalue,
replyin, replyinCnt,
replyout, replyoutCnt);
mheim_aipc_acall_reply(s->reply_port, returnvalue,
replyin, replyinCnt,
replyout, replyoutCnt);
heim_ipc_free_cred(s->cred);
free(s->req.data);
free(s);
Expand Down Expand Up @@ -1189,4 +1184,3 @@ heim_ipc_main(void)
process_loop();
#endif
}

0 comments on commit 6fa4d05

Please sign in to comment.