[asterisk-dev] russell: branch 1.4 r83432 - in /branches/1.4: channels/ include/asterisk/ ma...

Tony Mountifield tony at softins.clara.co.uk
Fri Sep 21 11:33:12 CDT 2007


In article <20070921143722.B2D13A93B82 at lists.digium.internal>,
SVN commits to the Digium repositories <svn-commits at lists.digium.com> wrote:
> Author: russell
> Date: Fri Sep 21 09:37:20 2007
> New Revision: 83432
> 
> URL: http://svn.digium.com/view/asterisk?view=rev&rev=83432
> Log:
> gcc 4.2 has a new set of warnings dealing with cosnt pointers.  This set of
> changes gets all of Asterisk (minus chan_alsa for now) to compile with gcc 4.2.
> (closes issue #10774, patch from qwell)

To take just one example from many, if the compiler is noticing const-ness
of some args and insisting the prototype honours that, shouldn't the const
be preserved, within the function too, so the compiler can flag up attempts
to write via the pointer? e.g.

> Modified: branches/1.4/channels/chan_h323.c
> URL:
> http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_h323.c?view=diff&rev=83432&r1=83431&r2=83432
> ==============================================================================
> --- branches/1.4/channels/chan_h323.c (original)
> +++ branches/1.4/channels/chan_h323.c Fri Sep 21 09:37:20 2007
> @@ -303,9 +303,9 @@
>  	free(peer);
>  }
>  
> -static int oh323_simulate_dtmf_end(void *data)
> -{
> -	struct oh323_pvt *pvt = data;
> +static int oh323_simulate_dtmf_end(const void *data)
> +{
> +	struct oh323_pvt *pvt = (struct oh323_pvt *)data;

    const struct oh323_pvt *pvt = (const struct oh323_pvt *)data;

And so on, with many other instances. An arduous task, I know (is that
what you call a janitor project?), but I'm initially just asking what
would be pedantically correct.

Cheers
Tony
-- 
Tony Mountifield
Work: tony at softins.co.uk - http://www.softins.co.uk
Play: tony at mountifield.org - http://tony.mountifield.org



More information about the asterisk-dev mailing list