[PATCH] Fix declaration-after-statement in ext/Socket/Socket.xs

This trivial patch lets C89-ish compilers compile Socket.c again.

--- perl-current/ext/Socket/Socket.xs	Thu Mar 26 20:02:08 2009
+++ perl-andy/ext/Socket/Socket.xs	Thu Apr  9 10:05:26 2009
@@ -477,13 +477,14 @@
         const char *  host
         CODE:
 #ifdef HAS_INETPTON
+        int ok;
         struct in6_addr ip_address;
         if(af != AF_INET && af != AF_INET6) {
            croak("Bad address family for %s, got %d, should be either AF_INET or AF_INET6",
                         "Socket::inet_pton",
                         af);
         }
-        int ok = (*host != '\0') && inet_pton(af, host, &ip_address);
+        ok = (*host != '\0') && inet_pton(af, host, &ip_address);
 
         ST(0) = sv_newmortal();
         if (ok) {

-- 
    Andy Dougherty		doughera@lafayette.edu
0
doughera
4/9/2009 3:41:34 PM
perl.perl5.porters 48287 articles. 1 followers. Follow

1 Replies
409 Views

Similar Articles

[PageSpeed] 22

On Thu, 9 Apr 2009 11:41:34 -0400 (EDT), Andy Dougherty
<doughera@lafayette.edu> wrote:

> This trivial patch lets C89-ish compilers compile Socket.c again.

Thanks, applied as 5a8cf367090fb5d83d8e8e0ae381a3525a215928

> --- perl-current/ext/Socket/Socket.xs	Thu Mar 26 20:02:08 2009
> +++ perl-andy/ext/Socket/Socket.xs	Thu Apr  9 10:05:26 2009
> @@ -477,13 +477,14 @@
>          const char *  host
>          CODE:
>  #ifdef HAS_INETPTON
> +        int ok;
>          struct in6_addr ip_address;
>          if(af != AF_INET && af != AF_INET6) {
>             croak("Bad address family for %s, got %d, should be either AF_INET or AF_INET6",
>                          "Socket::inet_pton",
>                          af);
>          }
> -        int ok = (*host != '\0') && inet_pton(af, host, &ip_address);
> +        ok = (*host != '\0') && inet_pton(af, host, &ip_address);
>  
>          ST(0) = sv_newmortal();
>          if (ok) {
> 


-- 
H.Merijn Brand  http://tux.nl      Perl Monger  http://amsterdam.pm.org/
using & porting perl 5.6.2, 5.8.x, 5.10.x, 5.11.x on HP-UX 10.20, 11.00,
11.11, 11.23, and 11.31, SuSE 10.3, 11.0, and 11.1, AIX 5.2, and Cygwin.
http://mirrors.develooper.com/hpux/           http://www.test-smoke.org/
http://qa.perl.org      http://www.goldmark.org/jeff/stupid-disclaimers/
0
h
4/9/2009 4:07:21 PM
Reply:

Similar Artilces:

[PATCH] Whitespace fixes in ext/Socket/Socket.{pm,xs}
--tsOsTdHNUZQcU9Ye Content-Type: multipart/mixed; boundary="3MwIy2ne0vdjdPXF" Content-Disposition: inline --3MwIy2ne0vdjdPXF Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable The attached patch fixes whitespace in recent code added to Socket.{xs,pm} to be consistent with the rest of the files. No functionallity change. --=20 Paul "LeoNerd" Evans leonerd@leonerd.org.uk ICQ# 4135350 | Registered Linux# 179460 http://www.leonerd.org.uk/ --3MwIy2ne0vdjdPXF Content-Type: text/x-di...

ext/Socket/Socket.xs
In Socket.xs do I take it that this if (strEQ(name, "MSG_CTRUNC")) #if defined(MSG_TRUNC) || defined(HAS_MSG_CTRUNC) /* might be an enum */ return MSG_CTRUNC; #else goto not_there; #endif should be MSG_CTRUNC? As in: #if defined(MSG_CTRUNC) || defined(HAS_MSG_CTRUNC) /* might be an enum */ Secondly, Socket.pm EXPORTs MSG_URG, but there is no code to generate it in Socket.xs. Was this an oversight somewhere? Nicholas Clark On Sun, Jun 03, 2001 at 03:03:46PM +0100, Nicholas Clark wrote: > In Socket.xs do I take it that this > > if (strEQ(...

patch to ext/IO/lib/IO/Socket/INET.pm fixes Bug ID (20010803.022)
I submitted this patch via perlbug, with much explanation and a test program that showed the problem. The old code assigned $defport from $1 if $1 was set, but sometimes the pattern match fails, and $1 comes from an earlier setting. $port =~ s,\((\d+)\)$,,; my $defport = $1 || undef; I was getting this problem when using CPAN::WAIT extensions to CPAN wq des=rcs but it's not really a CPAN issue. Fixing this bug should also fix Bug ID (20010803.022) so I'll post this to p5p with that in the subject Before the patch the test prints port=ls6-www.cs.uni-dortmund.d...

Coverity FORWARD NULL finding in ext/Socket/Socket.c XS_Socket_inet_aton
It doesn't like this bit: int ok = (host != NULL) && (*host != '\0') && inet_aton(host, &ip_address); if (!ok && (phe = gethostbyname(host))) { where host is set to SvPV_nolen(ST(0)). I don't think sv_2pv_flags *can* return NULL in the first place, so perhaps the host != NULL check should be removed. If somehow it can return NULL, gethostbyname shouldn't be called when host is NULL. On Mon, Apr 10, 2006 at 01:51:32AM -0700, Yitzchak Scott-Thoennes wrote: > It doesn't like this bit: > > int ok = > ...

[PATCH] remove forward declarations in Socket.pm
according to h2xs: # Fixed between 5.005_53 and 5.005_61 if (\$] >= 5.00561) { *\$AUTOLOAD = sub () { \$val }; } i assume these forward declarations in Socket.pm were added to avoid this problem? if the problem is gone (prototype mismatch?), there should be no need for the additional bloat. --- ext/Socket/Socket.pm~ Mon Mar 13 04:00:13 2000 +++ ext/Socket/Socket.pm Tue Jun 20 21:49:01 2000 @@ -325,116 +325,6 @@ } } -sub INADDR_ANY (); -sub INADDR_BROADCAST (); -sub INADDR_LOOPBACK (); -sub INADDR_LOOPBACK (); - -sub AF_802 (); -sub AF_APPLETALK ()...

[PATCH ext/Socket/socketpair.t] TODO for QNX6
Declares the socketpair tests as TODO, since socketpair is currently unsupported. It is reportedly supported in the next release of the OS (QNX 6.2), due in Summer. -Norton Allen --- ../ORIG/perl-15300/ext/Socket/socketpair.t Mon Mar 11 14:56:41 2002 +++ perl-15300/ext/Socket/socketpair.t Fri Mar 22 16:54:07 2002 @@ -156,7 +156,7 @@ SKIP: { skip "No usable SOCK_DGRAM for socketpair", 24 if ($^O =~ /^(MSWin32|os2)\z/); - + local $TODO = "socketpair not supported on $^O" if $^O eq 'nto'; ok (socketpair (LEFT, RIGHT, AF_UNIX, SOCK_DGRAM, PF...

[PATCH] fix "print" to network socket
This is a fix, somewhat ugly but working, to the problem mentioned previously about doing "print"'s to a network socket. The idea is that we flag file#'s as "sockets" in the few places where socket filehandles are actually created, and then reset them when the files are closed. Then my_fwrite (in VMS.C) only has to check the file# and flag to see if it should use "write" or "fputs" for output. I used a fixed global array for this, for several reasons (a) speed [it gets checked on each item of a print list] (b) simplicity (c) thread...

[PATCH: ext/Cwd/Cwd.xs & ext/PerlIO/Scalar/Scalar.xs] Missing prototype behaviour
In perl@9728, a make complains about missing prototyping behaviour in two files. This patch fixes that. Abigail diff -rc ext.orig/Cwd/Cwd.xs ext/Cwd/Cwd.xs *** ext.orig/Cwd/Cwd.xs Sat Mar 31 01:23:27 2001 --- ext/Cwd/Cwd.xs Wed Apr 18 00:59:13 2001 *************** *** 121,126 **** --- 121,128 ---- MODULE = Cwd PACKAGE = Cwd + PROTOTYPES: ENABLE + char * _fastcwd() PPCODE: diff -rc ext.orig/PerlIO/Scalar/Scalar.xs ext/PerlIO/Scalar/Scalar.xs *** ext.orig/PerlIO/Scalar/Scalar.xs Fri Apr 13 15:45:36 2001 --- ext/PerlIO/Scalar/Scalar.xs Wed Apr 18 01:02:1...

[PATCH] Fix unpack of abstract socket addrs with nul byte
Addresses of Linux abstract namespace sockets are not nul-terminated C strings, but rather an arbitrary character arrays. According to unix(7) documentation from Linux, "Null bytes in the name have no special significance." unpack_sockaddr_un() was just throwing the initial nul byte away and then treating the rest like ordinary C string when computing the length of the address, which was wrong. This fix utilizes the length of the PV for addresses starting with nul instead. The regression test was extended with check for the problem. --- ext/Socket/Socket.xs | 20 ++...

Socket to Socket example needed
Does anyone have any configuration examples of how to set up a socket to socket connection. I would appeciate any examples or help anyone can offer. Thanks. Rob McGinness Rutland Regional Medical Center 802-747-6526 rmcginness@rrmc.org I guess that you talk about one AIM module that drives two socket conections. If you try to build such module, you must create two protocol objects within the project. Each protocol object can control its own related objects (frame, port, open, close, etc.) > Does anyone have any configuration examples of how to set > up a socket to socke...

[PATCH] ext/IO/IO.xs: fix blocking on sparc linux
On sparc linux the IO blocking method is broken. It appears that O_NDELAY is defined as being different from O_NONBLOCK, but sharing some bits: #define O_NDELAY (0x0004 | O_NONBLOCK) meaning that (mode & O_NDELAY) is true when O_NONBLOCK is set. This causes the method to always set O_NONBLOCK when block >= 0: if (block >= 0) { if ((mode & O_NDELAY) || ((block == 0) && !(mode & O_NONBLOCK))) { /* set O_NONBLOCK */ } else if ((mode & O_NDELAY) || ((block > 0) && (mode & O_NONBLOCK))) { /* clear O_NONBLOCK|O_ND...

[PATCH] Fix to installing non-xs ext's in priv lib
--0015175cf7ce70f320046399b8e5 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Previous work to flatten the dirs under ext/ resulted in installperl installing non-XS extensions under archlib. The attached patch fixes this. --0015175cf7ce70f320046399b8e5 Content-Type: text/x-patch; charset=US-ASCII; name="0001-Fix-to-installing-non-xs-ext-s-in-priv-lib.patch" Content-Disposition: attachment; filename="0001-Fix-to-installing-non-xs-ext-s-in-priv-lib.patch" Content-Transfer-Encoding: base64 X-Attachment-Id: f_frjg9tcl0 RnJvb...

SOCKET
Hi all!!! Can any body help me with some information or docs about Sockets with Power Builder. I'm Working with PB 6.5, but if you have an example in PB 7 I can use it. Now I'm waiting for your help. :-) If you mean three-tier apps, pb has it's own communication objects (transport, connection). If you need something more than that you can use third-party libraries as OLE objects, because you can't work from pob directly with wsock32.dll. <CARRADINE> wrote in message news:1111D847FE7E5A290058E38C85256C75.0058E3D185256C75@webforums... > Hi all!...

Socket
How to get the ipaddress of the client machine using Socket programing,i want to check which r the pc's r connected to the server using vb.net any example will be very helpfull for me thanks in advance PrasantHI think therefore i'mvPrasĀ© If you're representing the client as a Socket, this class has a RemoteEndPoint Public property that is of type EndPoint. It encapsulates information about the client. If you're representing the client as a TcpClient, this class has a Protected Client property of type Socket (thus getting to the RemoteEndPoint). Protected meaning you have ...

Web resources about - [PATCH] Fix declaration-after-statement in ext/Socket/Socket.xs - perl.perl5.porters

Resources last updated: 12/27/2015 10:10:58 PM