From 2b8985608d33abaae7b201a008e292cbbe2167ef Mon Sep 17 00:00:00 2001 From: Matthew Sotoudeh Date: Thu, 27 Jul 2023 14:26:33 -0700 Subject: add automated refcounting pass --- python/examples/refcounting/runtime/refcounting.h | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 python/examples/refcounting/runtime/refcounting.h (limited to 'python/examples/refcounting/runtime/refcounting.h') diff --git a/python/examples/refcounting/runtime/refcounting.h b/python/examples/refcounting/runtime/refcounting.h new file mode 100644 index 0000000..139f09a --- /dev/null +++ b/python/examples/refcounting/runtime/refcounting.h @@ -0,0 +1,8 @@ +#pragma once + +// wrapper for calloc +void *refcount_calloc(unsigned long count, unsigned long size); +// overwrite a pointer that pointed to 'old' to now point to 'new' +void refcount_write(void *new, void *old); +// decrement the refcount, but do not free if the refcount hits 0 +void refcount_returning(void *ptr); -- cgit v1.2.3