git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] block-sha1: Windows declares ntohl() in winsock2.h

From
Nicolas Pitre <nico@cam.org>
Date
Aug 18, 2009, 19:22 UTC
Message-ID
<alpine.LFD.2.00.0908181516510.6044@xanadu.home>
In-Reply-To
<7vk511dk11.fsf@alter.siamese.dyndns.org>
On Tue, 18 Aug 2009, Junio C Hamano wrote:
Show 17 quoted lines
> Nicolas Pitre <nico@cam.org> writes:
> 
> > On Tue, 18 Aug 2009, Junio C Hamano wrote:
> >
> >> 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.
> 
> You are right; and I should give a bit more credit to their intelligence.
> The source (block-sha1/sha1.c) is short enough that they can figure this
> out for themselves even without any additional comments.

Well, I gave in and added a comment to the patch anyway, with more improvements in the case of constant values. Patch follows.

> Another issue, especially with your "openssl sha1 removal" patch, is if we
> can assume gcc everywhere.  As far as I can tell, block-sha1/sha1.c will
> be the first unconditional use of inline asm or statement expression on
> i386/amd64.  Are folks on Solaris and other platforms Ok with this?

I guess we can guard the first with ifdef(__GNUC__) which should help people with MSVC. That should take care of x86 at least.

Nicolas
Previous: Junio C HamanoNext: Nicolas Pitre
Message 17 of 34 in “block-sha1: Windows declares ntohl() in winsock2.h”
  1. block-sha1: Windows declares ntohl() in winsock2.hJohannes Sixt, Aug 18, 2009
  2. Sebastian SchuberthAug 18, 2009
  3. Junio C HamanoAug 18, 2009
  4. Sebastian SchuberthAug 18, 2009
  5. Artur SkawinaAug 18, 2009
  6. Sebastian SchuberthAug 18, 2009
  7. Junio C HamanoAug 18, 2009
  8. Linus TorvaldsAug 18, 2009
  9. Linus TorvaldsAug 18, 2009
  10. Sebastian SchuberthAug 18, 2009
  11. Junio C HamanoAug 18, 2009
  12. Nicolas PitreAug 18, 2009
  13. Nicolas PitreAug 18, 2009
  14. Junio C HamanoAug 18, 2009
  15. Nicolas PitreAug 18, 2009
  16. Junio C HamanoAug 18, 2009
  17. Nicolas PitreAug 18, 2009
  18. make sure byte swapping is optimal for gitNicolas Pitre, Aug 18, 2009
  19. block-sha1: guard gcc extensions with __GNUC__Nicolas Pitre, Aug 18, 2009
  20. Junio C HamanoAug 18, 2009
  21. Brandon CaseyAug 18, 2009
  22. Nicolas PitreAug 18, 2009
  23. Linus TorvaldsAug 18, 2009
  24. Brandon CaseyAug 18, 2009
  25. Nicolas PitreAug 20, 2009
  26. Linus TorvaldsAug 20, 2009
  27. Brandon CaseyAug 20, 2009
  28. Sebastian SchuberthAug 18, 2009
  29. Junio C HamanoAug 18, 2009
  30. Nicolas PitreAug 18, 2009
  31. Junio C HamanoAug 18, 2009
  32. Junio C HamanoAug 18, 2009
  33. Nicolas PitreAug 18, 2009
  34. Nicolas PitreAug 18, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.