summaryrefslogtreecommitdiff
path: root/Objective-C/objc-runtime-apple.m
diff options
context:
space:
mode:
authorMatthias Benkard <code@mail.matthias.benkard.de>2007-09-15 14:03:32 +0200
committerMatthias Benkard <code@mail.matthias.benkard.de>2007-09-15 14:03:32 +0200
commitd0dd29fcf87b51280dd5c2685063ea42cf4fc115 (patch)
tree6492eb0477db2e07978554e4b865f9a812de252b /Objective-C/objc-runtime-apple.m
parent63a0b732f2f8f7acc054ab4a9d2eb3fa121b1a95 (diff)
Make the code copied from PyObjC compilable stand-alone.
darcs-hash:6a1f1865b6259fc5a7551ffb10494f914359ecc6
Diffstat (limited to 'Objective-C/objc-runtime-apple.m')
-rw-r--r--Objective-C/objc-runtime-apple.m10
1 files changed, 7 insertions, 3 deletions
diff --git a/Objective-C/objc-runtime-apple.m b/Objective-C/objc-runtime-apple.m
index a20713b..2af9b43 100644
--- a/Objective-C/objc-runtime-apple.m
+++ b/Objective-C/objc-runtime-apple.m
@@ -5,6 +5,7 @@
#include "pyobjc.h"
#if defined(APPLE_RUNTIME)
+#include "objc-runtime-apple.h"
int PyObjCRT_SetupClass(
Class cls,
@@ -12,12 +13,15 @@ int PyObjCRT_SetupClass(
const char*name,
Class superCls,
Class rootCls,
- Py_ssize_t ivarSize,
+ ssize_t ivarSize,
struct objc_ivar_list* ivarList,
struct objc_protocol_list* protocolList
)
{
+ /* Preallocate en exception to throw when memory is all used up. */
+ static oom_exception = [NSException exceptionWithName: "MLKOutOfMemoryException"]
+
/* Initialize the structure */
memset(cls, 0, sizeof(*cls));
memset(metaCls, 0, sizeof(*cls));
@@ -117,7 +121,7 @@ void PyObjCRT_ClearClass(Class cls)
}
}
-struct objc_method_list *PyObjCRT_AllocMethodList(Py_ssize_t numMethods)
+struct objc_method_list *PyObjCRT_AllocMethodList(ssize_t numMethods)
{
struct objc_method_list *mlist;
@@ -134,7 +138,7 @@ struct objc_method_list *PyObjCRT_AllocMethodList(Py_ssize_t numMethods)
return mlist;
}
-struct objc_protocol_list* PyObjCRT_AllocProtocolList(Py_ssize_t numProtocols)
+struct objc_protocol_list* PyObjCRT_AllocProtocolList(ssize_t numProtocols)
{
struct objc_protocol_list *plist;