Re: [PATCH] Remove useless if-before-free tests.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Sun, 17 Feb 2008, Jim Meyering wrote:

> It is equivalent not just because POSIX has required free(NULL) to work 
> for a long time, but simply because it has worked for so long that no 
> reasonable porting target fails the test. Here's some evidence from 
> nearly 1.5 years ago:
> 
>     http://www.winehq.org/pipermail/wine-patches/2006-October/031544.html

>From this mail, we see that there is at least one target where this leads 
to a crash (remember, git should run on more platforms than Wine).

However, such a crash is pretty obvious in our test-suite, I guess, and 
thus we could easily introduce something like this into git-compat-util.h 
should the need ever arise:

#ifdef FREE_NULL_CRASHES
inline void gitfree(void *ptr)
{
	if (ptr)
		free(ptr);
}
#define free gitfree
#endif

IOW I like that type of cleanup.

FWIW I tested MinGW (which is the only system I have access to that I 
suspect of misbehaving), and it groks free(NULL) just fine.

Ciao,
Dscho

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux