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/posixmodule.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/posixmodule.c')
-rw-r--r-- | Modules/posixmodule.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 25e7f0d..c35e8a1 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -2895,9 +2895,9 @@ posix__getfullpathname(PyObject *self, PyObject *args) DWORD result; PyObject *v; result = GetFullPathNameW(wpath, - sizeof(woutbuf)/sizeof(woutbuf[0]), + Py_ARRAY_LENGTH(woutbuf), woutbuf, &wtemp); - if (result > sizeof(woutbuf)/sizeof(woutbuf[0])) { + if (result > Py_ARRAY_LENGTH(woutbuf)) { woutbufp = malloc(result * sizeof(Py_UNICODE)); if (!woutbufp) return PyErr_NoMemory(); @@ -2920,7 +2920,7 @@ posix__getfullpathname(PyObject *self, PyObject *args) PyUnicode_FSConverter, &opath)) return NULL; path = PyBytes_AsString(opath); - if (!GetFullPathName(path, sizeof(outbuf)/sizeof(outbuf[0]), + if (!GetFullPathName(path, Py_ARRAY_LENGTH(outbuf), outbuf, &temp)) { win32_error("GetFullPathName", path); Py_DECREF(opath); @@ -4903,7 +4903,7 @@ static PyObject * cpu_set_repr(Py_cpu_set *set) { return PyUnicode_FromFormat("<cpu_set with %li entries>", set->ncpus); -} +} static Py_ssize_t cpu_set_len(Py_cpu_set *set) @@ -5656,7 +5656,7 @@ posix_getlogin(PyObject *self, PyObject *noargs) PyObject *result = NULL; #ifdef MS_WINDOWS wchar_t user_name[UNLEN + 1]; - DWORD num_chars = sizeof(user_name)/sizeof(user_name[0]); + DWORD num_chars = Py_ARRAY_LENGTH(user_name); if (GetUserNameW(user_name, &num_chars)) { /* num_chars is the number of unicode chars plus null terminator */ |