On Wed, Aug 31, 2005 at 04:54:36PM +0200, Alfred M. Szmidt wrote:
> Ideally, fix the declaration of init_hook. Failing that, at least
> give a correct cast instead of kludging with void *.
>
> void (*__malloc_initialize_hook) (void) = (void (*)(void)) init_hook;
>
> This is nicer, indeed. Could someone apply the patch with this
> modification?
Uhm, did you did you read that message of mine?
<URL:http://lists.gnu.org/archive/html/bug-hurd/2005-08/msg00253.html>
For convenience, I attached the message to this mail.
Regards,
Thomas
--- Begin Message ---
Note that this is not my patch we're discussing, but as Alfred is
currently on vacations, ...
On Sun, Aug 28, 2005 at 02:51:37PM -0700, Thomas Bushnell BSG wrote:
> Thomas Schwinge <[EMAIL PROTECTED]> writes:
> >> > +void (*__malloc_initialize_hook) (void) = (void *) init_hook;
> >>
> >> Do you really need the void * cast?
>
> > The cast avoids the following warning:
> > [...]
>
> Ideally, fix the declaration of init_hook.
That's exactly where the problem lies.
Alfred seems to have created the patch using glibc's documentation as an
example, only that there is an error in that documentation:
<URL:http://www.gnu.org/software/libc/manual/html_node/Hooks-for-Malloc.html#index-g_t_005f_005fmalloc_005finitialize_005fhook-283>
#v+
/* Prototypes for __malloc_hook, __free_hook */
#include <malloc.h>
/* Prototypes for our hooks. */
static void *my_init_hook (void);
[...]
/* Override initializing hook from the C library. */
void (*__malloc_initialize_hook) (void) = my_init_hook;
static void
my_init_hook (void)
{
[...]
#v-
I'll report that in glibc's bugzilla.
So, we need the following:
#v+
static void init_hook (void);
[...]
void (*__malloc_initialize_hook) (void) = init_hook;
[...]
static void
init_hook (void) {
[...]
#v-
Can we be sure that we don't have to also hook realloc() and memalign()?
> Failing that, at least
> give a correct cast instead of kludging with void *.
>
> void (*__malloc_initialize_hook) (void) = (void (*)(void)) init_hook;
That's also what I did before having a look at glibc's documentation.
Neal, could you please fix the patch accordingly before checking it in?
Or is some testing needed? (I don't know how to do that, here.)
Regards,
> Thomas
(Recycled. ;-)
_______________________________________________
Bug-hurd mailing list
Bug-hurd@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-hurd
--- End Message ---
_______________________________________________
Bug-hurd mailing list
Bug-hurd@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-hurd