msgop.2: Remove unneeded casts

The type `struct msgbuf *` is implicitly casted to `const void *`.
Not only that, but the explicit cast to `void *` was slightly
misleading.
Explicitly casting can silence warnings when mistakes are made, so it's
better to remove those casts when possible.

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Alejandro Colomar 2020-09-05 17:14:57 +02:00 committed by Michael Kerrisk
parent a0303c05c4
commit 180698be28
1 changed files with 2 additions and 2 deletions

View File

@ -637,7 +637,7 @@ send_msg(int qid, int msgtype)
snprintf(msg.mtext, sizeof(msg.mtext), "a message at %s",
ctime(&t));
if (msgsnd(qid, (void *) &msg, sizeof(msg.mtext),
if (msgsnd(qid, &msg, sizeof(msg.mtext),
IPC_NOWAIT) == \-1) {
perror("msgsnd error");
exit(EXIT_FAILURE);
@ -650,7 +650,7 @@ get_msg(int qid, int msgtype)
{
struct msgbuf msg;
if (msgrcv(qid, (void *) &msg, sizeof(msg.mtext), msgtype,
if (msgrcv(qid, &msg, sizeof(msg.mtext), msgtype,
MSG_NOERROR | IPC_NOWAIT) == \-1) {
if (errno != ENOMSG) {
perror("msgrcv");