<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Dec 26, 2015, at 12:31 PM, Joe Groff <<a href="mailto:jgroff@apple.com" class="">jgroff@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" class=""><div class=""><br class="Apple-interchange-newline">On Dec 25, 2015, at 9:02 PM, Philippe Hausler <<a href="mailto:phausler@apple.com" class="">phausler@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""><pre class="" style="white-space: pre-wrap; background-color: rgb(255, 255, 255);">><i class=""> On Dec 22, 2015, at 1:08 PM, Joe Groff via swift-dev <<a href="https://lists.swift.org/mailman/listinfo/swift-dev" class="">swift-dev at swift.org</a>> wrote:
</i>><i class="">
</i>><i class=""> It looks like the corelibs implementation of CoreFoundation references swift_retainCount in order to implement CFGetRetainCount. Is getting the retain count necessary to CF functionality, or can these functions be removed?</i></pre></div><div class=""><br class=""></div>For some reason I was not on this list;<div class="">So in response to your query about CF’s usage of CFGetRetainCount - I think we can safely forbid that function in the swift version since there is no safe way to use it (even CFMachPort is a bit dodgy for it’s usage).</div><div class=""><br class=""></div><div class="">It might take some surgery but I can probably excise that fairly simply.</div></div></div></blockquote></div><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">That'd be awesome. Thanks Philippe! For CFMachPort's usage, since it's checking for a retainCount of 1, maybe we could use swift_isUniquelyReferenced* instead, which we do need to reliably support for COW.</div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br class=""></div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">-Joe</div></div></blockquote></div><br class=""><div class="">Actually the method that was being used there is not even compiled on mac targets, I was able to safely excise the usage and disallow the function in the Swift version of CF. </div><div class=""><br class=""></div><div class="">I pushed this:</div><div class=""><a href="https://github.com/apple/swift-corelibs-foundation/commit/d430c06fe417e285c5b120ccbf1d1082807e3b5c" class="">https://github.com/apple/swift-corelibs-foundation/commit/d430c06fe417e285c5b120ccbf1d1082807e3b5c</a></div><div class=""><br class=""></div><div class="">Which should no longer swift_retainCount in swift-corelibs-foundation builds anymore.</div></body></html>