[svn:parrot] r46173 - trunk/src/io

jimmy at svn.parrot.org jimmy at svn.parrot.org
Fri Apr 30 03:58:16 UTC 2010


Author: jimmy
Date: Fri Apr 30 03:58:16 2010
New Revision: 46173
URL: https://trac.parrot.org/parrot/changeset/46173

Log:
random consting

Modified:
   trunk/src/io/socket_win32.c

Modified: trunk/src/io/socket_win32.c
==============================================================================
--- trunk/src/io/socket_win32.c	Fri Apr 30 03:58:06 2010	(r46172)
+++ trunk/src/io/socket_win32.c	Fri Apr 30 03:58:16 2010	(r46173)
@@ -77,9 +77,10 @@
 Parrot_io_socket_win32(PARROT_INTERP, ARGIN(PMC * s), int fam, int type, int proto)
 {
     ASSERT_ARGS(Parrot_io_socket_win32)
-    int       i    = 1;
+
     const int sock = socket(fam, type, proto);
     if (sock >= 0) {
+        int       i    = 1;
         setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (const char*)&i, sizeof (i));
         Parrot_io_set_os_handle(interp, s, sock);
         SOCKADDR_REMOTE(s)->sin_family = fam;
@@ -102,7 +103,7 @@
 Parrot_io_connect_win32(PARROT_INTERP, ARGMOD(PMC *socket), ARGIN(PMC *r))
 {
     ASSERT_ARGS(Parrot_io_connect_win32)
-    Parrot_Socket_attributes * io = PARROT_SOCKET(socket);
+    const Parrot_Socket_attributes * const io = PARROT_SOCKET(socket);
 
     if (!r)
         return -1;
@@ -141,7 +142,7 @@
 Parrot_io_bind_win32(PARROT_INTERP, ARGMOD(PMC *socket), ARGMOD(PMC *sockaddr))
 {
     ASSERT_ARGS(Parrot_io_bind_win32)
-    Parrot_Socket_attributes * io = PARROT_SOCKET(socket);
+    const Parrot_Socket_attributes * const io = PARROT_SOCKET(socket);
     struct sockaddr_in * saddr;
 
     if (!sockaddr)
@@ -174,7 +175,7 @@
 Parrot_io_listen_win32(SHIM_INTERP, ARGMOD(PMC *socket), INTVAL sec)
 {
     ASSERT_ARGS(Parrot_io_listen_win32)
-    Parrot_Socket_attributes * io = PARROT_SOCKET(socket);
+    const Parrot_Socket_attributes * const io = PARROT_SOCKET(socket);
     if ((listen((int)io->os_handle, sec)) == -1) {
         return -1;
     }
@@ -197,7 +198,7 @@
 Parrot_io_accept_win32(PARROT_INTERP, ARGMOD(PMC *socket))
 {
     ASSERT_ARGS(Parrot_io_accept_win32)
-    Parrot_Socket_attributes * io = PARROT_SOCKET(socket);
+    const Parrot_Socket_attributes * const io = PARROT_SOCKET(socket);
     PMC * newio   = Parrot_io_new_socket_pmc(interp,
             PIO_F_SOCKET | PIO_F_READ|PIO_F_WRITE);
     Parrot_Socklen_t    addrlen = sizeof (struct sockaddr_in);
@@ -240,7 +241,7 @@
 {
     ASSERT_ARGS(Parrot_io_send_win32)
     int error, bytes, byteswrote;
-    Parrot_Socket_attributes * io = PARROT_SOCKET(socket);
+    const Parrot_Socket_attributes * const io = PARROT_SOCKET(socket);
 
     bytes = s->bufused;
     byteswrote = 0;
@@ -295,7 +296,7 @@
     int error;
     unsigned int bytesread = 0;
     char buf[2048];
-    Parrot_Socket_attributes * io = PARROT_SOCKET(socket);
+    const Parrot_Socket_attributes * const io = PARROT_SOCKET(socket);
 
 AGAIN:
     if ((error = recv((int)io->os_handle, buf, 2048, 0)) >= 0) {
@@ -359,7 +360,7 @@
     int n;
     fd_set r, w, e;
     struct timeval t;
-    Parrot_Socket_attributes * io = PARROT_SOCKET(socket);
+    const Parrot_Socket_attributes * const io = PARROT_SOCKET(socket);
 
     t.tv_sec = sec;
     t.tv_usec = usec;


More information about the parrot-commits mailing list