public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin/cygwin-3_5-branch] Cygwin: asm/socket.h: drop outdated casts
@ 2024-08-22 20:37 Corinna Vinschen
0 siblings, 0 replies; only message in thread
From: Corinna Vinschen @ 2024-08-22 20:37 UTC (permalink / raw)
To: cygwin-cvs
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=c75f3939d843fe80d13a8a2fc64c50f8ffed6f5a
commit c75f3939d843fe80d13a8a2fc64c50f8ffed6f5a
Author: Corinna Vinschen <corinna@vinschen.de>
AuthorDate: Wed Aug 7 17:09:44 2024 +0200
Commit: Corinna Vinschen <corinna@vinschen.de>
CommitDate: Thu Aug 22 19:58:49 2024 +0200
Cygwin: asm/socket.h: drop outdated casts
The _IOR anbd _IOW macros cast the sizeof of their third arg
uselessly to long. The _IO definitions have been taken from BSD
in 1995 and never changed again. The fact that the sizeof() gets
cast to long is probably a remnant from the past when the stuff
was supposed to be used on 16 bit machines, but the value was
supposed to be 32 bit.
Given that the values are not supposed to be ever bigger than 32 bit,
we drop the (long) cast. Compare with current FreeBSD, which does
not cast at all.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diff:
---
winsup/cygwin/include/asm/socket.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/winsup/cygwin/include/asm/socket.h b/winsup/cygwin/include/asm/socket.h
index 9aeb889b87bd..276df3a0b5fd 100644
--- a/winsup/cygwin/include/asm/socket.h
+++ b/winsup/cygwin/include/asm/socket.h
@@ -17,8 +17,8 @@ details. */
#define IOC_IN 0x80000000 /* copy in parameters */
#define _IO(x,y) (IOC_VOID|(x<<8)|y)
-#define _IOR(x,y,t) (IOC_OUT|(((long)sizeof(t)&IOCPARM_MASK)<<16)|(x<<8)|y)
-#define _IOW(x,y,t) (IOC_IN|(((long)sizeof(t)&IOCPARM_MASK)<<16)|(x<<8)|y)
+#define _IOR(x,y,t) (IOC_OUT|((sizeof(t)&IOCPARM_MASK)<<16)|(x<<8)|y)
+#define _IOW(x,y,t) (IOC_IN|((sizeof(t)&IOCPARM_MASK)<<16)|(x<<8)|y)
#define SIOCATMARK _IOR('s', 7, long) /* at oob mark? */
#define FIONREAD _IOR('f', 127, long) /* get # bytes to read */
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-08-22 20:37 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-22 20:37 [newlib-cygwin/cygwin-3_5-branch] Cygwin: asm/socket.h: drop outdated casts Corinna Vinschen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).