CFRelease vs CGPathRelease

Below 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 do they exist?

+3
source share
1 answer

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 values NULLthat do not lead to errors, you also get some time for the type of compilation time, since the parameter is entered as CGPathRef, rather than CFTypeRef(which is equivalent void *).

+4
source

All Articles