summaryrefslogtreecommitdiff
path: root/runtime-compatibility.h
diff options
context:
space:
mode:
Diffstat (limited to 'runtime-compatibility.h')
-rw-r--r--runtime-compatibility.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/runtime-compatibility.h b/runtime-compatibility.h
new file mode 100644
index 0000000..68bc7ed
--- /dev/null
+++ b/runtime-compatibility.h
@@ -0,0 +1,23 @@
+#include <Foundation/NSObject.h>
+
+#ifndef AUTORELEASE
+
+#define ASSIGN(VAR, VALUE) \
+ ({ RELEASE (VAR); VAR = VALUE; RETAIN (VAR); })
+
+#define ASSIGN_COPY(VAR, VALUE) \
+ ({ RELEASE (VAR); VAR = [VALUE copy]; RETAIN (VAR); })
+
+#define AUTORELEASE(VALUE) \
+ [VALUE autorelease]
+
+#define DESTROY(VAR) \
+ ({ RELEASE (VAR); VAR = nil; })
+
+#define RELEASE(VALUE) \
+ [VALUE release]
+
+#define RETAIN(VALUE) \
+ [VALUE retain]
+
+#endif // !AUTORELEASE