This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Reland arc cf2 (Draft for discussion)#38255
Closed
cyanglaz wants to merge 6 commits intoflutter:mainfrom
Closed
Conversation
added 3 commits
December 7, 2022 11:31
…et to ARC flutter#37049" (flutter#37219)" (flutter#37320)" This reverts commit cf22fc2.
gaaclarke
reviewed
Dec 13, 2022
| UInt32 length = [self readSize]; | ||
| NSMutableArray* array = [NSMutableArray arrayWithCapacity:length]; | ||
| UInt32 length = [codec readSize]; | ||
| CFMutableArrayRef array = CFArrayCreateMutable(kCFAllocatorDefault, length, &kCFTypeArrayCallBacks); |
Member
There was a problem hiding this comment.
If you want to minimize the diff you could say:
CFMutableArrayRef array = (__bridge CFMutableArrayRef)[NSMutableArray arrayWithCapacity:length];Then remove the CFAutorelease below.
Same thing for the dictionary below.
| _range.location += _range.length; | ||
| return data; | ||
| // return (CFDataRef)CFAutorelease((__bridge CFDataRef)data); | ||
| return (CFDataRef)CFRetain((__bridge CFDataRef)data); |
Member
There was a problem hiding this comment.
So data is already on the autorelease pool here. You should just return it directly with the bridge cast.
return (__bridge CFDataRef)data;
| - (NSString*)readUTF8 { | ||
| NSData* bytes = [self readData:[self readSize]]; | ||
| return [[NSString alloc] initWithData:bytes encoding:NSUTF8StringEncoding]; | ||
| CFDataRef bytes = (CFDataRef)[self readDataRef:[self readSize]]; |
| NSData* bytes = [self readData:[self readSize]]; | ||
| return [[NSString alloc] initWithData:bytes encoding:NSUTF8StringEncoding]; | ||
| CFDataRef bytes = (CFDataRef)[self readDataRef:[self readSize]]; | ||
| NSData *data = (NSData*)CFBridgingRelease(bytes); |
Member
There was a problem hiding this comment.
Why do you do CFBridgingRelease here instead of just using (__bridge)? bytes is already on the autorelease pool and initWithData:encoding: should retain it. There's no need to involve ARC. That's what we are trying to avoid =)
added 3 commits
December 13, 2022 11:09
Member
|
@cyanglaz can this be closed? |
This file contains hidden or 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a draft for discussion only. The result will be cooperated in #37883.