diff options
author | Victor Stinner <victor.stinner@haypocalc.com> | 2011-09-28 22:42:28 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@haypocalc.com> | 2011-09-28 22:42:28 (GMT) |
commit | 639418812f11749f99d1160b26325bdfa3a26a6f (patch) | |
tree | eb438b6f5e06b7a5144567ff5c95c190bf850cc1 /Modules/socketmodule.c | |
parent | b9dcffb51e0075f70434febb6ea557cc4d22f5fd (diff) | |
download | cpython-639418812f11749f99d1160b26325bdfa3a26a6f.zip cpython-639418812f11749f99d1160b26325bdfa3a26a6f.tar.gz cpython-639418812f11749f99d1160b26325bdfa3a26a6f.tar.bz2 |
Use the new Py_ARRAY_LENGTH macro
Diffstat (limited to 'Modules/socketmodule.c')
-rw-r--r-- | Modules/socketmodule.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index 79ccae8..62b3fe9 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -3812,7 +3812,7 @@ socket_gethostname(PyObject *self, PyObject *unused) version of the hostname, whereas we need a Unicode string. Otherwise, gethostname apparently also returns the DNS name. */ wchar_t buf[MAX_COMPUTERNAME_LENGTH + 1]; - DWORD size = sizeof(buf) / sizeof(wchar_t); + DWORD size = Py_ARRAY_LENGTH(buf); PyObject *result; if (!GetComputerNameExW(ComputerNamePhysicalDnsHostname, buf, &size)) { if (GetLastError() == ERROR_MORE_DATA) { @@ -6281,7 +6281,7 @@ PyInit__socket(void) DWORD codes[] = {SIO_RCVALL, SIO_KEEPALIVE_VALS}; const char *names[] = {"SIO_RCVALL", "SIO_KEEPALIVE_VALS"}; int i; - for(i = 0; i<sizeof(codes)/sizeof(*codes); ++i) { + for(i = 0; i<Py_ARRAY_LENGTH(codes); ++i) { PyObject *tmp; tmp = PyLong_FromUnsignedLong(codes[i]); if (tmp == NULL) |