[PATCH 3/7] msgop.2: Remove unneeded casts

Alejandro Colomar
2020-09-05T15:17:25Z

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>
---
man2/msgop.2 | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/man2/msgop.2 b/man2/msgop.2
index f992d91a3..373e53aa7 100644
--- a/man2/msgop.2
+++ b/man2/msgop.2
@@ -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");
--
2.28.0