[Python-checkins] python/dist/src/Modules socketmodule.c,1.255,1.256

tim_one@users.sourceforge.net tim_one@users.sourceforge.net
Wed, 12 Feb 2003 19:13:42 -0800


Update of /cvsroot/python/python/dist/src/Modules
In directory sc8-pr-cvs1:/tmp/cvs-serv9223/python/Modules

Modified Files:
	socketmodule.c 
Log Message:
socket_inet_aton():  ip_addr was left undefined before use in the
!HAVE_INET_ATON case.  Repaired that, and tried to repair what looked
like out-of-date comments.


Index: socketmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v
retrieving revision 1.255
retrieving revision 1.256
diff -C2 -d -r1.255 -r1.256
*** socketmodule.c	13 Feb 2003 02:15:42 -0000	1.255
--- socketmodule.c	13 Feb 2003 03:13:40 -0000	1.256
***************
*** 2711,2724 ****
  #define INADDR_NONE (-1)
  #endif
- 
- 	/* Have to use inet_addr() instead */
- 	char *ip_addr;
  #ifdef HAVE_INET_ATON
  	struct in_addr buf;
  
! 	if (!PyArg_ParseTuple(args, "s:inet_aton", &ip_addr)) {
  		return NULL;
- 	}
  
  	if (inet_aton(ip_addr, &buf))
  		return PyString_FromStringAndSize((char *)(&buf),
--- 2711,2727 ----
  #define INADDR_NONE (-1)
  #endif
  #ifdef HAVE_INET_ATON
  	struct in_addr buf;
+ #else
+ 	/* Have to use inet_addr() instead */
+ 	unsigned long packed_addr;
+ #endif
+ 	char *ip_addr;
  
! 	if (!PyArg_ParseTuple(args, "s:inet_aton", &ip_addr))
  		return NULL;
  
+ 
+ #ifdef HAVE_INET_ATON
  	if (inet_aton(ip_addr, &buf))
  		return PyString_FromStringAndSize((char *)(&buf),
***************
*** 2729,2737 ****
  	return NULL;
  
! #else /* In case you don't have inet_aton() */
  	/* XXX Problem here: inet_aton('255.255.255.255') raises
  	   an exception while it should be a valid address. */
- 	unsigned long packed_addr;
- 
  	packed_addr = inet_addr(ip_addr);
  
--- 2732,2738 ----
  	return NULL;
  
! #else /* ! HAVE_INET_ATON */
  	/* XXX Problem here: inet_aton('255.255.255.255') raises
  	   an exception while it should be a valid address. */
  	packed_addr = inet_addr(ip_addr);
  
***************
*** 2741,2745 ****
  		return NULL;
  	}
- 
  	return PyString_FromStringAndSize((char *) &packed_addr,
  					  sizeof(packed_addr));
--- 2742,2745 ----