Re: [PATCH] block-sha1: Windows declares ntohl() in winsock2.h
- From
Nicolas Pitre <nico@cam.org>
- Date
- Aug 18, 2009, 18:01 UTC
- Message-ID
- <alpine.LFD.2.00.0908181357330.6044@xanadu.home>
- In-Reply-To
- <7v1vn9f4mz.fsf@alter.siamese.dyndns.org>
On Tue, 18 Aug 2009, Junio C Hamano wrote:
Show 16 quoted lines
> Nicolas Pitre <nico@cam.org> writes: > > > On Tue, 18 Aug 2009, Nicolas Pitre wrote: > > > >> Well... Given that git already uses ntohl/htonl quite extensively in > >> its core already, I'd suggest making this more globally available > >> instead. > > > > What about something like this? > > For git's own use, I would be much happier with this change. > > But given that there are some people wanting to snarf block-sha1/*.[ch] > out to use them standalone, I have a slight hesitation against introducing > the dependency to git-compat-util.h, making it unclear to them that all > this file wants from outside are ntohl, htonl and memcpy.
Should we really care to keep our code suboptimal just to make it readily reusable by other projects? That seems a bit backward to me.
We might simply add a comment telling people what git-compat-util.h is actually for, namely memcpy(), ntohl() and htonl(). That should be trivial for them to use the appropriate substitute.
Nicolas