[Python-checkins] python/dist/src/Modules socketmodule.c,1.248,1.249

loewis@users.sourceforge.net loewis@users.sourceforge.net
Wed, 11 Dec 2002 05:11:00 -0800


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

Modified Files:
	socketmodule.c 
Log Message:
Patch #650422: Use Posix AF_ constants instead of PF_ ones.


Index: socketmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v
retrieving revision 1.248
retrieving revision 1.249
diff -C2 -d -r1.248 -r1.249
*** socketmodule.c	6 Dec 2002 12:57:26 -0000	1.248
--- socketmodule.c	11 Dec 2002 13:10:57 -0000	1.249
***************
*** 662,666 ****
  	if (name[0] == '<' && strcmp(name, "<broadcast>") == 0) {
  		struct sockaddr_in *sin;
! 		if (af != PF_INET && af != PF_UNSPEC) {
  			PyErr_SetString(socket_error,
  				"address family mismatched");
--- 662,666 ----
  	if (name[0] == '<' && strcmp(name, "<broadcast>") == 0) {
  		struct sockaddr_in *sin;
! 		if (af != AF_INET && af != AF_UNSPEC) {
  			PyErr_SetString(socket_error,
  				"address family mismatched");
***************
*** 2351,2355 ****
  	if (!PyArg_ParseTuple(args, "s:gethostbyname_ex", &name))
  		return NULL;
! 	if (setipaddr(name, (struct sockaddr *)&addr, sizeof(addr), PF_INET) < 0)
  		return NULL;
  	Py_BEGIN_ALLOW_THREADS
--- 2351,2355 ----
  	if (!PyArg_ParseTuple(args, "s:gethostbyname_ex", &name))
  		return NULL;
! 	if (setipaddr(name, (struct sockaddr *)&addr, sizeof(addr), AF_INET) < 0)
  		return NULL;
  	Py_BEGIN_ALLOW_THREADS
***************
*** 2426,2430 ****
  	if (!PyArg_ParseTuple(args, "s:gethostbyaddr", &ip_num))
  		return NULL;
! 	af = PF_UNSPEC;
  	if (setipaddr(ip_num, sa, sizeof(addr), af) < 0)
  		return NULL;
--- 2426,2430 ----
  	if (!PyArg_ParseTuple(args, "s:gethostbyaddr", &ip_num))
  		return NULL;
! 	af = AF_UNSPEC;
  	if (setipaddr(ip_num, sa, sizeof(addr), af) < 0)
  		return NULL;
***************
*** 2775,2779 ****
  
  	family = socktype = protocol = flags = 0;
! 	family = PF_UNSPEC;
  	if (!PyArg_ParseTuple(args, "zO|iiii:getaddrinfo",
  	    &hptr, &pobj, &family, &socktype,
--- 2775,2779 ----
  
  	family = socktype = protocol = flags = 0;
! 	family = AF_UNSPEC;
  	if (!PyArg_ParseTuple(args, "zO|iiii:getaddrinfo",
  	    &hptr, &pobj, &family, &socktype,
***************
*** 2862,2866 ****
  	PyOS_snprintf(pbuf, sizeof(pbuf), "%d", port);
  	memset(&hints, 0, sizeof(hints));
! 	hints.ai_family = PF_UNSPEC;
  	hints.ai_socktype = SOCK_DGRAM;	/* make numeric port happy */
  	error = getaddrinfo(hostp, pbuf, &hints, &res);
--- 2862,2866 ----
  	PyOS_snprintf(pbuf, sizeof(pbuf), "%d", port);
  	memset(&hints, 0, sizeof(hints));
! 	hints.ai_family = AF_UNSPEC;
  	hints.ai_socktype = SOCK_DGRAM;	/* make numeric port happy */
  	error = getaddrinfo(hostp, pbuf, &hints, &res);
***************
*** 3251,3255 ****
--- 3251,3257 ----
  	PyModule_AddIntConstant(m, "SOCK_RAW", SOCK_RAW);
  	PyModule_AddIntConstant(m, "SOCK_SEQPACKET", SOCK_SEQPACKET);
+ #if defined(SOCK_RDM)
  	PyModule_AddIntConstant(m, "SOCK_RDM", SOCK_RDM);
+ #endif
  #endif