Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCH] remove unnecessary checks for NULL in zfree and zsfree



On Thu, Mar 01, 2018 at 07:45:54PM +0000, Peter Stephenson wrote:
> OK, I would be a bit surprised if there were any pre-ANSI compilers
> still in use.  Unless someone tells me they have a SunOS 4.1.1 system
> proudly sitting on their desk.

Yeah, I mean even in the C89 draft the free() function is required to
be a no-op if the pointer is NULL:

> 4.10.3.2 The free function
> 
> The free function causes the space pointed to by ptr to be deallocated,
> that is, made available for further allocation. If ptr is a null pointer,
> no action occurs. Otherwise, if the argument does not match a pointer
> earlier returned by the calloc , malloc , or realloc function, or if
> the space has been deallocated by a call to free or realloc , the
> behavior is undefined.

So I don't see any problems with this patch, personally.

The only times I have ever seen people use pre-ANSI compilers
they were only uses them on pre-ANSI programs; I don't think
anyone expects to be able to compile moderns programs with a
compiler that old.

-- 
Joey Pabalinas

Attachment: signature.asc
Description: PGP signature



Messages sorted by: Reverse Date, Date, Thread, Author