开发者

CFRelease vs CGPathRelease

The following is a snippet of code from the Omni frameworks:

CGMutablePathRef开发者_运维百科 path = CGPathCreateMutable();
CGPathAddRect(path, NULL/*transform*/, rect);
self->_path = CGPathCreateCopy(path);
CFRelease(path);

Why is CFRelease used here instead of CGPathRelease? Are they the same, and if so, why does the latter exist?


From the documentation for CGPathRelease:

This function is equivalent to CFRelease, except that it does not cause an error if the path parameter is NULL.

In addition to not failing on NULL values, you also get a little bit of compile-time type-safety as the parameter is typed as CGPathRef rather than CFTypeRef (which is equivalent to void *).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜