[tz] [PATCH 1/3] Assume C89.
jonathan.leffler at gmail.com
Fri Oct 12 18:05:57 UTC 2012
Resend including TZ alias...sorry about the double copy, Todd.
On Fri, Oct 12, 2012 at 9:24 AM, Todd C. Miller
<Todd.Miller at courtesan.com>wrote:
> For this bit in date.c:
> - found = select(FD_SETSIZE, &ready, (fd_set *)0, (fd_set *)0,
> + found = select(FD_SETSIZE, &ready, 0, 0, &tout);
> You probably want to use NULL, not a bare 0 for the 3rd and 4th
Assuming that there is a prototoype in scope, the 0 should be safe. There
is some justice in saying that NULL would be safer, but it is not strictly
> Also, I believe irealloc() is still needed if you are targetting
> C89 as the behavior where realloc(NULL, n) being equivalent to
> malloc(n) was standardized in C99, not C89.
Which part of C89 do you think is not equivalent?
9899:1990 (copied from Schildt's "The Annotated ANSI C Standard" — the
standard text is useful; the annotations are not).
§22.214.171.124 The realloc function
void *realloc(void *ptr, size_t size);
The realloc function changes the size of the object pointed to by ptr to
the size specified by size. The contents of the object shall be unchanged
up to the lesser of the new and old sizes. If the new size is larger, the
value of the newly allocated portion of the object is indeterminate. If
ptr is a null pointer, the realloc function behaves like the malloc
function for the specified size. Otherwise, if ptr 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 the free or realloc function,
the behaviour is undefined. If the space cannot be allocated, the object
pointed to by ptr is unchanged. If size is zero and ptr is not a null
pointer, the object it points to is freed.
The realloc function returns either a null pointer or a pointer to the
possibly moved allocated space.
That explicitly says "realloc(NULL, size)" behaves like "malloc(size)".
Jonathan Leffler <jonathan.leffler at gmail.com> #include <disclaimer.h>
Guardian of DBD::Informix - v2011.0612 - http://dbi.perl.org
"Blessed are we who can laugh at ourselves, for we shall never cease to be
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the tz