Re: [PATCH] index-pack usage of mmap() is unacceptably slower on many OSes other than Linux
- From
Linus Torvalds <torvalds@osdl.org>
- Date
- Dec 20, 2006, 20:53 UTC
- Message-ID
- <Pine.LNX.4.64.0612201243490.3576@woody.osdl.org>
- In-Reply-To
- <7vbqlye2zz.fsf@assigned-by-dhcp.cox.net>
On Wed, 20 Dec 2006, Junio C Hamano wrote:
Show 5 quoted lines
> > I needed to fix the changes to git-compat-util.h a bit from the > version I sent earlier to make OpenBSD happy (sys/types.h there > did not expose u_int unless _BSD_SOURCE was set, and > netinet/in.h was duplicated by mistake).
Please don't use "u_int" in the first place. It's an abomination of a type. It should never be used.
There's simply no point. It's "unsigned int", and that doesn't need any header files at all.
I don't understand why people are lazy, and can't write "unsigned", but then introduce a type that requires you to have all kinds of magic. The lazyness just results in more work, and is totally nonportable.
So "u_int" (along with its idiotic brethren "u_long", "u_short" and "u_char") is just silly.
The only user in git seems to have been copied from a source that is insane. It does
u_int words[NS_IN6ADDRSZ / NS_INT16SZ];
which is just insane. It actually seems to want to use "uint16_t", which at least would make sense, and be a type that has some _point_ to it.
So please change the "u_int" to either "unsigned int" or "uint16_t". Either is better.