diff options
author | Neil Schemenauer <nascheme@enme.ucalgary.ca> | 2002-03-28 21:06:16 (GMT) |
---|---|---|
committer | Neil Schemenauer <nascheme@enme.ucalgary.ca> | 2002-03-28 21:06:16 (GMT) |
commit | ef99723b660409d278333ec789fbea12655538b9 (patch) | |
tree | 01e7ab6ae0705d84d3fce7b0e35cd09923c88ddc /Include/objimpl.h | |
parent | bd02b14255f99feef90121cf654989b9fe827210 (diff) | |
download | cpython-ef99723b660409d278333ec789fbea12655538b9.zip cpython-ef99723b660409d278333ec789fbea12655538b9.tar.gz cpython-ef99723b660409d278333ec789fbea12655538b9.tar.bz2 |
Add _Py_AS_GC macro. It will be used by the trashcan code on object.c.
Diffstat (limited to 'Include/objimpl.h')
-rw-r--r-- | Include/objimpl.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Include/objimpl.h b/Include/objimpl.h index e27de30..50ea51c 100644 --- a/Include/objimpl.h +++ b/Include/objimpl.h @@ -235,10 +235,12 @@ typedef union _gc_head { extern PyGC_Head _PyGC_generation0; +#define _Py_AS_GC(o) ((PyGC_Head *)(o)-1) + /* Tell the GC to track this object. NB: While the object is tracked the * collector it must be safe to call the ob_traverse method. */ #define _PyObject_GC_TRACK(o) do { \ - PyGC_Head *g = (PyGC_Head *)(o)-1; \ + PyGC_Head *g = _Py_AS_GC(o); \ if (g->gc.gc_next != NULL) \ Py_FatalError("GC object already in linked list"); \ g->gc.gc_next = &_PyGC_generation0; \ @@ -249,7 +251,7 @@ extern PyGC_Head _PyGC_generation0; /* Tell the GC to stop tracking this object. */ #define _PyObject_GC_UNTRACK(o) do { \ - PyGC_Head *g = (PyGC_Head *)(o)-1; \ + PyGC_Head *g = _Py_AS_GC(o); \ g->gc.gc_prev->gc.gc_next = g->gc.gc_next; \ g->gc.gc_next->gc.gc_prev = g->gc.gc_prev; \ g->gc.gc_next = NULL; \ |