Subject: Re: CVS commit: src/distrib/utils/sysinst
To: None <source-changes@netbsd.org>
From: Christos Zoulas <christos@zoulas.com>
List: source-changes
Date: 05/09/2003 13:02:43
In article <20030509125018.GC7374@mewburn.net>,
Luke Mewburn <lukem@netbsd.org> wrote:
>On Fri, May 09, 2003 at 12:45:02PM +0000, David Laight wrote:
>  | 
>  | Module Name:	src
>  | Committed By:	dsl
>  | Date:		Fri May  9 12:45:02 UTC 2003
>  | 
>  | Modified Files:
>  | 	src/distrib/utils/sysinst: util.c
>  | 
>  | Log Message:
>  | Allow for menu 'opt_name' being const char *.
>
>
>You've changed the offending code it:
>	free((void *)tz_menu[n].opt_name);
>
>That does not work with
>	-Wcast-qual
>gcc is too "smart" and const-poisons the pointer.
>
>
>I think you're just going to have to accept that menu_ent has a "char *"
>and not a "const char *" member ...  :-(

The trick I use to fool gcc is:

#define __UNCONST(a)	((a) ? strchr((a), *(a)) : NULL)

	free(__UNCONST(tz_menu[n].opt_name));

[Yes, I know it is disgusting]

christos