summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-09-28 22:42:28 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2011-09-28 22:42:28 (GMT)
commit639418812f11749f99d1160b26325bdfa3a26a6f (patch)
treeeb438b6f5e06b7a5144567ff5c95c190bf850cc1 /Python
parentb9dcffb51e0075f70434febb6ea557cc4d22f5fd (diff)
downloadcpython-639418812f11749f99d1160b26325bdfa3a26a6f.zip
cpython-639418812f11749f99d1160b26325bdfa3a26a6f.tar.gz
cpython-639418812f11749f99d1160b26325bdfa3a26a6f.tar.bz2
Use the new Py_ARRAY_LENGTH macro
Diffstat (limited to 'Python')
-rw-r--r--Python/codecs.c2
-rw-r--r--Python/dynload_aix.c3
-rw-r--r--Python/sysmodule.c2
3 files changed, 3 insertions, 4 deletions
diff --git a/Python/codecs.c b/Python/codecs.c
index be2e833..4c2fc5d 100644
--- a/Python/codecs.c
+++ b/Python/codecs.c
@@ -1044,7 +1044,7 @@ static int _PyCodecRegistry_Init(void)
interp->codec_error_registry = PyDict_New();
if (interp->codec_error_registry) {
- for (i = 0; i < sizeof(methods)/sizeof(methods[0]); ++i) {
+ for (i = 0; i < Py_ARRAY_LENGTH(methods); ++i) {
PyObject *func = PyCFunction_New(&methods[i].def, NULL);
int res;
if (!func)
diff --git a/Python/dynload_aix.c b/Python/dynload_aix.c
index 74c7b32..6287c86 100644
--- a/Python/dynload_aix.c
+++ b/Python/dynload_aix.c
@@ -129,7 +129,6 @@ aix_loaderror(const char *pathname)
{L_ERROR_ERRNO, NULL}
};
-#define LOAD_ERRTAB_LEN (sizeof(load_errtab)/sizeof(load_errtab[0]))
#define ERRBUF_APPEND(s) strncat(errbuf, s, sizeof(errbuf)-strlen(errbuf)-1)
PyOS_snprintf(errbuf, sizeof(errbuf), "from module %.200s ", pathname);
@@ -140,7 +139,7 @@ aix_loaderror(const char *pathname)
}
for(i = 0; message[i] && *message[i]; i++) {
int nerr = atoi(message[i]);
- for (j=0; j<LOAD_ERRTAB_LEN ; j++) {
+ for (j=0; j < Py_ARRAY_LENGTH(load_errtab); j++) {
if (nerr == load_errtab[j].errNo && load_errtab[j].errstr)
ERRBUF_APPEND(load_errtab[j].errstr);
}
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index dea2149..3576ced 100644
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -1771,7 +1771,7 @@ sys_update_path(int argc, wchar_t **argv)
the argument must be the full path anyway. */
wchar_t *ptemp;
if (GetFullPathNameW(argv0,
- sizeof(fullpath)/sizeof(fullpath[0]),
+ Py_ARRAY_LENGTH(fullpath),
fullpath,
&ptemp)) {
argv0 = fullpath;