Make Description Functions Dealloc-Safe (#2241)

* Make description functions dealloc-safe

* Make -debugDescription also dealloc-safe
This commit is contained in:
Adlai Holler
2016-09-13 17:48:31 -07:00
committed by GitHub
parent 84e633137b
commit 337e908390
3 changed files with 20 additions and 9 deletions

View File

@@ -36,11 +36,21 @@ NS_ASSUME_NONNULL_BEGIN
ASDISPLAYNODE_EXTERN_C_BEGIN
/// Returns e.g. <MYObject: 0xFFFFFFFF; name = "Object Name"; frame = (0 0; 50 50)>
NSString *ASObjectDescriptionMake(id object, NSArray<NSDictionary *> * _Nullable propertyGroups);
/**
* Returns e.g. <MYObject: 0xFFFFFFFF; name = "Object Name"; frame = (0 0; 50 50)>
*
* Note: `object` param is autoreleasing so that this function is dealloc-safe.
* No, unsafe_unretained isn't acceptable here the optimizer may deallocate object early.
*/
NSString *ASObjectDescriptionMake(__autoreleasing id object, NSArray<NSDictionary *> * _Nullable propertyGroups);
/// Returns e.g. <MYObject: 0xFFFFFFFF>
NSString *ASObjectDescriptionMakeTiny(id object);
/**
* Returns e.g. <MYObject: 0xFFFFFFFF>
*
* Note: `object` param is autoreleasing so that this function is dealloc-safe.
* No, unsafe_unretained isn't acceptable here the optimizer may deallocate object early.
*/
NSString *ASObjectDescriptionMakeTiny(__autoreleasing id object);
NSString * _Nullable ASStringWithQuotesIfMultiword(NSString * _Nullable string);