Re: [PATCH 7/9] strbuf_getwholeline: use getdelim if it is available
From: Jeff King <hidden>
Date: 2016-06-15 23:04:42
On Fri, May 08, 2015 at 07:56:28PM -0400, Eric Sunshine wrote:
I spent some time downloading old Xcode releases and poking through the packages. Xcode 3.2.x seems to be the last in the Xcode 3 series, and none of the Xcode 3.2.x versions I examined carried getdelim(). The first package in which I found getdelim() was Xcode 4.1. (Unfortunately, Apple doesn't seem to make Xcode 4.0 available for download anymore or it's only available to paying developers, so I couldn't check it.) According to Wikipedia[1], Xcode 4.1 was released the same day as Lion (OS X 10.7 [2]), but was also available to paying developers for Snow Leopard (OS X 10.6). Consequently, I think it's safe to say that getdelim() is available for Lion (10.7) and later. If we don't mind being a bit less conservative, then we might assume that it also is available for Snow Leopard (10.6), which it definitely supported, but perhaps that's too risky, since not everyone would have been a paid subscriber.
Thanks for digging. I'd argue for the conservative choice, simply because this is a pure optimization. The old code should work just fine, and people have been living with it for years. I doubt it will affect many people either way, though. Lion is 4 years old, and most OS X people seem to upgrade fairly regularly. It is not like long-term server systems where we are supporting Solaris 7. :) Want to roll a patch?
Alternately, we could make the test more dynamic and accurate by grepping stdio.h for 'getdelim' or just by trying a test compile, though that's probably too expensive.
The natural place would be in configure.ac, and that is orthogonal to the default Darwin setting, I think. -Peff