summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2006-04-15 03:22:46 (GMT)
committerTim Peters <tim.peters@gmail.com>2006-04-15 03:22:46 (GMT)
commitde2acf6512caeacd1ad53e55aa0528f65d1201c7 (patch)
tree0229a13daa59add9513d78f2ddf294152b53c6e5 /Objects
parenta13131cf7f74eb89ed2cc63a9df5859c9ba66258 (diff)
downloadcpython-de2acf6512caeacd1ad53e55aa0528f65d1201c7.zip
cpython-de2acf6512caeacd1ad53e55aa0528f65d1201c7.tar.gz
cpython-de2acf6512caeacd1ad53e55aa0528f65d1201c7.tar.bz2
frame_traverse(): Use the standard Py_VISIT macro.
Py_VISIT: cast the `op` argument to PyObject* when calling `visit()`. Else the caller has to pay too much attention to this silly detail (e.g., frame_traverse needs to traverse `struct _frame *` and `PyCodeObject *` pointers too).
Diffstat (limited to 'Objects')
-rw-r--r--Objects/frameobject.c30
1 files changed, 14 insertions, 16 deletions
diff --git a/Objects/frameobject.c b/Objects/frameobject.c
index 1905996..217f4ba 100644
--- a/Objects/frameobject.c
+++ b/Objects/frameobject.c
@@ -422,30 +422,28 @@ static int
frame_traverse(PyFrameObject *f, visitproc visit, void *arg)
{
PyObject **fastlocals, **p;
- int i, err, slots;
-#define VISIT(o) if (o) {if ((err = visit((PyObject *)(o), arg))) return err;}
-
- VISIT(f->f_back);
- VISIT(f->f_code);
- VISIT(f->f_builtins);
- VISIT(f->f_globals);
- VISIT(f->f_locals);
- VISIT(f->f_trace);
- VISIT(f->f_exc_type);
- VISIT(f->f_exc_value);
- VISIT(f->f_exc_traceback);
+ int i, slots;
+
+ Py_VISIT(f->f_back);
+ Py_VISIT(f->f_code);
+ Py_VISIT(f->f_builtins);
+ Py_VISIT(f->f_globals);
+ Py_VISIT(f->f_locals);
+ Py_VISIT(f->f_trace);
+ Py_VISIT(f->f_exc_type);
+ Py_VISIT(f->f_exc_value);
+ Py_VISIT(f->f_exc_traceback);
/* locals */
slots = f->f_nlocals + f->f_ncells + f->f_nfreevars;
fastlocals = f->f_localsplus;
- for (i = slots; --i >= 0; ++fastlocals) {
- VISIT(*fastlocals);
- }
+ for (i = slots; --i >= 0; ++fastlocals)
+ Py_VISIT(*fastlocals);
/* stack */
if (f->f_stacktop != NULL) {
for (p = f->f_valuestack; p < f->f_stacktop; p++)
- VISIT(*p);
+ Py_VISIT(*p);
}
return 0;
}