[svn:parrot] r37717 - in trunk/src: io ops

Infinoid at svn.parrot.org Infinoid at svn.parrot.org
Wed Mar 25 15:51:13 UTC 2009


Author: Infinoid
Date: Wed Mar 25 15:51:12 2009
New Revision: 37717
URL: https://trac.parrot.org/parrot/changeset/37717

Log:
[cage] Codetest fixes.

Modified:
   trunk/src/io/socket_api.c
   trunk/src/io/socket_unix.c
   trunk/src/io/socket_win32.c
   trunk/src/ops/io.ops

Modified: trunk/src/io/socket_api.c
==============================================================================
--- trunk/src/io/socket_api.c	Wed Mar 25 15:51:09 2009	(r37716)
+++ trunk/src/io/socket_api.c	Wed Mar 25 15:51:12 2009	(r37717)
@@ -28,15 +28,6 @@
 
 /*
 
-=back
-
-
-=over 4
-*/
-
-
-/*
-
 =item C<INTVAL Parrot_io_socket_is_closed>
 
 =cut
@@ -49,6 +40,7 @@
 INTVAL
 Parrot_io_socket_is_closed(ARGMOD(PMC *socket))
 {
+    ASSERT_ARGS(Parrot_io_socket_is_closed)
     return 0;
 }
 
@@ -67,6 +59,7 @@
 INTVAL
 Parrot_io_poll(PARROT_INTERP, ARGMOD(PMC *pmc), INTVAL which, INTVAL sec, INTVAL usec)
 {
+    ASSERT_ARGS(Parrot_io_poll)
     if (PMC_IS_NULL(pmc))
         Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
             "Can't poll a NULL socket object");
@@ -92,6 +85,7 @@
 PMC *
 Parrot_io_socket(PARROT_INTERP, INTVAL fam, INTVAL type, INTVAL proto)
 {
+    ASSERT_ARGS(Parrot_io_socket)
     return PIO_NEW_SOCKET(interp, fam, type, proto);
 }
 
@@ -110,6 +104,7 @@
 INTVAL
 Parrot_io_recv(PARROT_INTERP, ARGMOD(PMC *pmc), ARGOUT(STRING **buf))
 {
+    ASSERT_ARGS(Parrot_io_recv)
     if (Parrot_io_socket_is_closed(pmc))
         return -1;
 
@@ -132,6 +127,7 @@
 INTVAL
 Parrot_io_send(PARROT_INTERP, ARGMOD(PMC *pmc), ARGMOD(STRING *buf))
 {
+    ASSERT_ARGS(Parrot_io_send)
     if (Parrot_io_socket_is_closed(pmc))
         return -1;
 
@@ -152,6 +148,7 @@
 INTVAL
 Parrot_io_connect(PARROT_INTERP, ARGMOD(PMC *pmc), ARGMOD(PMC *address))
 {
+    ASSERT_ARGS(Parrot_io_connect)
     if (Parrot_io_socket_is_closed(pmc))
         return -1;
 
@@ -173,6 +170,7 @@
 INTVAL
 Parrot_io_bind(PARROT_INTERP, ARGMOD(PMC *pmc), ARGMOD(PMC *address))
 {
+    ASSERT_ARGS(Parrot_io_bind)
     if (Parrot_io_socket_is_closed(pmc))
         return -1;
 
@@ -194,6 +192,7 @@
 INTVAL
 Parrot_io_listen(PARROT_INTERP, ARGMOD(PMC *pmc), INTVAL backlog)
 {
+    ASSERT_ARGS(Parrot_io_listen)
     if (Parrot_io_socket_is_closed(pmc))
         return -1;
 
@@ -217,7 +216,7 @@
 PMC *
 Parrot_io_accept(PARROT_INTERP, ARGMOD(PMC *pmc))
 {
-
+    ASSERT_ARGS(Parrot_io_accept)
     if (Parrot_io_socket_is_closed(pmc))
         return PMCNULL;
 

Modified: trunk/src/io/socket_unix.c
==============================================================================
--- trunk/src/io/socket_unix.c	Wed Mar 25 15:51:09 2009	(r37716)
+++ trunk/src/io/socket_unix.c	Wed Mar 25 15:51:12 2009	(r37717)
@@ -34,7 +34,7 @@
 
 #ifdef PIO_OS_UNIX
 
-#include <sys/socket.h>
+#  include <sys/socket.h>
 
 /* HEADERIZER HFILE: include/parrot/io_unix.h */
 
@@ -88,7 +88,7 @@
 */
 
 /* Helper macros to get sockaddr_in */
-#define SOCKADDR(p, t) ((struct sockaddr_in*)VTABLE_get_pointer(interp, PARROT_SOCKET((p))->t))
+#  define SOCKADDR(p, t) ((struct sockaddr_in*)VTABLE_get_pointer(interp, PARROT_SOCKET((p))->t))
 
 
 PARROT_WARN_UNUSED_RESULT
@@ -96,6 +96,7 @@
 PMC *
 Parrot_io_sockaddr_in(PARROT_INTERP, ARGIN(STRING *addr), INTVAL port)
 {
+    ASSERT_ARGS(Parrot_io_sockaddr_in)
     PMC * sockaddr;
     char * s;
 
@@ -125,6 +126,7 @@
 PMC *
 Parrot_io_socket_unix(PARROT_INTERP, int fam, int type, int proto)
 {
+    ASSERT_ARGS(Parrot_io_socket_unix)
     int i;
     const int sock = socket(fam, type, proto);
     if (sock >= 0) {
@@ -150,6 +152,7 @@
 INTVAL
 Parrot_io_connect_unix(PARROT_INTERP, ARGMOD(PMC *socket), ARGIN(PMC *r))
 {
+    ASSERT_ARGS(Parrot_io_connect_unix)
     Parrot_Socket_attributes * io = PARROT_SOCKET(socket);
 
     if (!r)
@@ -188,6 +191,7 @@
 INTVAL
 Parrot_io_bind_unix(PARROT_INTERP, ARGMOD(PMC *socket), ARGMOD(PMC *sockaddr))
 {
+    ASSERT_ARGS(Parrot_io_bind_unix)
     Parrot_Socket_attributes * io = PARROT_SOCKET(socket);
     struct sockaddr_in * saddr;
 
@@ -220,6 +224,7 @@
 INTVAL
 Parrot_io_listen_unix(SHIM_INTERP, ARGMOD(PMC *socket), INTVAL sec)
 {
+    ASSERT_ARGS(Parrot_io_listen_unix)
     Parrot_Socket_attributes * io = PARROT_SOCKET(socket);
     if ((listen(io->os_handle, sec)) == -1) {
         return -1;
@@ -242,6 +247,7 @@
 PMC *
 Parrot_io_accept_unix(PARROT_INTERP, ARGMOD(PMC *socket))
 {
+    ASSERT_ARGS(Parrot_io_accept_unix)
     Parrot_Socket_attributes * io = PARROT_SOCKET(socket);
     PMC * newio   = Parrot_io_new_socket_pmc(interp,
             PIO_F_SOCKET | PIO_F_READ|PIO_F_WRITE);
@@ -283,6 +289,7 @@
 INTVAL
 Parrot_io_send_unix(SHIM_INTERP, ARGMOD(PMC *socket), ARGMOD(STRING *s))
 {
+    ASSERT_ARGS(Parrot_io_send_unix)
     int error, bytes, byteswrote;
     Parrot_Socket_attributes * io = PARROT_SOCKET(socket);
 
@@ -335,6 +342,7 @@
 INTVAL
 Parrot_io_recv_unix(PARROT_INTERP, ARGMOD(PMC *socket), ARGOUT(STRING **s))
 {
+    ASSERT_ARGS(Parrot_io_recv_unix)
     int error;
     unsigned int bytesread = 0;
     char buf[2048];
@@ -397,6 +405,7 @@
 Parrot_io_poll_unix(SHIM_INTERP, ARGMOD(PMC *socket), int which, int sec,
     int usec)
 {
+    ASSERT_ARGS(Parrot_io_poll_unix)
     int n;
     fd_set r, w, e;
     struct timeval t;
@@ -428,17 +437,18 @@
 get_sockaddr_in(PARROT_INTERP, ARGIN(PMC * sockaddr), ARGIN(const char* host),
             int port)
 {
+    ASSERT_ARGS(get_sockaddr_in)
     struct sockaddr_in *sa;
     /* Hard coded to IPv4 for now */
     const int family = AF_INET;
 
     sa = (struct sockaddr_in*)VTABLE_get_pointer(interp, sockaddr);
-#  ifdef PARROT_DEF_INET_ATON
+#    ifdef PARROT_DEF_INET_ATON
     if (inet_aton(host, &sa->sin_addr) != 0) {
-#  else
+#    else
     /* positive retval is success */
     if (inet_pton(family, host, &sa->sin_addr) > 0) {
-#  endif
+#    endif
         /* Success converting numeric IP */
     }
     else {

Modified: trunk/src/io/socket_win32.c
==============================================================================
--- trunk/src/io/socket_win32.c	Wed Mar 25 15:51:09 2009	(r37716)
+++ trunk/src/io/socket_win32.c	Wed Mar 25 15:51:12 2009	(r37717)
@@ -42,7 +42,7 @@
 #  if PARROT_NET_DEVEL
 
 /* Helper macros to get sockaddr_in */
-#define SOCKADDR(p, t) ((struct sockaddr_in*)VTABLE_get_pointer(interp, PARROT_SOCKET((p))->t))
+#    define SOCKADDR(p, t) ((struct sockaddr_in*)VTABLE_get_pointer(interp, PARROT_SOCKET((p))->t))
 
 /*
 
@@ -405,7 +405,7 @@
     return sockaddr;
 }
 
-#endif /* PARROT_NET_DEVEL */
+#  endif /* PARROT_NET_DEVEL */
 
 #endif /* PIO_OS_WIN32 */
 

Modified: trunk/src/ops/io.ops
==============================================================================
--- trunk/src/ops/io.ops	Wed Mar 25 15:51:09 2009	(r37716)
+++ trunk/src/ops/io.ops	Wed Mar 25 15:51:12 2009	(r37717)
@@ -496,7 +496,7 @@
 
 ########################################
 
-=item B<sockaddr>(out PMC, in STRING, in INT)
+=item B<sockaddr>(out PMC, in STR, in INT)
 
 Create new Sockaddr PMC.
 
@@ -556,7 +556,7 @@
     $1 = Parrot_io_recv(interp, $2, &$3);
 }
 
-=item B<send>(out INT, in PMC, int STR)
+=item B<send>(out INT, in PMC, in STR)
 
 Send data to socket
 


More information about the parrot-commits mailing list