Skip to content

Commit

Permalink
Don't include objc headers in exception.m
Browse files Browse the repository at this point in the history
To fix cross compile issues (and also, it's faster to call objc_retain directly instead of using a selector)
  • Loading branch information
madsmtm committed Jun 1, 2021
1 parent c86ad3a commit 3d9ebc5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions extern/exception.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <objc/objc.h>
#include <objc/NSObject.h>
// Available from `objc`
id objc_retain(id value);

void RustObjCExceptionThrow(id exception) {
@throw exception;
Expand All @@ -9,12 +9,12 @@ int RustObjCExceptionTryCatch(void (*try)(void *), void *context, id *error) {
@try {
try(context);
if (error) {
*error = nil;
*error = (id)0; // nil
}
return 0;
} @catch (id exception) {
if (error) {
*error = [exception retain];
*error = objc_retain(exception);
}
return 1;
}
Expand Down

0 comments on commit 3d9ebc5

Please sign in to comment.