Ticket #1699: network_csocklen_cleanup.dpatch

File network_csocklen_cleanup.dpatch, 4.8 KB (added by kolmodin, 6 years ago)

Make Network.Socket use CSockLen instead of CInt + cleanup

Line 
1
2New patches:
3
4[Switch to using CSockLen instead of CInt
5Lennart Kolmodin <kolmodin@gentoo.org>**20071228204324] {
6hunk ./Network/Socket.hsc 230
7+type CSockLen       = #type socklen_t
8hunk ./Network/Socket.hsc 480
9+pokeSockAddr :: Ptr SockAddr -> SockAddr -> IO ()
10hunk ./Network/Socket.hsc 547
11+sizeOfSockAddr :: SockAddr -> CSockLen
12hunk ./Network/Socket.hsc 556
13-withSockAddr :: SockAddr -> (Ptr SockAddr -> Int -> IO a) -> IO a
14+withSockAddr :: SockAddr -> (Ptr SockAddr -> CSockLen -> IO a) -> IO a
15hunk ./Network/Socket.hsc 559
16- allocaBytes sz $ \p -> pokeSockAddr p addr >> f (castPtr p) sz
17+ allocaBytes (fromIntegral sz) $ \p -> pokeSockAddr p addr >> f (castPtr p) sz
18hunk ./Network/Socket.hsc 561
19-withNewSockAddr :: Family -> (Ptr SockAddr -> Int -> IO a) -> IO a
20+withNewSockAddr :: Family -> (Ptr SockAddr -> CSockLen -> IO a) -> IO a
21hunk ./Network/Socket.hsc 564
22- allocaBytes sz $ \ptr -> f ptr sz
23+ allocaBytes (fromIntegral sz) $ \ptr -> f ptr sz
24hunk ./Network/Socket.hsc 657
25-   status <- throwSocketErrorIfMinus1Retry "bind" $ c_bind s p_addr (fromIntegral sz)
26+   status <- throwSocketErrorIfMinus1Retry "bind" $ c_bind s p_addr sz
27hunk ./Network/Socket.hsc 688
28-                  r <- c_connect s p_addr (fromIntegral sz)
29+                  r <- c_connect s p_addr sz
30hunk ./Network/Socket.hsc 703
31-                          r <- c_connect s p_addr (fromIntegral sz)
32+                          r <- c_connect s p_addr sz
33hunk ./Network/Socket.hsc 773
34-     let sz = sizeOfSockAddr_Family family
35-     allocaBytes sz $ \ sockaddr -> do
36+     withNewSockAddr family $ \sockaddr sz -> do
37hunk ./Network/Socket.hsc 840
38-                       p_addr (fromIntegral sz)
39+                       p_addr sz
40hunk ./Network/Socket.hsc 854
41-      alloca $ \ptr_len -> do
42-       poke ptr_len (fromIntegral sz)
43+      with sz $ \ptr_len -> do
44hunk ./Network/Socket.hsc 957
45-   with (fromIntegral sz) $ \int_star -> do
46-   throwSocketErrorIfMinus1Retry "getPeerName" $ c_getpeername s ptr int_star
47-   sz <- peek int_star
48+   with sz $ \ptr_sz -> do
49+   throwSocketErrorIfMinus1Retry "getPeerName" $ c_getpeername s ptr ptr_sz
50hunk ./Network/Socket.hsc 960
51-   
52+
53hunk ./Network/Socket.hsc 964
54-   with (fromIntegral sz) $ \int_star -> do
55-   throwSocketErrorIfMinus1Retry "getSocketName" $ c_getsockname s ptr int_star
56+   with sz $ \ptr_sz -> do
57+   throwSocketErrorIfMinus1Retry "getSocketName" $ c_getsockname s ptr ptr_sz
58hunk ./Network/Socket.hsc 2422
59-        ret <- c_getnameinfo ptr_addr (fromIntegral sz) c_host c_hostlen
60+        ret <- c_getnameinfo ptr_addr sz c_host c_hostlen
61hunk ./Network/Socket.hsc 2437
62-    c_getnameinfo :: Ptr SockAddr -> CInt{-CSockLen???-} -> CString -> CSize -> CString
63+    c_getnameinfo :: Ptr SockAddr -> CSockLen -> CString -> CSize -> CString
64hunk ./Network/Socket.hsc 2505
65-  c_bind :: CInt -> Ptr SockAddr -> CInt{-CSockLen???-} -> IO CInt
66+  c_bind :: CInt -> Ptr SockAddr -> CSockLen -> IO CInt
67hunk ./Network/Socket.hsc 2507
68-  c_connect :: CInt -> Ptr SockAddr -> CInt{-CSockLen???-} -> IO CInt
69+  c_connect :: CInt -> Ptr SockAddr -> CSockLen -> IO CInt
70hunk ./Network/Socket.hsc 2509
71-  c_accept :: CInt -> Ptr SockAddr -> Ptr CInt{-CSockLen???-} -> IO CInt
72+  c_accept :: CInt -> Ptr SockAddr -> Ptr CSockLen -> IO CInt
73hunk ./Network/Socket.hsc 2511
74-  c_accept_safe :: CInt -> Ptr SockAddr -> Ptr CInt{-CSockLen???-} -> IO CInt
75+  c_accept_safe :: CInt -> Ptr SockAddr -> Ptr CSockLen -> IO CInt
76hunk ./Network/Socket.hsc 2522
77-  c_sendto :: CInt -> Ptr a -> CSize -> CInt -> Ptr SockAddr -> CInt -> IO CInt
78+  c_sendto :: CInt -> Ptr a -> CSize -> CInt -> Ptr SockAddr -> CSockLen -> IO CInt
79hunk ./Network/Socket.hsc 2526
80-  c_recvfrom :: CInt -> Ptr a -> CSize -> CInt -> Ptr SockAddr -> Ptr CInt -> IO CInt
81+  c_recvfrom :: CInt -> Ptr a -> CSize -> CInt -> Ptr SockAddr -> Ptr CSockLen -> IO CInt
82hunk ./Network/Socket.hsc 2528
83-  c_getpeername :: CInt -> Ptr SockAddr -> Ptr CInt -> IO CInt
84+  c_getpeername :: CInt -> Ptr SockAddr -> Ptr CSockLen -> IO CInt
85hunk ./Network/Socket.hsc 2530
86-  c_getsockname :: CInt -> Ptr SockAddr -> Ptr CInt -> IO CInt
87+  c_getsockname :: CInt -> Ptr SockAddr -> Ptr CSockLen -> IO CInt
88}
89
90Context:
91
92[Catch up with changes to GHC.Handle.fdToHandle'
93Simon Marlow <simonmar@microsoft.com>*-20071121084901]
94[Catch up with changes to GHC.Handle.fdToHandle'
95Simon Marlow <simonmar@microsoft.com>**20071121084901]
96[fix test to work with non-GHC implementations
97Ross Paterson <ross@soi.city.ac.uk>**20071118173815]
98[add a signature (to avoid Hugs's non-standard handling of the MR)
99Ross Paterson <ross@soi.city.ac.uk>**20071118173728]
100[fix ifdef for Hugs
101Ross Paterson <ross@soi.city.ac.uk>**20071117195725]
102[Match *-solaris2*, not just *-solaris2, in configure.ac; fixes #1857
103Ian Lynagh <igloo@earth.li>**20071110180525
104 Patch from Christian Maeder
105]
106[TAG GHC 6.8.1 release
107Ian Lynagh <igloo@earth.li>**20071110011105]
108Patch bundle hash:
109df716bd0f5381c52acce85c0dde5b0e96ee274fe