summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorSjoerd Mullender <sjoerd@acm.org>1993-10-11 12:54:31 (GMT)
committerSjoerd Mullender <sjoerd@acm.org>1993-10-11 12:54:31 (GMT)
commita9c3c22c33762699b362e7598268442fd2df9eb6 (patch)
tree7ff6bdfb7228abf0a566b6d3215a383796bd5cbf /Include
parent35fe6ec4cf6e192829a5bd28c080761157258e3e (diff)
downloadcpython-a9c3c22c33762699b362e7598268442fd2df9eb6.zip
cpython-a9c3c22c33762699b362e7598268442fd2df9eb6.tar.gz
cpython-a9c3c22c33762699b362e7598268442fd2df9eb6.tar.bz2
* Extended X interface: pixmap objects, colormap objects visual objects,
image objects, and lots of new methods. * Added counting of allocations and deallocations of builtin types if COUNT_ALLOCS is defined. Had to move calls to NEWREF down in some files. * Bug fix in sorting lists.
Diffstat (limited to 'Include')
-rw-r--r--Include/object.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/Include/object.h b/Include/object.h
index 2a6b170..ab270f8 100644
--- a/Include/object.h
+++ b/Include/object.h
@@ -198,6 +198,13 @@ typedef struct _typeobject {
/* More standard operations (at end for binary compatibility) */
long (*tp_hash) FPROTO((object *));
+#ifdef COUNT_ALLOCS
+ /* these must be last */
+ int tp_alloc;
+ int tp_free;
+ int tp_maxalloc;
+ struct _typeobject *tp_next;
+#endif
} typeobject;
extern typeobject Typetype; /* The type of type objects */
@@ -253,15 +260,27 @@ environment the global variable trick is not safe.)
#endif
#ifndef TRACE_REFS
+#ifdef COUNT_ALLOCS
+#define DELREF(op) ((op)->ob_type->tp_free++, (*(op)->ob_type->tp_dealloc)((object *)(op)))
+#else
#define DELREF(op) (*(op)->ob_type->tp_dealloc)((object *)(op))
+#endif
#define UNREF(op) /*empty*/
#endif
+#ifdef COUNT_ALLOCS
+extern void inc_count PROTO((typeobject *));
+#endif
+
#ifdef REF_DEBUG
extern long ref_total;
#ifndef TRACE_REFS
+#ifdef COUNT_ALLOCS
+#define NEWREF(op) (inc_count((op)->ob_type), ref_total++, (op)->ob_refcnt = 1)
+#else
#define NEWREF(op) (ref_total++, (op)->ob_refcnt = 1)
#endif
+#endif
#define INCREF(op) (ref_total++, (op)->ob_refcnt++)
#define DECREF(op) \
if (--ref_total, --(op)->ob_refcnt > 0) \
@@ -269,7 +288,11 @@ extern long ref_total;
else \
DELREF(op)
#else
+#ifdef COUNT_ALLOCS
+#define NEWREF(op) (inc_count((op)->ob_type), (op)->ob_refcnt = 1)
+#else
#define NEWREF(op) ((op)->ob_refcnt = 1)
+#endif
#define INCREF(op) ((op)->ob_refcnt++)
#define DECREF(op) \
if (--(op)->ob_refcnt > 0) \