summaryrefslogtreecommitdiff
path: root/runtime-compatibility.h
diff options
context:
space:
mode:
authorMatthias Benkard <mulk@minimulk.mst-plus>2008-06-21 13:57:44 +0200
committerMatthias Benkard <mulk@minimulk.mst-plus>2008-06-21 13:57:44 +0200
commitf096436acc4c0c6968c88ca0f795bf021c83c670 (patch)
tree3b6afb19120956deb6d352a3f6807b2db8b3134b /runtime-compatibility.h
parent85762b55bf85437e981ebbf162e9af2255236330 (diff)
Add support for compilation on Mac OS X.
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