Mercurial > cpython-lru_cache-weakref
diff Modules/socketmodule.c @ 72510:b534b56379cb
Use the new Py_ARRAY_LENGTH macro
| author | Victor Stinner <victor.stinner@haypocalc.com> |
|---|---|
| date | Thu, 29 Sep 2011 00:42:28 +0200 |
| parents | 3ed2d087e70d |
| children | e767318baccd |
line wrap: on
line diff
--- a/Modules/socketmodule.c Thu Sep 29 00:39:24 2011 +0200 +++ b/Modules/socketmodule.c Thu Sep 29 00:42:28 2011 +0200 @@ -3812,7 +3812,7 @@ 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 @@ 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)
