diff options
author | Thomas Wouters <thomas@python.org> | 2006-04-15 21:47:09 (GMT) |
---|---|---|
committer | Thomas Wouters <thomas@python.org> | 2006-04-15 21:47:09 (GMT) |
commit | c6e55068cad6f2178981eec4f0a0a583b8bba21a (patch) | |
tree | 19a89bbe082dadc70c1413030e5a5b8dacac757c /Objects/enumobject.c | |
parent | 447d095976fd532bf1882bf7afeb52473ff8673c (diff) | |
download | cpython-c6e55068cad6f2178981eec4f0a0a583b8bba21a.zip cpython-c6e55068cad6f2178981eec4f0a0a583b8bba21a.tar.gz cpython-c6e55068cad6f2178981eec4f0a0a583b8bba21a.tar.bz2 |
Use Py_VISIT in all tp_traverse methods, instead of traversing manually or
using a custom, nearly-identical macro. This probably changes how some of
these functions are compiled, which may result in fractionally slower (or
faster) execution. Considering the nature of traversal, visiting much of the
address space in unpredictable patterns, I'd argue the code readability and
maintainability is well worth it ;P
Diffstat (limited to 'Objects/enumobject.c')
-rw-r--r-- | Objects/enumobject.c | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/Objects/enumobject.c b/Objects/enumobject.c index cd31dc1..a8f43e0 100644 --- a/Objects/enumobject.c +++ b/Objects/enumobject.c @@ -49,18 +49,8 @@ enum_dealloc(enumobject *en) static int enum_traverse(enumobject *en, visitproc visit, void *arg) { - int err; - - if (en->en_sit) { - err = visit(en->en_sit, arg); - if (err) - return err; - } - if (en->en_result) { - err = visit(en->en_result, arg); - if (err) - return err; - } + Py_VISIT(en->en_sit); + Py_VISIT(en->en_result); return 0; } @@ -205,8 +195,7 @@ reversed_dealloc(reversedobject *ro) static int reversed_traverse(reversedobject *ro, visitproc visit, void *arg) { - if (ro->seq) - return visit((PyObject *)(ro->seq), arg); + Py_VISIT(ro->seq); return 0; } |