[Python-checkins] cpython: sock_sendmsg/sock_recvmsg: Use {0} to 0-initialize aggregate types with

charles-francois.natali python-checkins at python.org
Wed Aug 24 21:39:59 CEST 2011


http://hg.python.org/cpython/rev/c53db7dc4b8f
changeset: 72062:c53db7dc4b8f
user: Charles-François Natali <neologix at free.fr>
date: Wed Aug 24 21:40:53 2011 +0200
summary:
 sock_sendmsg/sock_recvmsg: Use {0} to 0-initialize aggregate types with
automatic storage class.
files:
 Modules/socketmodule.c | 9 ++-------
 1 files changed, 2 insertions(+), 7 deletions(-)
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -2780,8 +2780,7 @@
 int timeout;
 sock_addr_t addrbuf;
 socklen_t addrbuflen;
- static const struct msghdr msg_blank;
- struct msghdr msg;
+ struct msghdr msg = {0};
 PyObject *cmsg_list = NULL, *retval = NULL;
 void *controlbuf = NULL;
 struct cmsghdr *cmsgh;
@@ -2815,7 +2814,6 @@
 
 BEGIN_SELECT_LOOP(s)
 Py_BEGIN_ALLOW_THREADS;
- msg = msg_blank; /* Set all members to 0 or NULL */
 msg.msg_name = SAS2SA(&addrbuf);
 msg.msg_namelen = addrbuflen;
 msg.msg_iov = iov;
@@ -3292,8 +3290,7 @@
 Py_buffer *databufs = NULL;
 struct iovec *iovs = NULL;
 sock_addr_t addrbuf;
- static const struct msghdr msg_blank;
- struct msghdr msg;
+ struct msghdr msg = {0};
 struct cmsginfo {
 int level;
 int type;
@@ -3310,8 +3307,6 @@
 &data_arg, &cmsg_arg, &flags, &addr_arg))
 return NULL;
 
- msg = msg_blank; /* Set all members to 0 or NULL */
-
 /* Parse destination address. */
 if (addr_arg != NULL && addr_arg != Py_None) {
 if (!getsockaddrarg(s, addr_arg, SAS2SA(&addrbuf), &addrlen))
-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /