From: Alejandro Colomar <colomar.6.4.3@gmail.com>
To: mtk.manpages@gmail.com
Cc: linux-man@vger.kernel.org, Alejandro Colomar <colomar.6.4.3@gmail.com>
Subject: [PATCH 3/7] msgop.2: Remove unneeded casts
Date: Sat, 5 Sep 2020 17:14:57 +0200 [thread overview]
Message-ID: <20200905151501.609036-4-colomar.6.4.3@gmail.com> (raw)
In-Reply-To: <20200905151501.609036-1-colomar.6.4.3@gmail.com>
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
next prev parent reply other threads:[~2020-09-05 15:17 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-05 15:14 [PATCH 0/7] Remove and/or fix casts Alejandro Colomar
2020-09-05 15:14 ` [PATCH 1/7] sock_diag.7: Remove unneeded casts Alejandro Colomar
2020-09-05 15:14 ` [PATCH 2/7] pthread_sigmask.3: " Alejandro Colomar
2020-09-05 15:14 ` Alejandro Colomar [this message]
2020-09-05 15:14 ` [PATCH 4/7] user_namespaces.7: Remove unneeded cast Alejandro Colomar
2020-09-05 15:14 ` [PATCH 5/7] dlopen.3: " Alejandro Colomar
2020-09-06 13:02 ` Michael Kerrisk (man-pages)
2020-09-06 13:22 ` Alejandro Colomar
2020-09-06 14:27 ` Alejandro Colomar
2020-09-06 15:00 ` Michael Kerrisk (man-pages)
2020-09-06 15:13 ` Michael Kerrisk (man-pages)
2020-09-06 16:43 ` Alejandro Colomar
2020-09-05 15:15 ` [PATCH 6/7] bsearch.3: Fix intermediate type and remove unneeded casts Alejandro Colomar
2020-09-05 15:15 ` [PATCH 7/7] qsort.3: Fix casts Alejandro Colomar
2020-09-06 12:59 ` [PATCH 0/7] Remove and/or fix casts Michael Kerrisk (man-pages)
2020-09-06 13:02 ` Michael Kerrisk (man-pages)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200905151501.609036-4-colomar.6.4.3@gmail.com \
--to=colomar.6.4.3@gmail.com \
--cc=linux-man@vger.kernel.org \
--cc=mtk.manpages@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox