-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
stub out the necessary weak functions
git-svn-id: https://src.office.plausiblelabs.com/repo/PLWeakCompatibility/trunk@3 0b19fab4-3b79-e111-ab8d-001cc008e099
- Loading branch information
mikeash
committed
Mar 29, 2012
1 parent
8a3a904
commit 0371d9e
Showing
5 changed files
with
101 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
*.xcworkspace | ||
xcuserdata | ||
build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// | ||
// PLWeakCompatibilityStubs.h | ||
// PLWeakCompatibility | ||
// | ||
// Created by Michael Ash on 3/28/12. | ||
// Copyright (c) 2012 __MyCompanyName__. All rights reserved. | ||
// | ||
|
||
|
||
// Convince ARC to leave these kids alone | ||
typedef void *VoidPtr; | ||
#define id VoidPtr | ||
|
||
id objc_loadWeakRetained(id *location); | ||
id objc_initWeak(id *addr, id val); | ||
void objc_destroyWeak(id *addr); | ||
void objc_copyWeak(id *to, id *from); | ||
void objc_moveWeak(id *to, id *from); | ||
id objc_loadWeak(id *location); | ||
id objc_storeWeak(id *location, id obj); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// | ||
// PLWeakCompatibilityStubs.m | ||
// PLWeakCompatibility | ||
// | ||
// Created by Michael Ash on 3/28/12. | ||
// Copyright (c) 2012 __MyCompanyName__. All rights reserved. | ||
// | ||
|
||
#import "PLWeakCompatibilityStubs.h" | ||
|
||
id objc_autorelease(id obj); | ||
|
||
id objc_loadWeakRetained(id *location) | ||
{ | ||
// TODO: this is a primitive method | ||
return NULL; | ||
} | ||
|
||
id objc_initWeak(id *addr, id val) | ||
{ | ||
*addr = NULL; | ||
return objc_storeWeak(addr, val); | ||
} | ||
|
||
void objc_destroyWeak(id *addr) | ||
{ | ||
objc_storeWeak(addr, NULL); | ||
} | ||
|
||
void objc_copyWeak(id *to, id *from) | ||
{ | ||
objc_initWeak(to, objc_loadWeak(from)); | ||
} | ||
|
||
void objc_moveWeak(id *to, id *from) | ||
{ | ||
objc_copyWeak(to, from); | ||
objc_destroyWeak(from); | ||
} | ||
|
||
id objc_loadWeak(id *location) | ||
{ | ||
return objc_autorelease(objc_loadWeakRetained(location)); | ||
} | ||
|
||
id objc_storeWeak(id *location, id obj) | ||
{ | ||
// TODO: this is a primitive method | ||
return NULL; | ||
} |