Summary: The diff is very big but it's mostly removing code. It was inspired by the fact that we were getting Dead Store FPs because we were modeling some functions from CoreFoundation and CoreGraphics directly as alloc in the frontend, which caused the parameters of the function to be seen as dead. See the new test. To deal with this, if we are going to skip the function, we model it as malloc instead. Given how many models we had for those "model as malloc" functions, I removed them to rely solely on the new mechanism. The modeling of malloc and release was still based on the old retain count implementation, even though all we do here is a malloc/free kind of analysis. I also changed that to be actually malloc/free which removed many Assert false in the tests. CFRelease is not exactly free though, and it's possible to use the variable afterwards. So used a custom free builtin that only cares about removing the Memory attribute and focuses on minimizing Memory Leaks FPs. Otherwise we were translating CFBridgingRelease as a special cast, and this wasn't working. To simplify this as well, I removed all the code for the special cast, and just modeled CFBridgingRelease and CFAutorelease also as free_cf, to avoid Memory Leak false positives. I also treated the cast __bridge_transfer as a free_cf model. This means we stopped trying to report Memory Leaks on those objects. The modeling of CoreGraph release functions was done in the frontend, but seemed simpler to also simplify that code and model all the relevant functions. Reviewed By: sblackshear Differential Revision: D6397150 fbshipit-source-id: b1dc636master
parent
5588f5e1ea
commit
68beca1523
@ -1,12 +1,11 @@
|
||||
/*
|
||||
* Copyright (c) 2015 - present Facebook, Inc.
|
||||
* Copyright (c) 2017 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
CFTypeRef CFMakeCollectable(CFTypeRef cf) { return cf; }
|
||||
void CFRelease(CFTypeRef item) { __free_cf(item); }
|
@ -1,55 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
#import <AddressBook/AddressBook.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
CFArrayRef __cf_alloc(CFArrayRef);
|
||||
CFArrayRef __cf_non_null_alloc(CFArrayRef);
|
||||
|
||||
CFArrayRef CFArrayCreate(CFAllocatorRef allocator,
|
||||
const void** values,
|
||||
CFIndex numValues,
|
||||
const CFArrayCallBacks* callBacks) {
|
||||
CFArrayRef c;
|
||||
return __cf_alloc(c);
|
||||
}
|
||||
|
||||
CFArrayRef CFNetworkCopyProxiesForURL(CFURLRef url,
|
||||
CFDictionaryRef proxySettings) {
|
||||
CFArrayRef c;
|
||||
return __cf_alloc(c);
|
||||
}
|
||||
|
||||
CFArrayRef CFStringCreateArrayWithFindResults(
|
||||
CFAllocatorRef alloc,
|
||||
CFStringRef theString,
|
||||
CFStringRef stringToFind,
|
||||
CFRange rangeToSearch,
|
||||
CFStringCompareFlags compareOptions) {
|
||||
CFArrayRef c;
|
||||
return __cf_alloc(c);
|
||||
}
|
||||
|
||||
CFArrayRef CFPreferencesCopyKeyList(CFStringRef applicationID,
|
||||
CFStringRef userName,
|
||||
CFStringRef hostName) {
|
||||
CFArrayRef c;
|
||||
return __cf_non_null_alloc(c);
|
||||
}
|
||||
|
||||
CFArrayRef CNCopySupportedInterfaces(void) {
|
||||
CFArrayRef c;
|
||||
return __cf_non_null_alloc(c);
|
||||
}
|
||||
|
||||
CFArrayRef ABAddressBookCopyArrayOfAllPeople(ABAddressBookRef addressBook) {
|
||||
CFArrayRef c;
|
||||
return __cf_non_null_alloc(c);
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
CFBinaryHeapRef __cf_alloc(CFBinaryHeapRef);
|
||||
|
||||
CFBinaryHeapRef CFBinaryHeapCreate(
|
||||
CFAllocatorRef allocator,
|
||||
CFIndex capacity,
|
||||
const CFBinaryHeapCallBacks* callBacks,
|
||||
const CFBinaryHeapCompareContext* compareContext) {
|
||||
CFBinaryHeapRef c;
|
||||
return __cf_alloc(c);
|
||||
}
|
@ -1,50 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
#import <CoreMedia/CoreMedia.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <ImageIO/ImageIO.h>
|
||||
|
||||
CFDictionaryRef __cf_non_null_alloc(CFDictionaryRef);
|
||||
|
||||
CFDictionaryRef __cf_alloc(CFDictionaryRef);
|
||||
|
||||
CFDictionaryRef CFDictionaryCreate(
|
||||
CFAllocatorRef allocator,
|
||||
const void** keys,
|
||||
const void** values,
|
||||
CFIndex numValues,
|
||||
const CFDictionaryKeyCallBacks* keyCallBacks,
|
||||
const CFDictionaryValueCallBacks* valueCallBacks) {
|
||||
CFDictionaryRef c;
|
||||
return __cf_alloc(c);
|
||||
}
|
||||
|
||||
CFDictionaryRef CFDictionaryCreateCopy(CFAllocatorRef allocator,
|
||||
CFDictionaryRef theDict) {
|
||||
CFDictionaryRef c;
|
||||
return __cf_alloc(c);
|
||||
}
|
||||
|
||||
CFDictionaryRef CMCopyDictionaryOfAttachments(CFAllocatorRef allocator,
|
||||
CMAttachmentBearerRef target,
|
||||
CMAttachmentMode attachmentMode) {
|
||||
CFDictionaryRef c;
|
||||
return __cf_alloc(c);
|
||||
}
|
||||
|
||||
CFDictionaryRef CFHTTPMessageCopyAllHeaderFields(CFHTTPMessageRef message) {
|
||||
CFDictionaryRef c;
|
||||
return __cf_alloc(c);
|
||||
}
|
||||
|
||||
CFDictionaryRef CMTimeCopyAsDictionary(CMTime time, CFAllocatorRef allocator) {
|
||||
CFDictionaryRef c;
|
||||
return __cf_alloc(c);
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
CFErrorRef __cf_alloc(CFErrorRef);
|
||||
CFErrorRef __cf_non_null_alloc(CFErrorRef);
|
||||
|
||||
CFErrorRef CFReadStreamCopyError(CFReadStreamRef stream) {
|
||||
CFErrorRef c;
|
||||
return __cf_alloc(c);
|
||||
}
|
||||
|
||||
CFErrorRef CFWriteStreamCopyError(CFWriteStreamRef stream) {
|
||||
CFErrorRef c;
|
||||
return __cf_alloc(c);
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
CFHTTPMessageRef __cf_alloc(CFHTTPMessageRef);
|
||||
|
||||
CFHTTPMessageRef CFHTTPMessageCreateCopy(CFAllocatorRef alloc,
|
||||
CFHTTPMessageRef message) {
|
||||
CFHTTPMessageRef c;
|
||||
return __cf_alloc(c);
|
||||
}
|
||||
|
||||
CFHTTPMessageRef CFHTTPMessageCreateEmpty(CFAllocatorRef alloc,
|
||||
Boolean isRequest) {
|
||||
CFHTTPMessageRef c;
|
||||
return __cf_alloc(c);
|
||||
}
|
||||
|
||||
CFHTTPMessageRef CFHTTPMessageCreateRequest(CFAllocatorRef alloc,
|
||||
CFStringRef requestMethod,
|
||||
CFURLRef url,
|
||||
CFStringRef httpVersion) {
|
||||
CFHTTPMessageRef c;
|
||||
return __cf_alloc(c);
|
||||
}
|
||||
|
||||
CFHTTPMessageRef CFHTTPMessageCreateResponse(CFAllocatorRef alloc,
|
||||
CFIndex statusCode,
|
||||
CFStringRef statusDescription,
|
||||
CFStringRef httpVersion) {
|
||||
CFHTTPMessageRef c;
|
||||
return __cf_alloc(c);
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
CFLocaleRef __cf_alloc(CFLocaleRef);
|
||||
CFLocaleRef __cf_non_null_alloc(CFLocaleRef);
|
||||
|
||||
CFLocaleRef CFLocaleCreate(CFAllocatorRef allocator,
|
||||
CFStringRef localeIdentifier) {
|
||||
CFLocaleRef c;
|
||||
return __cf_alloc(c);
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
CFMutableArrayRef __cf_alloc(CFMutableArrayRef);
|
||||
CFMutableArrayRef __cf_non_null_alloc(CFMutableArrayRef);
|
||||
|
||||
CFMutableArrayRef CFArrayCreateMutable(CFAllocatorRef allocator,
|
||||
CFIndex capacity,
|
||||
const CFArrayCallBacks* callBacks) {
|
||||
CFMutableArrayRef c;
|
||||
return __cf_alloc(c);
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
#import <CoreMedia/CoreMedia.h>
|
||||
#import <ImageIO/ImageIO.h>
|
||||
|
||||
CFMutableDictionaryRef __cf_non_null_alloc(CFMutableDictionaryRef);
|
||||
|
||||
CFMutableDictionaryRef __cf_alloc(CFMutableDictionaryRef);
|
||||
|
||||
CFMutableDictionaryRef CFDictionaryCreateMutable(
|
||||
CFAllocatorRef allocator,
|
||||
CFIndex capacity,
|
||||
const CFDictionaryKeyCallBacks* keyCallBacks,
|
||||
const CFDictionaryValueCallBacks* valueCallBacks) {
|
||||
|
||||
CFMutableDictionaryRef c;
|
||||
return __cf_alloc(c);
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
CFMutableSetRef __cf_alloc(CFMutableSetRef);
|
||||
CFMutableSetRef __cf_non_null_alloc(CFMutableSetRef);
|
||||
|
||||
CFMutableSetRef CFSetCreateMutable(CFAllocatorRef allocator,
|
||||
CFIndex capacity,
|
||||
const CFSetCallBacks* callBacks) {
|
||||
CFMutableSetRef c;
|
||||
return __cf_alloc(c);
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
CFNumberRef __cf_alloc(CFNumberRef);
|
||||
|
||||
CFNumberRef CFNumberCreate(CFAllocatorRef allocator,
|
||||
CFNumberType theType,
|
||||
const void* valuePtr) {
|
||||
CFNumberRef c;
|
||||
return __cf_alloc(c);
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
CFSocketRef __cf_alloc(CFSocketRef);
|
||||
|
||||
CFSocketRef CFSocketCreate(CFAllocatorRef allocator,
|
||||
SInt32 protocolFamily,
|
||||
SInt32 socketType,
|
||||
SInt32 protocol,
|
||||
CFOptionFlags callBackTypes,
|
||||
CFSocketCallBack callout,
|
||||
const CFSocketContext* context) {
|
||||
CFSocketRef c;
|
||||
return __cf_alloc(c);
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <stdlib.h>
|
||||
|
||||
CFStringRef __cf_alloc(CFStringRef);
|
||||
|
||||
void __get_array_length(const UInt8*);
|
||||
|
||||
CFStringRef CFStringCreateWithBytesNoCopy(CFAllocatorRef alloc,
|
||||
const UInt8* bytes,
|
||||
CFIndex numBytes,
|
||||
CFStringEncoding encoding,
|
||||
Boolean isExternalRepresentation,
|
||||
CFAllocatorRef contentsDeallocator) {
|
||||
CFStringRef c;
|
||||
CFStringRef s = __cf_alloc(c);
|
||||
if (s) {
|
||||
if (bytes) {
|
||||
__get_array_length(bytes);
|
||||
free(bytes);
|
||||
}
|
||||
}
|
||||
return s;
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
#import <CoreText/CTFont.h>
|
||||
|
||||
CTFontRef __cf_alloc(CTFontRef);
|
||||
|
||||
CTFontRef CTFontCreateWithName(CFStringRef name,
|
||||
CGFloat size,
|
||||
const CGAffineTransform* matrix) {
|
||||
CTFontRef c;
|
||||
return __cf_alloc(c);
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
#import <CoreText/CTFramesetter.h>
|
||||
|
||||
CTFramesetterRef __cf_alloc(CTFramesetterRef);
|
||||
|
||||
CTFramesetterRef CTFramesetterCreateWithAttributedString(
|
||||
CFAttributedStringRef string) {
|
||||
CTFramesetterRef c;
|
||||
return __cf_alloc(c);
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
#import <CoreText/CoreText.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
CTParagraphStyleRef __cf_alloc(CTParagraphStyleRef);
|
||||
CTParagraphStyleRef __cf_non_null_alloc(CTParagraphStyleRef);
|
||||
|
||||
CTParagraphStyleRef CTParagraphStyleCreate(
|
||||
const CTParagraphStyleSetting* settings, size_t settingCount) {
|
||||
CTParagraphStyleRef c;
|
||||
return __cf_alloc(c);
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
#import <Security/Security.h>
|
||||
|
||||
SecCertificateRef __cf_alloc(SecCertificateRef);
|
||||
|
||||
SecCertificateRef __cf_non_null_alloc(SecCertificateRef);
|
||||
|
||||
SecCertificateRef SecCertificateCreateWithData(CFAllocatorRef allocator,
|
||||
CFDataRef data) {
|
||||
SecCertificateRef c;
|
||||
return __cf_alloc(c);
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
#import <Security/SecKey.h>
|
||||
#import <Security/SecTrust.h>
|
||||
|
||||
SecKeyRef __cf_alloc(SecKeyRef);
|
||||
|
||||
SecPolicyRef __cf_non_null_alloc(SecPolicyRef);
|
||||
|
||||
SecKeyRef SecTrustCopyPublicKey(SecTrustRef trust) {
|
||||
SecKeyRef c;
|
||||
return __cf_alloc(c);
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Copyright (c) 2017 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
void __free_cf(void* item);
|
||||
|
||||
void* CFAutorelease(void* item) { __free_cf(item); }
|
||||
|
||||
void* CFBridgingRelease(void* item) { __free_cf(item); }
|
||||
|
||||
void CGAffineTransformRelease(void* item) { __free_cf(item); }
|
||||
|
||||
void CGBaseRelease(void* item) { __free_cf(item); }
|
||||
|
||||
void CGBitmapContextRelease(void* item) { __free_cf(item); }
|
||||
|
||||
void CGColorRelease(void* item) { __free_cf(item); }
|
||||
|
||||
void CGColorSpaceRelease(void* item) { __free_cf(item); }
|
||||
|
||||
void CGContextRelease(void* item) { __free_cf(item); }
|
||||
|
||||
void CGDataConsumerRelease(void* item) { __free_cf(item); }
|
||||
|
||||
void CGDataProviderRelease(void* item) { __free_cf(item); }
|
||||
|
||||
void CGErrorRelease(void* item) { __free_cf(item); }
|
||||
|
||||
void CGFontRelease(void* item) { __free_cf(item); }
|
||||
|
||||
void CGFunctionRelease(void* item) { __free_cf(item); }
|
||||
|
||||
void CGGeometryRelease(void* item) { __free_cf(item); }
|
||||
|
||||
void CGGradientRelease(void* item) { __free_cf(item); }
|
||||
|
||||
void CGImageRelease(void* item) { __free_cf(item); }
|
||||
|
||||
void CGLayerRelease(void* item) { __free_cf(item); }
|
||||
|
||||
void CGPathRelease(void* item) { __free_cf(item); }
|
||||
|
||||
void CGPatternRelease(void* item) { __free_cf(item); }
|
||||
|
||||
void CGPDFArrayRelease(void* item) { __free_cf(item); }
|
||||
|
||||
void CGPDFContentStreamRelease(void* item) { __free_cf(item); }
|
||||
|
||||
void CGPDFContextRelease(void* item) { __free_cf(item); }
|
||||
|
||||
void CGPDFDictionaryRelease(void* item) { __free_cf(item); }
|
||||
|
||||
void CGPDFDocumentRelease(void* item) { __free_cf(item); }
|
||||
|
||||
void CGPDFObjectRelease(void* item) { __free_cf(item); }
|
||||
|
||||
void CGPDFOperatorTableRelease(void* item) { __free_cf(item); }
|
||||
|
||||
void CGPDFPageRelease(void* item) { __free_cf(item); }
|
||||
|
||||
void CGPDFScannerRelease(void* item) { __free_cf(item); }
|
||||
|
||||
void CGPDFStreamRelease(void* item) { __free_cf(item); }
|
||||
|
||||
void CGPDFStringRelease(void* item) { __free_cf(item); }
|
||||
|
||||
void CGShadingRelease(void* item) { __free_cf(item); }
|
@ -1,36 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
#import <CoreGraphics/CoreGraphics.h>
|
||||
|
||||
CGColorRef __cf_non_null_alloc(CGColorRef);
|
||||
|
||||
void __objc_release_cf(CGColorRef);
|
||||
|
||||
void CGColorRelease(CGColorRef color) {
|
||||
if (color)
|
||||
__objc_release_cf(color);
|
||||
}
|
||||
|
||||
// FB own code
|
||||
|
||||
CGColorRef FBColorCreateWithGray(CGFloat gray, CGFloat a) {
|
||||
CGColorRef c;
|
||||
return __cf_non_null_alloc(c);
|
||||
}
|
||||
|
||||
CGColorRef FBColorCreateWithRGBA(uint8_t r, uint8_t g, uint8_t b, CGFloat a) {
|
||||
CGColorRef c;
|
||||
return __cf_non_null_alloc(c);
|
||||
}
|
||||
|
||||
CGColorRef FBColorCreateWithRGB(uint8_t r, uint8_t g, uint8_t b) {
|
||||
CGColorRef c;
|
||||
return __cf_non_null_alloc(c);
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
#import <CoreGraphics/CoreGraphics.h>
|
||||
|
||||
void __objc_release_cf(CGColorSpaceRef);
|
||||
|
||||
void CGColorSpaceRelease(CGColorSpaceRef space) {
|
||||
if (space)
|
||||
__objc_release_cf(space);
|
||||
}
|
||||
|
||||
CGColorSpaceRef __cf_alloc(CGColorSpaceRef);
|
||||
|
||||
CGColorSpaceRef CGColorSpaceCreateDeviceRGB(void) {
|
||||
CGColorSpaceRef c;
|
||||
return __cf_alloc(c);
|
||||
}
|
||||
|
||||
CGColorSpaceRef CGColorSpaceCreateDeviceGray(void) {
|
||||
CGColorSpaceRef c;
|
||||
return __cf_alloc(c);
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
#import <CoreGraphics/CoreGraphics.h>
|
||||
#import <ImageIO/ImageIO.h>
|
||||
#import <QuartzCore/QuartzCore.h>
|
||||
|
||||
void __objc_release_cf(CGContextRef);
|
||||
|
||||
void CGContextRelease(CGContextRef c) {
|
||||
if (c)
|
||||
__objc_release_cf(c);
|
||||
}
|
||||
|
||||
CGContextRef __cf_alloc(CGContextRef);
|
||||
|
||||
CGContextRef CGBitmapContextCreate(void* data,
|
||||
size_t width,
|
||||
size_t height,
|
||||
size_t bitsPerComponent,
|
||||
size_t bytesPerRow,
|
||||
CGColorSpaceRef space,
|
||||
CGBitmapInfo bitmapInfo) {
|
||||
CGContextRef c;
|
||||
return __cf_alloc(c);
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
#import <CoreGraphics/CoreGraphics.h>
|
||||
|
||||
void __objc_release_cf(CGDataConsumerRef);
|
||||
|
||||
void CGDataConsumerRelease(CGDataConsumerRef consumer) {
|
||||
if (consumer)
|
||||
__objc_release_cf(consumer);
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
#import <CoreGraphics/CoreGraphics.h>
|
||||
|
||||
void __objc_release_cf(CGDataProviderRef);
|
||||
|
||||
void CGDataProviderRelease(CGDataProviderRef provider) {
|
||||
if (provider)
|
||||
__objc_release_cf(provider);
|
||||
}
|
||||
|
||||
CGDataProviderRef __cf_alloc(CGDataProviderRef);
|
||||
|
||||
CGDataProviderRef __cf_non_null_alloc(CGDataProviderRef);
|
||||
|
||||
CGDataProviderRef CGDataProviderCreateWithURL(CFURLRef url) {
|
||||
CGDataProviderRef c;
|
||||
return __cf_alloc(c);
|
||||
}
|
||||
|
@ -1,24 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
#import <CoreGraphics/CoreGraphics.h>
|
||||
|
||||
void __objc_release_cf(CGFontRef);
|
||||
|
||||
CGFontRef __cf_alloc(CGFontRef);
|
||||
|
||||
void CGFontRelease(CGFontRef font) {
|
||||
if (font)
|
||||
__objc_release_cf(font);
|
||||
}
|
||||
|
||||
CGFontRef CGFontCreateWithDataProvider(CGDataProviderRef provider) {
|
||||
CGFontRef c;
|
||||
return __cf_alloc(c);
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
#import <CoreGraphics/CoreGraphics.h>
|
||||
|
||||
void __objc_release_cf(CGFunctionRef);
|
||||
|
||||
void CGFunctionRelease(CGFunctionRef function) {
|
||||
if (function)
|
||||
__objc_release_cf(function);
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
#import <CoreGraphics/CoreGraphics.h>
|
||||
|
||||
void __objc_release_cf(CGGradientRef);
|
||||
|
||||
void CGGradientRelease(CGGradientRef gradient) {
|
||||
if (gradient)
|
||||
__objc_release_cf(gradient);
|
||||
}
|
||||
|
||||
CGGradientRef __cf_non_null_alloc(CGGradientRef);
|
@ -1,30 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
#import <CoreGraphics/CoreGraphics.h>
|
||||
#import <ImageIO/ImageIO.h>
|
||||
|
||||
CGImageRef __cf_non_null_alloc(CGImageRef);
|
||||
CGImageRef __cf_alloc(CGImageRef);
|
||||
void __objc_release_cf(CGImageRef);
|
||||
|
||||
void CGImageRelease(CGImageRef image) {
|
||||
if (image)
|
||||
__objc_release_cf(image);
|
||||
}
|
||||
|
||||
CGImageRef CGBitmapContextCreateImage(CGContextRef context) {
|
||||
CGImageRef c;
|
||||
return __cf_alloc(c);
|
||||
}
|
||||
|
||||
CGImageRef CGImageCreateWithImageInRect(CGImageRef image, CGRect rect) {
|
||||
CGImageRef c;
|
||||
return __cf_alloc(c);
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
#import <CoreGraphics/CoreGraphics.h>
|
||||
#import <ImageIO/ImageIO.h>
|
||||
|
||||
CGImageSourceRef __cf_non_null_alloc(CGImageSourceRef);
|
||||
CGImageSourceRef __cf_alloc(CGImageSourceRef);
|
||||
void __objc_release_cf(CGImageSourceRef);
|
||||
|
||||
CGImageSourceRef CGImageSourceCreateWithURL(CFURLRef url,
|
||||
CFDictionaryRef options) {
|
||||
CGImageSourceRef c;
|
||||
return __cf_alloc(c);
|
||||
}
|
||||
|
||||
|
||||
void CGImageSourceRelease(CGImageSourceRef image) {
|
||||
if (image)
|
||||
__objc_release_cf(image);
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
#import <CoreGraphics/CoreGraphics.h>
|
||||
|
||||
void __objc_release_cf(CGLayerRef);
|
||||
|
||||
void CGLayerRelease(CGLayerRef layer) {
|
||||
if (layer)
|
||||
__objc_release_cf(layer);
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
#import <CoreGraphics/CoreGraphics.h>
|
||||
|
||||
void __objc_release_cf(CGPDFContentStreamRef);
|
||||
|
||||
void CGPDFContentStreamRelease(CGPDFContentStreamRef cs) {
|
||||
if (cs)
|
||||
__objc_release_cf(cs);
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
#import <CoreGraphics/CoreGraphics.h>
|
||||
|
||||
void __objc_release_cf(CGPDFDocumentRef);
|
||||
|
||||
void CGPDFDocumentRelease(CGPDFDocumentRef document) {
|
||||
if (document)
|
||||
__objc_release_cf(document);
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
#import <CoreGraphics/CoreGraphics.h>
|
||||
|
||||
void __objc_release_cf(CGPDFOperatorTableRef);
|
||||
|
||||
void CGPDFOperatorTableRelease(CGPDFOperatorTableRef table) {
|
||||
if (table)
|
||||
__objc_release_cf(table);
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
#import <CoreGraphics/CoreGraphics.h>
|
||||
|
||||
void __objc_release_cf(CGPDFPageRef);
|
||||
|
||||
void CGPDFPageRelease(CGPDFPageRef page) {
|
||||
if (page)
|
||||
__objc_release_cf(page);
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
#import <CoreGraphics/CoreGraphics.h>
|
||||
|
||||
void __objc_release_cf(CGPDFScannerRef);
|
||||
|
||||
void CGPDFScannerRelease(CGPDFScannerRef scanner) {
|
||||
if (scanner)
|
||||
__objc_release_cf(scanner);
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
#import <CoreGraphics/CoreGraphics.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
CGPathRef __cf_non_null_alloc(CGPathRef);
|
||||
void __objc_release_cf(CGPathRef);
|
||||
|
||||
void CGPathRelease(CGPathRef path) {
|
||||
if (path)
|
||||
__objc_release_cf(path);
|
||||
}
|
||||
|
@ -1,17 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
#import <CoreGraphics/CoreGraphics.h>
|
||||
|
||||
void __objc_release_cf(CGPatternRef);
|
||||
|
||||
void CGPatternRelease(CGPatternRef pattern) {
|
||||
if (pattern)
|
||||
__objc_release_cf(pattern);
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
#import <CoreGraphics/CoreGraphics.h>
|
||||
|
||||
void __objc_release_cf(CGShadingRef);
|
||||
|
||||
void CGShadingRelease(CGShadingRef shading) {
|
||||
if (shading)
|
||||
__objc_release_cf(shading);
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Copyright (c) 2017 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
static NSDictionary* dictionaryRepresentationFromCFPreferences(
|
||||
NSString* preferencesID) {
|
||||
CFStringRef ID = (__bridge CFStringRef)preferencesID;
|
||||
return (__bridge_transfer NSDictionary*)CFPreferencesCopyMultiple(
|
||||
NULL, ID, kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
|
||||
}
|
Loading…
Reference in new issue