Fix compiler warning
Mark Kettenis
kettenis@wins.uva.nl
Fri Jul 14 13:41:00 GMT 2000
Date: Fri, 14 Jul 2000 13:29:14 -0700
From: "H . J . Lu" <hjl@lucon.org>
On Fri, Jul 14, 2000 at 10:27:32PM +0200, Mark Kettenis wrote:
> Subject says it all.
>
> Mark
>
>
> 2000-07-14 Mark Kettenis <kettenis@gnu.org>
>
> * dlfcn/dlerror.c (free_key_mem): Add cast to silence compiler
> warning.
>
>
> Index: dlfcn/dlerror.c
> ===================================================================
> RCS file: /cvs/glibc/libc/dlfcn/dlerror.c,v
> retrieving revision 1.5
> diff -u -p -r1.5 dlerror.c
> --- dlfcn/dlerror.c 2000/07/13 19:39:54 1.5
> +++ dlfcn/dlerror.c 2000/07/14 20:26:35
> @@ -159,7 +159,7 @@ free_key_mem (void *mem)
>
> if (result->errstring != NULL
> && strcmp (result->errstring, "out of memory") != 0)
> - free (result->errstring);
> + free ((char *)result->errstring);
>
Why not (void *) which is used in prototype?
A matter of taste I think. The cast is neccessary to get rid of the
"const", not because it isn't a pointer type. There are a couple of
similar cases in the same file and Ulrich used (char *) there too.
By the way, to be consistent with the rest of the code there should be
a space between (char *) and result->errstring.
Mark
More information about the Libc-hacker
mailing list