A patch for malloc typo
H . J . Lu
hjl@lucon.org
Sun Sep 24 12:09:00 GMT 2000
On Sun, Sep 24, 2000 at 12:00:55PM -0700, Ulrich Drepper wrote:
> "H . J . Lu" <hjl@valinux.com> writes:
>
> > This patch should have no impact on generated binaries. It just makes
> > the code less confusing.
>
> How can this have no impact? All programs which use the memalign hook
> will break since the documented order in which size and alignment are
> passed is changed. Admittedly I don't expect many programs to use
> this feature but cleanup is no reason to break something.
>
That is exactly what I meant by "less confusing". You are mislead by
the prototype. Check out how __memalign_hook is used in malloc. Please
remember user doesn't call __memalign_hook () directly. He/she only
defines __memalign_hook (). mEMALIGn () in malloc.c does:
if (__memalign_hook != NULL) {
...
result = (*__memalign_hook)(alignment, bytes, ...);
}
It doesn't matter what the prototype says.
H.J.
More information about the Libc-hacker
mailing list