Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
8b759655
Commit
8b759655
authored
Dec 23, 2011
by
Charles-François Natali
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #8623: Fix some strict-aliasing warnings. Patch by David Watson.
parent
5b629420
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
16 deletions
+10
-16
Modules/socketmodule.c
Modules/socketmodule.c
+9
-16
Modules/socketmodule.h
Modules/socketmodule.h
+1
-0
No files found.
Modules/socketmodule.c
View file @
8b759655
...
...
@@ -436,7 +436,8 @@ dup_socket(SOCKET handle)
#define SEGMENT_SIZE (32 * 1024 -1)
#endif
#define SAS2SA(x) ((struct sockaddr *)(x))
/* Convert "sock_addr_t *" to "struct sockaddr *". */
#define SAS2SA(x) (&((x)->sa))
/*
* Constants for getnameinfo()
...
...
@@ -4148,11 +4149,7 @@ socket_gethostbyname_ex(PyObject *self, PyObject *args)
{
char
*
name
;
struct
hostent
*
h
;
#ifdef ENABLE_IPV6
struct
sockaddr_storage
addr
;
#else
struct
sockaddr_in
addr
;
#endif
sock_addr_t
addr
;
struct
sockaddr
*
sa
;
PyObject
*
ret
=
NULL
;
#ifdef HAVE_GETHOSTBYNAME_R
...
...
@@ -4171,7 +4168,7 @@ socket_gethostbyname_ex(PyObject *self, PyObject *args)
if
(
!
PyArg_ParseTuple
(
args
,
"et:gethostbyname_ex"
,
"idna"
,
&
name
))
return
NULL
;
if
(
setipaddr
(
name
,
(
struct
sockaddr
*
)
&
addr
,
sizeof
(
addr
),
AF_INET
)
<
0
)
if
(
setipaddr
(
name
,
SAS2SA
(
&
addr
)
,
sizeof
(
addr
),
AF_INET
)
<
0
)
goto
finally
;
Py_BEGIN_ALLOW_THREADS
#ifdef HAVE_GETHOSTBYNAME_R
...
...
@@ -4196,8 +4193,8 @@ socket_gethostbyname_ex(PyObject *self, PyObject *args)
addr.ss_family.
Therefore, we cast the sockaddr_storage into sockaddr to
access sa_family. */
sa
=
(
struct
sockaddr
*
)
&
addr
;
ret
=
gethost_common
(
h
,
(
struct
sockaddr
*
)
&
addr
,
sizeof
(
addr
),
sa
=
SAS2SA
(
&
addr
)
;
ret
=
gethost_common
(
h
,
SAS2SA
(
&
addr
)
,
sizeof
(
addr
),
sa
->
sa_family
);
#ifdef USE_GETHOSTBYNAME_LOCK
PyThread_release_lock
(
netdb_lock
);
...
...
@@ -4220,12 +4217,8 @@ for a host. The host argument is a string giving a host name or IP number.");
static
PyObject
*
socket_gethostbyaddr
(
PyObject
*
self
,
PyObject
*
args
)
{
#ifdef ENABLE_IPV6
struct
sockaddr_storage
addr
;
#else
struct
sockaddr_in
addr
;
#endif
struct
sockaddr
*
sa
=
(
struct
sockaddr
*
)
&
addr
;
sock_addr_t
addr
;
struct
sockaddr
*
sa
=
SAS2SA
(
&
addr
);
char
*
ip_num
;
struct
hostent
*
h
;
PyObject
*
ret
=
NULL
;
...
...
@@ -4294,7 +4287,7 @@ socket_gethostbyaddr(PyObject *self, PyObject *args)
h
=
gethostbyaddr
(
ap
,
al
,
af
);
#endif
/* HAVE_GETHOSTBYNAME_R */
Py_END_ALLOW_THREADS
ret
=
gethost_common
(
h
,
(
struct
sockaddr
*
)
&
addr
,
sizeof
(
addr
),
af
);
ret
=
gethost_common
(
h
,
SAS2SA
(
&
addr
)
,
sizeof
(
addr
),
af
);
#ifdef USE_GETHOSTBYNAME_LOCK
PyThread_release_lock
(
netdb_lock
);
#endif
...
...
Modules/socketmodule.h
View file @
8b759655
...
...
@@ -115,6 +115,7 @@ typedef int SOCKET_T;
/* Socket address */
typedef
union
sock_addr
{
struct
sockaddr_in
in
;
struct
sockaddr
sa
;
#ifdef AF_UNIX
struct
sockaddr_un
un
;
#endif
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment