diff options
author | Nicholas Clark <nick@ccl4.org> | 2011-01-08 14:29:08 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2011-01-08 19:54:18 +0000 |
commit | e2712234fb9f66b89b77d929912e337172313635 (patch) | |
tree | 4e2968f62f36966780a32d38a372c8ce1545f006 /pp_sys.c | |
parent | b5ce1198cdc91a8659e421932c6de164a98d9b39 (diff) | |
download | perl-e2712234fb9f66b89b77d929912e337172313635.tar.gz |
In pp_send, transpose the blocks for OP_SYSWRITE and OP_SEND
Diffstat (limited to 'pp_sys.c')
-rw-r--r-- | pp_sys.c | 36 |
1 files changed, 17 insertions, 19 deletions
@@ -1894,7 +1894,23 @@ PP(pp_send) } } - if (op_type == OP_SYSWRITE) { + if (op_type == OP_SEND) { +#ifdef HAS_SOCKET + const int flags = SvIVx(*++MARK); + if (SP > MARK) { + STRLEN mlen; + char * const sockbuf = SvPVx(*++MARK, mlen); + retval = PerlSock_sendto(PerlIO_fileno(IoIFP(io)), buffer, blen, + flags, (struct sockaddr *)sockbuf, mlen); + } + else { + retval + = PerlSock_send(PerlIO_fileno(IoIFP(io)), buffer, blen, flags); + } +#else + DIE(aTHX_ PL_no_sock_func, "send"); +#endif + } else { Size_t length = 0; /* This length is in characters. */ STRLEN blen_chars; IV offset; @@ -1989,24 +2005,6 @@ PP(pp_send) buffer, length); } } -#ifdef HAS_SOCKET - else { - const int flags = SvIVx(*++MARK); - if (SP > MARK) { - STRLEN mlen; - char * const sockbuf = SvPVx(*++MARK, mlen); - retval = PerlSock_sendto(PerlIO_fileno(IoIFP(io)), buffer, blen, - flags, (struct sockaddr *)sockbuf, mlen); - } - else { - retval - = PerlSock_send(PerlIO_fileno(IoIFP(io)), buffer, blen, flags); - } - } -#else - else - DIE(aTHX_ PL_no_sock_func, "send"); -#endif if (retval < 0) goto say_undef; |